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

feat: add cdc templating with configmap #103

Merged
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
73 changes: 73 additions & 0 deletions chart/assets/cdc/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ "{{" }} .resource {{ "}}" }}-{{ "{{" }} .apiVersion {{ "}}" }}-controller
namespace: {{ "{{" }} .namespace {{ "}}" }}
labels:
app.kubernetes.io/name: {{ "{{" }} .name {{ "}}" }}
app.kubernetes.io/instance: {{ "{{" }} .resource {{ "}}" }}-{{ "{{" }} .apiVersion {{ "}}" }}
app.kubernetes.io/component: controller
app.kubernetes.io/part-of: krateoplatformops
app.kubernetes.io/managed-by: krateo
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.cdc.replicaCount }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ "{{" }} .name {{ "}}" }}
template:
metadata:
name: {{ "{{" }} .name {{ "}}" }}
namespace: {{ "{{" }} .namespace {{ "}}" }}
labels:
app.kubernetes.io/name: {{ "{{" }} .name {{ "}}" }}
spec:
serviceAccountName: {{ "{{" }} .name {{ "}}" }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ "{{" }} .resource {{ "}}" }}-{{ "{{" }} .apiVersion {{ "}}" }}-controller
image: "{{ .Values.cdc.image.repository }}:{{ .Values.cdc.image.tag | default "0.15.3" }}"
imagePullPolicy: {{ .Values.cdc.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ "{{" }} .resource {{ "}}" }}-{{ "{{" }} .apiVersion {{ "}}" }}-cdc-configmap
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
args:
- -debug
- -group={{ "{{" }} .apiGroup {{ "}}" }}
- -version={{ "{{" }} .apiVersion {{ "}}" }}
- -resource={{ "{{" }} .resource {{ "}}" }}
- -namespace={{ "{{" }} .namespace {{ "}}" }}
ports:
- name: http
containerPort: {{ .Values.cdc.service.port }}
protocol: TCP
livenessProbe:
{{- toYaml .Values.cdc.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.cdc.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.cdc.resources | nindent 12 }}
{{- with .Values.cdc.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.cdc.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cdc.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cdc.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cdc.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
9 changes: 9 additions & 0 deletions chart/templates/cdc-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "core-provider.fullname" . }}-cdc-deployment
labels:
{{- include "core-provider.labels" . | nindent 4 }}
data:
deployment.yaml: |
{{ tpl (.Files.Get "assets/cdc/deployment.yaml") . | indent 6 }}
11 changes: 11 additions & 0 deletions chart/templates/configmap-cdc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "core-provider.fullname" . }}-cdc
labels:
{{- include "core-provider.labels" . | nindent 4 }}
data:
HOME: /tmp # home should be set to /tmp or any other writable directory to avoid permission issues with helm https://github.com/helm/helm/issues/8038
{{- range $key, $value := .Values.env }}
{{ $key }}: {{ $value | quote }}
{{- end }}
17 changes: 11 additions & 6 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ include "core-provider.fullname" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "core-provider.fullname" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
# image: kind.local/core-provider:latest
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
Expand All @@ -55,12 +54,18 @@ spec:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
- mountPath: /tmp/assets
name: cdc-deployment
readOnly: true
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
- name: cdc-deployment
configMap:
name: {{ include "core-provider.fullname" . }}-cdc-deployment
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
98 changes: 97 additions & 1 deletion chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,100 @@ affinity: {}

env:
CORE_PROVIDER_DEBUG: "true"
CDC_IMAGE_TAG: 0.15.3

cdc:
image:
repository: ghcr.io/krateoplatformops/composition-dynamic-controller
pullPolicy: IfNotPresent
tag: 0.15.3
replicaCount: 1
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

serviceAccount:
# Specifies whether a service account should be created
create: true
# Automatically mount a ServiceAccount's API credentials?
automount: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""

podAnnotations: {}
podLabels: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
type: ClusterIP
port: 80

ingress:
enabled: false
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

# livenessProbe:
# httpGet:
# path: /
# port: http
# readinessProbe:
# httpGet:
# path: /
# port: http

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

# Additional volumes on the output Deployment definition.
volumes: []

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []

nodeSelector: {}

tolerations: []

affinity: {}

env: []
Loading