Skip to content

Commit

Permalink
validate k8s api version
Browse files Browse the repository at this point in the history
Signed-off-by: Ashwani Singh <ashwani.singh@opstree.com>
  • Loading branch information
ashwani-opstree committed Jul 9, 2024
1 parent df2dfef commit 3fe032f
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 40 deletions.
23 changes: 3 additions & 20 deletions charts/microservice/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
apiVersion: v2
name: microservice
description: A Helm chart for a microservice in Kubernetes

# A chart can be either an 'application' or a 'library' chart
#
# Application chart deploys a complete application, includes all necessary Kubernetes resources,
# used for installing and managing applications.
#
# Library chart provides reusable templates and components, does not deploy an application by itself,
# used to promote consistency and reuse across multiple charts.
type: application

# This is the chart version. This chart version should be incremented with each change to the chart
# or its templates, including the app version.
# Follow Semantic Versioning (https://semver.org/).
version: 0.1.2

# This is the application version number, which should be incremented with each change to the application.
# It doesn't need to follow Semantic Versioning but should reflect the application's version.
# Quotes are recommended.
appVersion: "0.1.2"

# This is maintainers files. this field lists the individuals or teams responsible for maintaining the Helm chart.
# It typically includes their names and contact information, such as email addresses.
maintainers:
- name: Opstree Solutions
- name: Ashwani Singh
email: ashwani.singh@opstree.com
- name: Shikha Tripathi
9 changes: 5 additions & 4 deletions charts/microservice/examples/deploy-nginx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ deployment:
volumes:
enabled: true
configMaps:
- name: webapp
mountPath: /webapp
- name: index
mountPath: /usr/share/nginx/html
data:
webapp.conf: |
name="opstree"
index.html: |
Hello! Opstree
2 changes: 1 addition & 1 deletion charts/microservice/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "microservice.fullname" $root }}-{{ $cm.name }}-cm
namespace: {{ $root.Values.global.namespace }}
namespace: {{ $root.Values.global.namespace | quote }}
data:
{{- if $cm.data }}
{{- range $filename, $content := $cm.data }}
Expand Down
10 changes: 8 additions & 2 deletions charts/microservice/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{ $root := . }}
---
apiVersion: apps/v1
apiVersion: {{ include "microservice.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "microservice.fullname" . }}-app
namespace: {{ .Values.global.namespace }}
namespace: {{ .Values.global.namespace | quote }}
{{- if .Values.annotations }}
annotations:
{{- range $key, $value := .Values.annotations }}
Expand Down Expand Up @@ -32,6 +32,12 @@ spec:
- name: {{ include "microservice.fullname" . }}
image: "{{ .Values.deployment.image.name }}:{{ .Values.deployment.image.tag }}"
imagePullPolicy: {{ .Values.deployment.image.pullPolicy }}
{{- if .Values.deployment.command }}
command: {{ .Values.deployment.command }}
{{- end }}
{{- if .Values.deployment.args }}
args: {{ .Values.deployment.args }}
{{- end }}
ports:
{{- range .Values.service.specs}}
- name: {{ .name }}
Expand Down
2 changes: 1 addition & 1 deletion charts/microservice/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: {{ include "microservice.capabilities.hpa.apiVersion" ( dict "contex
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "microservice.fullname" . }}-hpa
namespace: {{ .Values.global.namespace }}
namespace: {{ .Values.global.namespace | quote }}
labels:
{{- include "microservice.labels" . | nindent 4 }}
spec:
Expand Down
2 changes: 1 addition & 1 deletion charts/microservice/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.deployment.volumes.pvc.name }}
namespace: {{ .Values.global.namespace }}
namespace: {{ .Values.global.namespace | quote }}
spec:
{{- if .Values.deployment.volumes.pvc.class }}
storageClassName: {{ .Values.deployment.volumes.pvc.class }}
Expand Down
2 changes: 1 addition & 1 deletion charts/microservice/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "microservice.fullname" . }}-svc
namespace: {{ .Values.global.namespace }}
namespace: {{ .Values.global.namespace | quote }}
{{- if .Values.service.annotations }}
annotations:
{{- range $key, $value := .Values.service.annotations }}
Expand Down
1 change: 1 addition & 0 deletions charts/microservice/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "microservice.serviceAccountName" . }}-sa
namespace: {{ .Values.global.namespace | quote }}
labels:
{{- include "microservice.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
Expand Down
21 changes: 11 additions & 10 deletions charts/microservice/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ deployment:
successThreshold: 1
failureThreshold: 5

# command: ["/bin/sh","-c"]
# args: ["echo 'consuming a message'; sleep 5"]

environment: {}
# VAR1: value1

Expand All @@ -62,17 +65,15 @@ deployment:
# Additional volumes on the output Deployment definition.
volumes:
enabled: true
pvc:
pvc:
enabled: false
# pvc:
# enabled: false
# existing_claim: false
# name: pvc
# mountPath: /pv
# size: 1G
# class: "default"
# accessModes:
# - ReadWriteOnce
existing_claim: false
name: pvc
mountPath: /pv
size: 1G
class: "default"
accessModes:
- ReadWriteOnce

# configFileCommonHeader: |
# line1
Expand Down

0 comments on commit 3fe032f

Please sign in to comment.