-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #6 : Add Namespace and Probes Configuration to Kubernetes Manifests #7
base: main
Are you sure you want to change the base?
Changes from all commits
9f6b9bd
647f337
931e99a
d39a512
d421355
ab32e68
b2e54fd
01d71e2
bb69782
4ef0a98
ba98d11
7234332
b9f58e6
a8df846
d0364ac
d1b7e62
4203578
9630037
c9d7c60
42a31a4
91b183c
9ea3325
bf9ab27
312d157
bfcf826
e987067
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if port is not set? We cant enforce it since exposing is optional There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah but this template is meant to expose the port specified by the user. |
||
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 }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you rever the resources object since its not format properly and it can cause a null pointer because of deleted brackets There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
{{- 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 }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add brackets the same way it was done in the resources object to avoid null objects |
||
{{- 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 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": { | ||
RohanRusta21 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"description": "Startup probe configuration", | ||
"type": "object", | ||
"properties": { | ||
RohanRusta21 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"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": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @petar-cvit , Yup its done now. Please Review it :) |
||
"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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @petar-cvit , actually initially I tried to have separate toggle for each probe. But it was not working fine. Maybe will try it again. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please do. You can paste the error here if you want and we can try to figure it out There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We refactored manifest rendering so you can try out the template again with the updated version. |
||
"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" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave this default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we can