Skip to content
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

Sidecar #148

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dotnet/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: .NET Core Helm Chart
name: dotnet
version: 13.1.1
version: 13.2.0
dependencies:
- name: libchart
version: 4.1.1
version: 4.2.0
repository: file://../libchart
4 changes: 2 additions & 2 deletions golang/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: golan Helm Chart
name: golang
version: 17.1.1
version: 17.2.0
dependencies:
- name: libchart
version: 4.1.1
version: 4.2.0
repository: file://../libchart
4 changes: 2 additions & 2 deletions java/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: Java Helm Chart
name: java
version: 10.1.1
version: 10.2.0
dependencies:
- name: libchart
version: 4.1.1
version: 4.2.0
repository: file://../libchart
43 changes: 43 additions & 0 deletions java/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,49 @@ image:
# pullSecrets:
# - secret1
# - secret2
sidecars: {}
# - name: helper1
# image:
# repository: "repo"
# tag: "123"
# extraContainerPorts: [8088, 9099]
# securityContext:
# readOnlyRootFilesystem: true
# allowPrivilegeEscalation: false
# resources:
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# environment: { }
# secrets: { }
# volumeMounts: [ ]
# # - name: secret-volume
# # mountPath: /app/secrets
# # readOnly: true
# - name: helper2
# image:
# repository: "repo"
# tag: "456"
# extraContainerPorts: [8088, 9099]
# securityContext:
# readOnlyRootFilesystem: true
# allowPrivilegeEscalation: false
# resources:
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# environment: { }
# secrets: { }
# volumeMounts:
# - name: secret-volume
# mountPath: /app/secrets
# readOnly: true

initContainers: {}
# - name: network-proxy
Expand Down
2 changes: 1 addition & 1 deletion libchart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: library
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 4.1.1
version: 4.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
65 changes: 65 additions & 0 deletions libchart/templates/_container.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{{- define "libchart.container" }}
image: "{{ .image.repository }}:{{ .image.tag }}"
imagePullPolicy: Always
{{- if .command }}
command:
{{ toYaml .command | nindent 6 }}
{{- end }}
{{- if .args }}
args:
{{ toYaml .args | nindent 6 }}
{{- end }}
{{- if or (.volumeMounts) (.csi) }}
volumeMounts:
{{- if .volumeMounts }}
{{- toYaml .volumeMounts | nindent 6 }}
{{- end }}
{{- if .csi }}
- name: {{ .csi.name }}
mountPath: {{ .csi.mountPath | quote }}
readOnly: true
{{- end }}
{{- end }}
ports:
{{- if .deployKind }} {{/* a hack to check if we are in the root context or in a sidecar; sidecars are not using the port mapping from the service */}}
{{- "- name: http" | nindent 4 }}
{{- "containerPort: " | nindent 6 }}{{ .service.targetPort | default 8080 }}
protocol: TCP
{{- end }}
{{- if .extraContainerPorts }}
{{ toYaml .extraContainerPorts | nindent 6 }}
{{- end }}
{{- $liveness := default dict .liveness }}
{{- $livenessEnabled := default false $liveness.enabled }}
{{- if and $liveness $livenessEnabled }}
livenessProbe:
httpGet:
path: {{ .liveness.path | default "/" }}
port: {{ .liveness.port | default 8080 }}
initialDelaySeconds: {{ .liveness.delay | default 15 }}
timeoutSeconds: {{ .liveness.timeout | default 15 }}
periodSeconds: {{ .liveness.periodSeconds | default 15 }}
{{- end }}
{{- $readiness := default dict .readiness }}
{{- $readinessEnabled := default false $readiness.enabled }}
{{- if and $readiness $readinessEnabled }}
readinessProbe:
httpGet:
path: {{ .readiness.path | default "/" }}
port: {{ .readiness.port | default 8080 }}
initialDelaySeconds: {{ .readiness.delay | default 15 }}
timeoutSeconds: {{ .readiness.timeout | default 15 }}
periodSeconds: {{ .readiness.periodSeconds | default 15 }}
{{- end }}
env:
{{- if .secrets }}
{{ toYaml .secrets | nindent 6 }}
{{- end }}
{{- if .environment }}
{{ toYaml .environment | nindent 6 }}
{{- end }}
resources:
{{- toYaml .resources | nindent 6 }}
securityContext:
{{- toYaml .securityContext | nindent 6 }}
{{- end }}
64 changes: 7 additions & 57 deletions libchart/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,63 +16,13 @@ initContainers:

containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: Always
{{- if .Values.command }}
command:
{{ toYaml .Values.command | nindent 6 }}
{{- end }}
{{- if .Values.args }}
args:
{{ toYaml .Values.args | nindent 6 }}
{{- end }}
{{- if or (.Values.volumeMounts) (.Values.csi) }}
volumeMounts:
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 6 }}
{{- end }}
{{- if .Values.csi }}
- name: {{ .Values.csi.name }}
mountPath: {{ .Values.csi.mountPath | quote }}
readOnly: true
{{- end }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.targetPort | default 8080 }}
protocol: TCP
{{ if .Values.extraContainerPorts }}
{{ toYaml .Values.extraContainerPorts | nindent 6 }}
{{- end }}
{{- if and (.Values.liveness) (.Values.liveness.enabled) }}
livenessProbe:
httpGet:
path: {{ .Values.liveness.path | default "/" }}
port: {{ .Values.liveness.port | default 8080 }}
initialDelaySeconds: {{ .Values.liveness.delay | default 15 }}
timeoutSeconds: {{ .Values.liveness.timeout | default 15 }}
periodSeconds: {{ .Values.liveness.periodSeconds | default 15 }}
{{- end }}
{{- if and (.Values.readiness) (.Values.readiness.enabled) }}
readinessProbe:
httpGet:
path: {{ .Values.readiness.path | default "/" }}
port: {{ .Values.readiness.port | default 8080 }}
initialDelaySeconds: {{ .Values.readiness.delay | default 15 }}
timeoutSeconds: {{ .Values.readiness.timeout | default 15 }}
periodSeconds: {{ .Values.readiness.periodSeconds | default 15 }}
{{- end }}
env:
{{- if .Values.secrets }}
{{ toYaml .Values.secrets | nindent 6 }}
{{- end }}
{{- if .Values.environment }}
{{ toYaml .Values.environment | nindent 6 }}
{{- end }}
resources:
{{ toYaml .Values.resources | nindent 6 }}
securityContext:
{{- toYaml .Values.securityContext | nindent 6 }}
{{- include "libchart.container" .Values | indent 2 -}}
{{- range $sc := .Values.sidecars -}}
{{ "- name: " | nindent 2 }}{{ $sc.name }}
{{- include "libchart.container" $sc | indent 2 }}
{{- end }}
{{- if .Values.initContainers }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | nindent 4 }}
Expand Down
43 changes: 43 additions & 0 deletions libchart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,49 @@ image:
# pullSecrets:
# - secret1
# - secret2
sidecars: {}
# - name: helper1
# image:
# repository: "repo"
# tag: "123"
# extraContainerPorts: [8088, 9099]
# securityContext:
# readOnlyRootFilesystem: true
# allowPrivilegeEscalation: false
# resources:
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# environment: { }
# secrets: { }
# volumeMounts: [ ]
# # - name: secret-volume
# # mountPath: /app/secrets
# # readOnly: true
# - name: helper2
# image:
# repository: "repo"
# tag: "456"
# extraContainerPorts: [8088, 9099]
# securityContext:
# readOnlyRootFilesystem: true
# allowPrivilegeEscalation: false
# resources:
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# environment: { }
# secrets: { }
# volumeMounts:
# - name: secret-volume
# mountPath: /app/secrets
# readOnly: true

initContainers: {}
# - name: network-proxy
Expand Down
4 changes: 2 additions & 2 deletions nodejs/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
description: Node.js Helm Chart
name: nodejs
version: 17.1.1
version: 17.2.0
dependencies:
- name: libchart
version: 4.1.1
version: 4.2.0
repository: file://../libchart
4 changes: 2 additions & 2 deletions web/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
appVersion: "1.0"
description: Helm chart for deployment of web servers
name: web
version: 14.1.1
version: 14.2.0
dependencies:
- name: libchart
version: 4.1.1
version: 4.2.0
repository: file://../libchart
Loading