From 5b924fd4ac015b0ff1875649ecbb11d3bcd42f18 Mon Sep 17 00:00:00 2001 From: komodor-bot Date: Sun, 14 Jan 2024 18:57:23 +0000 Subject: [PATCH] feat(OSS komoplane): feat(helm-chart): add annotations and labels to resources (#51) * feat: add default labels to ClusterRole and ClusterRoleBinding * feat: add ability to specify annotations for service * feat: add ability to specify labels for Ingress, Service & ServiceAccount * fix: add missing serviceAccount.annotations to values.yaml --- charts/komoplane/Chart.yaml | 4 +-- charts/komoplane/templates/deployment.yaml | 4 +++ charts/komoplane/templates/ingress.yaml | 3 ++ charts/komoplane/templates/service.yaml | 7 ++++ .../komoplane/templates/serviceaccount.yaml | 7 ++++ charts/komoplane/values.yaml | 36 +++++++++++-------- 6 files changed, 44 insertions(+), 17 deletions(-) diff --git a/charts/komoplane/Chart.yaml b/charts/komoplane/Chart.yaml index fde6b4c2..3b3f4ba0 100644 --- a/charts/komoplane/Chart.yaml +++ b/charts/komoplane/Chart.yaml @@ -5,7 +5,7 @@ name: komoplane description: Komodor tool to visualize Crossplane icon: https://raw.githubusercontent.com/komodorio/komoplane/main/pkg/frontend/src/assets/logo.svg -version: 0.1.4 -appVersion: "0.1.4" +version: 0.1.5 +appVersion: "0.1.5" # docker build . -t komodorio/komoplane:unstable && kind load docker-image komodorio/komoplane:unstable && helm upgrade --install komoplane charts/komoplane --set image.tag=unstable diff --git a/charts/komoplane/templates/deployment.yaml b/charts/komoplane/templates/deployment.yaml index f2bb8e60..dab292e8 100644 --- a/charts/komoplane/templates/deployment.yaml +++ b/charts/komoplane/templates/deployment.yaml @@ -46,6 +46,10 @@ spec: env: - name: DEBUG value: {{- ternary " '1'" "" .Values.komoplane.debug }} + - name: KP_MR_CACHE_TTL + value: {{ .Values.komoplane.mrCacheTTL | default "1m" }} + - name: KP_MRD_CACHE_TTL + value: {{ .Values.komoplane.mrdCacheTTL | default "5m" }} ports: - name: http containerPort: 8090 diff --git a/charts/komoplane/templates/ingress.yaml b/charts/komoplane/templates/ingress.yaml index ced20f9c..ee50d1de 100644 --- a/charts/komoplane/templates/ingress.yaml +++ b/charts/komoplane/templates/ingress.yaml @@ -18,6 +18,9 @@ metadata: name: {{ $fullName }} labels: {{- include "app.labels" . | nindent 4 }} + {{- with .Values.ingress.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} {{- with .Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/komoplane/templates/service.yaml b/charts/komoplane/templates/service.yaml index a3164fc5..4425b630 100644 --- a/charts/komoplane/templates/service.yaml +++ b/charts/komoplane/templates/service.yaml @@ -4,6 +4,13 @@ metadata: name: {{ include "app.fullname" . }} labels: {{- include "app.labels" . | nindent 4 }} + {{- with .Values.service.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: type: {{ .Values.service.type }} ports: diff --git a/charts/komoplane/templates/serviceaccount.yaml b/charts/komoplane/templates/serviceaccount.yaml index 8360696b..f4bd2f08 100644 --- a/charts/komoplane/templates/serviceaccount.yaml +++ b/charts/komoplane/templates/serviceaccount.yaml @@ -5,6 +5,9 @@ metadata: name: {{ include "app.serviceAccountName" . }} labels: {{- include "app.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} @@ -15,6 +18,8 @@ kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ include "app.serviceAccountName" . }} + labels: + {{- include "app.labels" . | nindent 4 }} rules: - apiGroups: ["*"] resources: ["*"] @@ -24,6 +29,8 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: {{ include "app.serviceAccountName" . }} + labels: + {{- include "app.labels" . | nindent 4 }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole diff --git a/charts/komoplane/values.yaml b/charts/komoplane/values.yaml index a08e92fd..3b8992ec 100644 --- a/charts/komoplane/values.yaml +++ b/charts/komoplane/values.yaml @@ -1,3 +1,9 @@ +komoplane: + # Flag for setting environment to debug mode + debug: false + mrCacheTTL: 1m # cache list of MRs for this time + mrdCacheTTL: 5m # cache list of MRDs for this time + replicaCount: 1 image: @@ -6,7 +12,7 @@ image: # Overrides the image tag whose default is the chart appVersion. tag: "" -imagePullSecrets: [] +imagePullSecrets: [ ] nameOverride: "" fullnameOverride: "" @@ -16,6 +22,8 @@ serviceAccount: # The name of the service account to use. # If not set and create is true, a name is generated using the fullname template name: "" + annotations: { } + labels: { } resources: requests: @@ -25,11 +33,6 @@ resources: cpu: 1 memory: 1Gi -komoplane: - # Flag for setting environment to debug mode - debug: false - - ## @param.updateStrategy.type Set up update strategy for installation. ## Set to Recreate if you use persistent volume that cannot be mounted by more than one pods to make sure the pods is destroyed first. @@ -45,10 +48,10 @@ updateStrategy: type: RollingUpdate -podLabels: {} -podAnnotations: {} +podLabels: { } +podAnnotations: { } -podSecurityContext: +podSecurityContext: fsGroup: 2000 securityContext: @@ -57,22 +60,25 @@ securityContext: runAsUser: 1000 capabilities: drop: - - ALL + - ALL service: type: ClusterIP port: 8090 + annotations: { } + labels: { } ingress: enabled: false className: "" - annotations: {} + annotations: { } + labels: { } hosts: - host: chart-example.local paths: - path: / pathType: ImplementationSpecific - tls: [] + tls: [ ] autoscaling: enabled: false @@ -80,12 +86,12 @@ autoscaling: maxReplicas: 100 targetCPUUtilizationPercentage: 80 -nodeSelector: {} +nodeSelector: { } extraArgs: - --bind=0.0.0.0 -tolerations: [] +tolerations: [ ] -affinity: {} +affinity: { }