diff --git a/demo-extended/templates/deployment.yaml b/demo-extended/templates/deployment.yaml index 151cdc6..2f31b38 100644 --- a/demo-extended/templates/deployment.yaml +++ b/demo-extended/templates/deployment.yaml @@ -2,10 +2,11 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ .Values.name }} + namespace: {{ .Values.namespace }} labels: app: {{ .Values.name }} spec: - replicas: {{ (.Values.scaling).replicas | default 1 }} + replicas: {{ .Values.scaling.replicas }} selector: matchLabels: app: {{ .Values.name }} @@ -17,32 +18,50 @@ spec: containers: - name: {{ .Values.name }} image: "{{ .Values.general.image }}:{{ .Values.general.version }}" - {{- if ((.Values.networking).expose) }} + {{- if .Values.networking.expose }} ports: - name: http - containerPort: {{ .Values.networking.port | default 80 }} + containerPort: {{ .Values.networking.port }} protocol: TCP {{- end }} env: - {{- if ((.Values.general).environment) }} - {{- range $key, $value := (.Values.general).environment }} + {{- range $key, $value := .Values.general.environment }} - name: {{ $key }} value: {{ $value | quote }} {{- end }} - {{- end }} {{- if or ((.Values.scaling).resources).memory ((.Values.scaling).resources).cpu }} resources: - {{- if ((.Values.scaling).resources).memory }} + {{- if .Values.scaling.resources.memory }} limits: - memory: {{ ((.Values.scaling).resources).memory }}Gi + memory: "{{ .Values.scaling.resources.memory }}Gi" {{- end }} - {{- if or ((.Values.scaling).resources).memory ((.Values.scaling).resources).cpu }} + {{- if .Values.scaling.resources.cpu }} requests: - {{- if ((.Values.scaling).resources).cpu }} - cpu: {{ ((.Values.scaling).resources).cpu }} - {{- end }} - {{- if ((.Values.scaling).resources).memory }} - memory: {{ ((.Values.scaling).resources).memory }}Gi - {{- end }} + cpu: "{{ .Values.scaling.resources.cpu }}" {{- end }} {{- end }} + {{- if .Values.probes.enabled }} + {{- with .Values.probes }} + readinessProbe: + httpGet: + path: {{ .readiness.path }} + port: http + initialDelaySeconds: {{ .readiness.initialDelaySeconds }} + periodSeconds: {{ .readiness.periodSeconds }} + failureThreshold: {{ .readiness.failureThreshold }} + livenessProbe: + httpGet: + path: {{ .liveness.path }} + port: http + initialDelaySeconds: {{ .liveness.initialDelaySeconds }} + periodSeconds: {{ .liveness.periodSeconds }} + failureThreshold: {{ .liveness.failureThreshold }} + startupProbe: + httpGet: + path: {{ .startup.path }} + port: http + initialDelaySeconds: {{ .startup.initialDelaySeconds }} + periodSeconds: {{ .startup.periodSeconds }} + failureThreshold: {{ .startup.failureThreshold }} + {{- end }} + {{- end }} diff --git a/demo-extended/templates/services.yaml b/demo-extended/templates/services.yaml index d03819a..5ed79db 100644 --- a/demo-extended/templates/services.yaml +++ b/demo-extended/templates/services.yaml @@ -3,6 +3,7 @@ apiVersion: v1 kind: Service metadata: name: {{ .Values.name }} + namespace: {{ .Values.namespace }} labels: app: {{ .Values.name }} spec: @@ -14,4 +15,4 @@ spec: name: http selector: app: {{ .Values.name }} - {{- end }} + {{- end }} \ No newline at end of file diff --git a/demo-extended/values.schema.json b/demo-extended/values.schema.json index f152a43..61e9f02 100644 --- a/demo-extended/values.schema.json +++ b/demo-extended/values.schema.json @@ -1,109 +1,201 @@ { + "title": "Values", + "type": "object", "properties": { "name": { - "type": "string", - "title": "Name", - "description": "Application name" + "description": "Application name", + "type": "string" + }, + "namespace": { + "description": "Kubernetes namespace", + "type": "string" }, "general": { + "description": "General configuration", "type": "object", - "title": "General", "properties": { "image": { - "title": "App image", - "type": "string", - "description": "Application image" + "description": "Container image", + "type": "string" }, "version": { - "title": "Image version", - "type": "string", - "description": "Image tag you want to deploy" + "description": "Container image version", + "type": "string" }, "environment": { - "title": "Environment variables", + "description": "Environment variables", "type": "object", - "description": "Set environment variables" + "additionalProperties": { + "type": "string" + } } }, "required": [ "image", "version" - ], - "order": [ - "image", - "version", - "environment" ] }, "scaling": { + "description": "Scaling configuration", "type": "object", - "title": "Scaling", "properties": { "replicas": { - "title": "Replicas", - "type": "integer", - "description": "Number of instances you want to deploy", - "minimum": 0 + "description": "Number of replicas", + "type": "integer" }, "resources": { + "description": "Resource limits and requests", "type": "object", - "title": "Resources", "properties": { "cpu": { - "title": "CPUs", - "type": "integer", - "description": "Number of CPUs your applications needs" + "description": "CPU resource request", + "type": "string" }, "memory": { - "title": "Memory", - "description": "Measured in Gi", + "description": "Memory resource limit", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "required": [ + "replicas" + ] + }, + "probes": { + "description": "Probe configuration", + "type": "object", + "properties": { + "enabled": { + "description": "Enable probes", + "type": "boolean" + }, + "startup": { + "description": "Startup probe configuration", + "type": "object", + "properties": { + "path": { + "description": "HTTP path for probe", + "type": "string" + }, + "initialDelaySeconds": { + "description": "Initial delay for probe", + "type": "integer" + }, + "periodSeconds": { + "description": "Period for probe", + "type": "integer" + }, + "failureThreshold": { + "description": "Failure threshold for probe", "type": "integer" } }, - "order": [ - "cpu", - "memory" + "required": [ + "path", + "initialDelaySeconds", + "periodSeconds", + "failureThreshold" + ] + }, + "liveness": { + "description": "Liveness probe configuration", + "type": "object", + "properties": { + "path": { + "description": "HTTP path for probe", + "type": "string" + }, + "initialDelaySeconds": { + "description": "Initial delay for probe", + "type": "integer" + }, + "periodSeconds": { + "description": "Period for probe", + "type": "integer" + }, + "failureThreshold": { + "description": "Failure threshold for probe", + "type": "integer" + } + }, + "required": [ + "path", + "initialDelaySeconds", + "periodSeconds", + "failureThreshold" + ] + }, + "readiness": { + "description": "Readiness probe configuration", + "type": "object", + "properties": { + "path": { + "description": "HTTP path for probe", + "type": "string" + }, + "initialDelaySeconds": { + "description": "Initial delay for probe", + "type": "integer" + }, + "periodSeconds": { + "description": "Period for probe", + "type": "integer" + }, + "failureThreshold": { + "description": "Failure threshold for probe", + "type": "integer" + } + }, + "required": [ + "path", + "initialDelaySeconds", + "periodSeconds", + "failureThreshold" ] } }, "required": [ - "replicas" - ], - "order": [ - "replicas", - "resources" + "enabled", + "startup", + "liveness", + "readiness" ] }, "networking": { + "description": "Networking configuration", "type": "object", - "title": "Networking", "properties": { "expose": { - "title": "Expose", - "type": "boolean", - "description": "Create a Service for your application" + "description": "Expose container port", + "type": "boolean" }, "port": { - "title": "Port", - "type": "integer", - "description": "Port to expose for your application" + "description": "Container port", + "type": "integer" } }, - "order": [ + "required": [ "expose", "port" ] } }, - "required": [ - "name" - ], "order": [ "name", + "namespace", "general", "scaling", + "probes", "networking" ], - "title": "Values", - "type": "object" + "required": [ + "name", + "namespace", + "general", + "scaling", + "probes", + "networking" + ] } diff --git a/demo-extended/values.yaml b/demo-extended/values.yaml index 903cf6c..5745bfb 100644 --- a/demo-extended/values.yaml +++ b/demo-extended/values.yaml @@ -1,14 +1,32 @@ name: my-app - +namespace: default general: image: nginx version: 1.14.2 environment: ENVIRONMENT: production - scaling: replicas: 3 - + resources: + cpu: 1 + memory: 512 +probes: + enabled: true + startup: + path: "/" + initialDelaySeconds: 5 + periodSeconds: 10 + failureThreshold: 3 + liveness: + path: "/" + initialDelaySeconds: 10 + periodSeconds: 20 + failureThreshold: 3 + readiness: + path: "/" + initialDelaySeconds: 5 + periodSeconds: 10 + failureThreshold: 3 networking: expose: true port: 8080