From 3778eb6d26cf9ba7a7dea3bf6c4c4225953bf501 Mon Sep 17 00:00:00 2001 From: Jozef Volak Date: Mon, 26 Aug 2024 10:39:36 +0200 Subject: [PATCH] [uniconfig] Extra objects configurable via helm chart --- charts/uniconfig/Chart.yaml | 6 +- charts/uniconfig/README.md | 14 +- charts/uniconfig/config/logback.xml | 239 ------------------ .../templates/configmap-logback.yaml | 8 - charts/uniconfig/templates/deployment.yaml | 57 ++++- charts/uniconfig/values.yaml | 99 ++++++-- 6 files changed, 129 insertions(+), 294 deletions(-) delete mode 100644 charts/uniconfig/config/logback.xml delete mode 100644 charts/uniconfig/templates/configmap-logback.yaml diff --git a/charts/uniconfig/Chart.yaml b/charts/uniconfig/Chart.yaml index d69912bf..699c5c71 100644 --- a/charts/uniconfig/Chart.yaml +++ b/charts/uniconfig/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: uniconfig -version: 8.1.0 +version: 8.2.0 appVersion: "6.1.1" description: A Helm chart for UniConfig Kubernetes deployment type: application @@ -22,7 +22,7 @@ icon: https://avatars.githubusercontent.com/u/23452093?s=200&v=4 annotations: artifacthub.io/changes: | - kind: added - description: Added servicemonitor and monitoring configuration + description: Add possibility to configure extra objects via helm chart [container, volume, extraConfigmapMounts] links: - name: GitHub PR - url: https://github.com/FRINXio/helm-charts/pull/397 + url: https://github.com/FRINXio/helm-charts/pull/416 diff --git a/charts/uniconfig/README.md b/charts/uniconfig/README.md index 11b63fe7..964226c7 100644 --- a/charts/uniconfig/README.md +++ b/charts/uniconfig/README.md @@ -2,7 +2,7 @@ A Helm chart for UniConfig Kubernetes deployment -![Version: 8.1.0](https://img.shields.io/badge/Version-8.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.1.1](https://img.shields.io/badge/AppVersion-6.1.1-informational?style=flat-square) +![Version: 8.2.0](https://img.shields.io/badge/Version-8.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.1.1](https://img.shields.io/badge/AppVersion-6.1.1-informational?style=flat-square) ## Get Repo Info @@ -44,17 +44,19 @@ helm uninstall [RELEASE_NAME] | alwaysRollAfterUpgrade | bool | `false` | | | args | list | `["/opt/uniconfig-frinx/run_uniconfig.sh"]` | Uniconfig container args | | autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80,"targetMemoryUtilizationPercentage":80}` | [Autoscaling parameters](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) | -| cacheConfigs | object | `{}` | global configuration of cache | +| cacheConfigs | object | `{}` | Global configuration of cache | | command | list | `["/bin/sh","-c"]` | Uniconfig container command | | dbPersistence.CLISHELL_SSHSERVER_USERNAMEPASSWORDAUTH_PASSWORD | string | `"admin"` | | | dbPersistence.POSTGRES_HOST | string | `nil` | Database hostname | | dbPersistence.POSTGRES_PASSWORD | string | `"postgresP"` | | | dbPersistence.POSTGRES_USERNAME | string | `"postgresU"` | Database credentials. Exposed when existing dbPersistence.existingSecret.secretName is empty | | dbPersistence.existingSecret | object | `{"clishellSshserverUsernamepasswordauthPasswordKey":null,"postgresPasswordKey":null,"postgresUsernameKey":null,"secretName":null}` | Existing database credentials | -| extraEnv | object | `{"CLISHELL_SSHSERVER_ENABLED":true,"CLISHELL_SSHSERVER_INETADDRESS":"0.0.0.0","DBPERSISTENCE_CONNECTION_DATABASELOCATIONS_0_PORT":5432,"DBPERSISTENCE_CONNECTION_MAXDBPOOLSIZE":300,"DBPERSISTENCE_EMBEDDEDDATABASE_ENABLED":false,"NOTIFICATIONS_ENABLED":true,"NOTIFICATIONS_KAFKA_KAFKASERVERS_0_BROKERHOST":"kafka","NOTIFICATIONS_KAFKA_KAFKASERVERS_0_BROKERLISTENINGPORT":9092,"SPRING_AUTOCONFIGURE_EXCLUDE":"org.springframework.cloud.stream.function.FunctionConfiguration","SPRING_CLOUD_BUS_ENABLED":false,"SPRING_KAFKA_BOOTSTRAPSERVERS":"http://kafka:9092","TRANSACTIONS_MAXSTOREDTRANSACTIONS":100,"TRANSACTIONS_MAXTRANSACTIONAGE":7200,"TRANSACTIONS_TRANSACTIONIDLETIMEOUT":3600,"UNICONFIG_CLOUD_CONFIG_ENABLED":false}` | Application properties | +| extraConfigmapMounts | list | `[]` | Extra config map attached to uniconfig container | +| extraContainers | list | `[]` | Extra containers | +| extraEnv | object | `{"CLISHELL_SSHSERVER_ENABLED":true,"CLISHELL_SSHSERVER_INETADDRESS":"0.0.0.0","DBPERSISTENCE_CONNECTION_DATABASELOCATIONS_0_PORT":5432,"DBPERSISTENCE_CONNECTION_DBNAME":"uniconfig","DBPERSISTENCE_CONNECTION_MAXDBPOOLSIZE":300,"DBPERSISTENCE_EMBEDDEDDATABASE_ENABLED":false,"NOTIFICATIONS_ENABLED":true,"NOTIFICATIONS_KAFKA_KAFKASERVERS_0_BROKERHOST":"kafka","NOTIFICATIONS_KAFKA_KAFKASERVERS_0_BROKERLISTENINGPORT":9092,"SPRING_AUTOCONFIGURE_EXCLUDE":"org.springframework.cloud.stream.function.FunctionConfiguration","SPRING_CLOUD_BUS_ENABLED":false,"SPRING_KAFKA_BOOTSTRAPSERVERS":"http://kafka:9092","TRANSACTIONS_MAXSTOREDTRANSACTIONS":100,"TRANSACTIONS_MAXTRANSACTIONAGE":7200,"TRANSACTIONS_TRANSACTIONIDLETIMEOUT":3600,"UNICONFIG_CLOUD_CONFIG_ENABLED":false}` | Application properties | | extraInitContainers | list | `[]` | Extra init containers | -| extraLogbackConfigMap | string | `nil` | | | extraScriptConfigMap | string | `nil` | | +| extraVolumes | list | `[]` | Extra volumes used in extraContainers and extraInitContainers | | fullnameOverride | string | `""` | String to fully override app name | | highAvailability.enabled | bool | `false` | Deploy extra traefik compatible resources to provide sticky session and zone loadbalancing | | highAvailability.hosts | list | `["uniconfig"]` | Additional traefik services which are used to forward requests to uniconfig controller with sticky session | @@ -76,7 +78,7 @@ helm uninstall [RELEASE_NAME] | java | object | `{"max_mem":"10G"}` | Java max memory for Uniconfig container | | kafka | object | `{"fullnameOverride":"kafka","listeners":{"client":{"protocol":"PLAINTEXT"}}}` | [Kafka subchart: "https://artifacthub.io/packages/helm/bitnami/kafka"] | | livenessProbe | object | `{"failureThreshold":10,"timeoutSeconds":35}` | Liveness probe | -| mibsConfigs | object | `{}` | global configuration of mibs | +| mibsConfigs | object | `{}` | Global configuration of mibs | | monitoring | object | `{"enabled":false,"path":"/actuator/prometheus","port":"http"}` | Monitoring configuration | | nameOverride | string | `""` | String to partially override app name | | nodeSelector | object | `{}` | [Node labels for pod assignment](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/) | @@ -99,6 +101,6 @@ helm uninstall [RELEASE_NAME] | startupProbe | object | `{"failureThreshold":25,"timeoutSeconds":35}` | Startup probe | | tolerations | list | `[]` | [Tolerations for pod assignment](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) | | utilitiesImage.pullPolicy | string | `"IfNotPresent"` | Image pull policy | -| utilitiesImage.repository | string | `"frinx/utilities-alpine"` | utilities image repository | +| utilitiesImage.repository | string | `"frinx/utilities-alpine"` | Utilities image repository | | utilitiesImage.tag | string | `"1.2"` | Overrides the image tag. | diff --git a/charts/uniconfig/config/logback.xml b/charts/uniconfig/config/logback.xml deleted file mode 100644 index 084a229f..00000000 --- a/charts/uniconfig/config/logback.xml +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - %d{HH:mm:ss.SSS} %level %logger - %msg%n - - - - log/${SERVICE_NAME}/${CONTAINER_ID}/logs.log - - %d{HH:mm:ss.SSS} %level %logger - %msg%n - - - 20 - log/${SERVICE_NAME}/${CONTAINER_ID}/logs.log.%i - - - 50MB - - - - - deviceName - unknown - - - - log/${SERVICE_NAME}/${CONTAINER_ID}/netconf-notifications/${deviceName}.log - - %d{HH:mm:ss.SSS} %level %logger - %msg%n - - - 20 - log/${SERVICE_NAME}/${CONTAINER_ID}/netconf-notifications/${deviceName}.log.%i - - - 16MB - - - - - - - deviceName - unknown - - - - log/${SERVICE_NAME}/${CONTAINER_ID}/netconf-messages/${deviceName}.log - - %d{HH:mm:ss.SSS} %level %logger - %msg%n - - - 20 - log/${SERVICE_NAME}/${CONTAINER_ID}/netconf-messages/${deviceName}.log.%i - - - 16MB - - - - - - - deviceName - unknown - - - - log/${SERVICE_NAME}/${CONTAINER_ID}/netconf-events/${deviceName}.log - - %d{HH:mm:ss.SSS} %level %logger - %msg%n - - - 20 - log/${SERVICE_NAME}/${CONTAINER_ID}/netconf-events/${deviceName}.log.%i - - - 16MB - - - - - - log/${SERVICE_NAME}/${CONTAINER_ID}/restconf.log - - %d{HH:mm:ss.SSS} %level %logger - %msg%n - - - 20 - log/${SERVICE_NAME}/${CONTAINER_ID}/restconf.%i - - - 50MB - - - - - deviceName - unknown - - - - log/${SERVICE_NAME}/${CONTAINER_ID}/cli-messages/${deviceName}.log - - %d{HH:mm:ss.SSS} %level %logger - %msg%n - - - 20 - log/${SERVICE_NAME}/${CONTAINER_ID}/cli-messages/${deviceName}.log.%i - - - 16MB - - - - - - - log/${SERVICE_NAME}/${CONTAINER_ID}/gnmi.log - - %d{HH:mm:ss} %level %logger - %msg%n - - - 20 - log/${SERVICE_NAME}/${CONTAINER_ID}/gnmi.log.%i - - - 16MB - - - - - log/${SERVICE_NAME}/${CONTAINER_ID}/metrics.log - - uniconfig,zone=${SERVICE_NAME},instance=${CONTAINER_ID} %replace(%replace(%msg){'=','="'}){', ','",'}"%n - - - 20 - log/${SERVICE_NAME}/${CONTAINER_ID}/metrics.log.%i - - - 16MB - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/charts/uniconfig/templates/configmap-logback.yaml b/charts/uniconfig/templates/configmap-logback.yaml deleted file mode 100644 index 17f23fef..00000000 --- a/charts/uniconfig/templates/configmap-logback.yaml +++ /dev/null @@ -1,8 +0,0 @@ -{{- if (include "uniconfig.createLogbackConfigMap" .) }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "uniconfig.fullname" . }}-configmap-logback -data: -{{- (.Files.Glob "config/logback.xml").AsConfig | nindent 2 }} -{{ end }} diff --git a/charts/uniconfig/templates/deployment.yaml b/charts/uniconfig/templates/deployment.yaml index bfedae31..55a6ae79 100644 --- a/charts/uniconfig/templates/deployment.yaml +++ b/charts/uniconfig/templates/deployment.yaml @@ -17,9 +17,9 @@ spec: {{- if .Values.alwaysRollAfterUpgrade }} rollme: {{ randAlphaNum 5 | quote }} {{- end }} - {{- with .Values.podAnnotations }} + {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} labels: {{- include "uniconfig.selectorLabels" . | nindent 8 }} spec: @@ -48,13 +48,14 @@ spec: emptyDir: {} - name: {{ include "uniconfig.logs-volume" . }} emptyDir: {} - - name: {{ include "uniconfig.logback-volume" . }} + {{- range .Values.extraConfigmapMounts }} + - name: {{ .name }} configMap: - name: {{ include "uniconfig.logbackConfigMapName" . }} - defaultMode: 0777 - items: - - key: logback.xml - path: logback.xml + name: {{ .configMapName }} + {{- end }} + {{- with .Values.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} initContainers: - name: check-db-ready image: "{{ .Values.utilitiesImage.repository }}:{{ .Values.utilitiesImage.tag }}" @@ -229,6 +230,40 @@ spec: mountPath: /opt/uniconfig-frinx/log - name: {{ include "uniconfig.data-volume" . }} mountPath: /opt/uniconfig-frinx - - name: {{ include "uniconfig.logback-volume" . }} - mountPath: /opt/uniconfig-frinx/config/logback.xml - subPath: logback.xml + {{- range .Values.extraConfigmapMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + subPath: {{ .subPath | quote }} + readOnly: {{ .readOnly }} + {{- end }} + {{- with .Values.extraContainers }} + {{- range . }} + - name: {{ .name }} + image: {{ .image | quote }} + imagePullPolicy: {{ .imagePullPolicy | quote }} + {{- if .command }} + command: + {{- toYaml .command | nindent 12 }} + {{- end }} + {{- if .args }} + args: + {{- toYaml .args | nindent 12 }} + {{- end }} + {{- if .ports }} + ports: + {{- toYaml .ports | nindent 12 }} + {{- end }} + {{- if .env }} + env: + {{- toYaml .env | nindent 12 }} + {{- end }} + {{- if .resources }} + resources: + {{- toYaml .resources | nindent 12 }} + {{- end }} + {{- if .volumeMounts }} + volumeMounts: + {{- toYaml .volumeMounts | nindent 12 }} + {{- end }} + {{- end }} + {{- end }} \ No newline at end of file diff --git a/charts/uniconfig/values.yaml b/charts/uniconfig/values.yaml index bbe3517f..e742f3b3 100644 --- a/charts/uniconfig/values.yaml +++ b/charts/uniconfig/values.yaml @@ -20,13 +20,11 @@ serviceAccount: # -- Pod annotations podAnnotations: {} # -- Configure [Pods Security Context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) -podSecurityContext: - {} +podSecurityContext: {} # fsGroup: 2000 # -- Configure [Container Security Context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) -securityContext: - {} +securityContext: {} # capabilities: # drop: # - ALL @@ -112,8 +110,7 @@ nodeSelector: {} tolerations: [] # -- [Container resources](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/) -resources: - {} +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 @@ -135,11 +132,9 @@ autoscaling: alwaysRollAfterUpgrade: false extraScriptConfigMap: -extraLogbackConfigMap: -# -- global configuration of mibs -mibsConfigs: - {} +# -- Global configuration of mibs +mibsConfigs: {} # mibs1: # repository: frinx/uniconfig # tag: latest @@ -150,9 +145,8 @@ mibsConfigs: # tag: "" # mibsPath: -# -- global configuration of cache -cacheConfigs: - {} +# -- Global configuration of cache +cacheConfigs: {} # cache1: # repository: frinx/uniconfig # tag: "latest" @@ -163,9 +157,67 @@ cacheConfigs: # tag: "" # cachePath: +utilitiesImage: + # -- Utilities image repository + repository: frinx/utilities-alpine + # -- Overrides the image tag. + tag: "1.2" + # -- Image pull policy + pullPolicy: IfNotPresent + # -- Extra init containers extraInitContainers: [] +# -- Extra containers +extraContainers: [] + # - name: extra-container-1 + # image: nginx:1.21 + # imagePullPolicy: IfNotPresent + # ports: + # - containerPort: 8080 + # protocol: TCP + # env: + # - name: ENV_VAR_NAME + # value: "env_var_value" + # resources: + # limits: + # cpu: "100m" + # memory: "128Mi" + # requests: + # cpu: "50m" + # memory: "64Mi" + # volumeMounts: + # - name: config-volume + # mountPath: /etc/config + # - name: extra-container-2 + # image: busybox + # imagePullPolicy: IfNotPresent + # command: ["sleep", "3600"] + # resources: + # limits: + # cpu: "50m" + # memory: "32Mi" + # volumeMounts: + # - name: data-volume + # mountPath: /var/data + +# -- Extra volumes used in extraContainers and extraInitContainers +extraVolumes: [] + # - name: config-volume + # configMap: + # name: my-config + # - name: data-volume + # emptyDir: {} + + +# -- Extra config map attached to uniconfig container +extraConfigmapMounts: [] + # - name: uniconfig-controller-logback + # configMapName: uniconfig-controller-logback + # mountPath: /opt/uniconfig/config/uniconfig-controller-logback.xml + # subPath: "" + # readOnly: false + # -- Uniconfig container command command: ["/bin/sh", "-c"] # -- Uniconfig container args @@ -233,6 +285,7 @@ dbPersistence: # -- Application properties extraEnv: # @ignored + LOGGING_CONFIG: config/logback-cluster.xml DBPERSISTENCE_CONNECTION_DBNAME: uniconfig # DBPERSISTENCE CONNECTION PARAMETERS, CREDENTIALS STORED IN SECRETS DBPERSISTENCE_EMBEDDEDDATABASE_ENABLED: false @@ -255,6 +308,12 @@ extraEnv: NOTIFICATIONS_KAFKA_KAFKASERVERS_0_BROKERLISTENINGPORT: 9092 SPRING_KAFKA_BOOTSTRAPSERVERS: http://kafka:9092 +# -- Monitoring configuration +monitoring: + enabled: false + port: http + path: /actuator/prometheus + # External services # -- Internal Postgres Database postgresql: @@ -283,17 +342,3 @@ kafka: listeners: client: protocol: PLAINTEXT - -utilitiesImage: - # -- utilities image repository - repository: frinx/utilities-alpine - # -- Overrides the image tag. - tag: "1.2" - # -- Image pull policy - pullPolicy: IfNotPresent - -# -- Monitoring configuration -monitoring: - enabled: false - port: http - path: /actuator/prometheus