From 558b94425944a13c3353e01b579b32ff01715971 Mon Sep 17 00:00:00 2001 From: Azat Safin Date: Thu, 3 Oct 2024 21:19:24 +0300 Subject: [PATCH 1/2] Update Charts README.md file from values metadata (#28) Co-authored-by: azatsafin --- .github/workflows/readme-update.yaml | 51 ++++++++ .github/workflows/release-helm.yaml | 16 +-- charts/kafka-ui/Chart.yaml | 2 +- charts/kafka-ui/README.md | 89 ++++++++++++- charts/kafka-ui/values.yaml | 184 ++++++++++++++++++--------- 5 files changed, 272 insertions(+), 70 deletions(-) create mode 100644 .github/workflows/readme-update.yaml diff --git a/.github/workflows/readme-update.yaml b/.github/workflows/readme-update.yaml new file mode 100644 index 0000000..f3c2784 --- /dev/null +++ b/.github/workflows/readme-update.yaml @@ -0,0 +1,51 @@ +name: 'Update README from values.yaml metadata' + +on: + pull_request: + branches: + - main + paths: + - "charts/**" + +permissions: {} # Remove all permissions by default + +jobs: + update-readme-metadata: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Install readme-generator-for-helm + run: npm install -g @bitnami/readme-generator-for-helm + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Necessary for getting a complete history for diffs + + - name: Get modified charts + id: get-modified-charts + run: | + paths=$(git diff --name-only origin/main... --name-only | grep 'charts/.*/values.yaml' | cut -d/ -f1,2 | uniq | tr '\n' ' ') + echo "Modified charts: $paths" + echo "paths=${paths}" >> $GITHUB_ENV # Using ENV as this is now within the same job + + - name: Execute readme-generator-for-helm + if: env.paths != '' # Ensure there are paths to proceed + run: | + IFS=' ' read -ra ADDR <<< "$paths" + echo "Updating READMEs for modified charts: ${ADDR[@]}" + for chart in "${ADDR[@]}"; do + echo "Updating README.md for ${chart}" + readme-generator --values "${chart}/values.yaml" --readme "${chart}/README.md" + if [[ $? -ne 0 ]]; then + echo "Error: Failed to update README for ${chart}" + exit 1 + fi + # fix schema for nullable + # cat <<< $(jq '(..|objects|select(.nullable)).type |= ["string","null"]' "${chart}/values.schema.json") > "${chart}/values.schema.json" + done + + - name: Commit and Push Changes + if: env.paths != '' # Only commit if there are changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Update README.md for modified charts \ No newline at end of file diff --git a/.github/workflows/release-helm.yaml b/.github/workflows/release-helm.yaml index 9311a53..4b6d3ee 100644 --- a/.github/workflows/release-helm.yaml +++ b/.github/workflows/release-helm.yaml @@ -1,26 +1,22 @@ name: Release helm on: - push: + push: branches: - - main + - main paths: - "charts/**" jobs: - release-helm: - runs-on: - ubuntu-latest - steps: + release-helm: + runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 with: fetch-depth: 1 - - run: | git config user.name github-actions git config user.email github-actions@github.com - - uses: azure/setup-helm@v3 - - name: add chart #realse helm with new version run: | VERSION=$(cat charts/kafka-ui/Chart.yaml | grep version | awk '{print $2}') @@ -36,4 +32,4 @@ jobs: git push - uses: rickstaa/action-create-tag@v1 #create new tag with: - tag: "charts/kafka-ui-${{ env.HELM_VERSION }}" \ No newline at end of file + tag: "charts/kafka-ui-${{ env.HELM_VERSION }}" diff --git a/charts/kafka-ui/Chart.yaml b/charts/kafka-ui/Chart.yaml index 14e7d25..030a8c7 100644 --- a/charts/kafka-ui/Chart.yaml +++ b/charts/kafka-ui/Chart.yaml @@ -2,6 +2,6 @@ apiVersion: v2 name: kafka-ui description: A Helm chart for kafka-UI type: application -version: 1.4.5 +version: 1.4.6 appVersion: v1.0.0 icon: https://raw.githubusercontent.com/kafbat/kafka-ui/main/documentation/images/logo_new.png diff --git a/charts/kafka-ui/README.md b/charts/kafka-ui/README.md index 93966e9..e96d502 100644 --- a/charts/kafka-ui/README.md +++ b/charts/kafka-ui/README.md @@ -1 +1,88 @@ -Please refer to our [documentation](https://ui.docs.kafbat.io/configuration/helm-charts) to get some info on our helm charts. \ No newline at end of file +## Parameters + +### Common + +| Name | Description | Value | +| ------------------ | ------------------------------------------ | ----- | +| `replicaCount` | Number of Kafka-UI replicas to deploy | `1` | +| `image.registry` | image registry | `""` | +| `image.repository` | image repository | `""` | +| `image.pullPolicy` | image pull policy | `""` | +| `image.tag` | image tag (immutable tags are recommended) | `""` | +| `imagePullSecrets` | Docker registry secret names as an array | `[]` | +| `nameOverride` | String to partially override chart name | `""` | +| `fullnameOverride` | String to fully override app name | `""` | + +### ServiceAccount configuration + +| Name | Description | Value | +| ---------------------------- | ---------------------------------------------------- | ------ | +| `serviceAccount.name` | The name of the ServiceAccount to use. | `""` | +| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `true` | +| `serviceAccount.annotations` | Additional Service Account annotations | `{}` | + +### Application configuration + +| Name | Description | Value | +| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | +| `existingConfigMap` | Name of the existing ConfigMap with kafbat-ui environment variables | `""` | +| `yamlApplicationConfig` | Kafbat-UI config in Yaml format | `{}` | +| `yamlApplicationConfigConfigMap` | Map with name and keyName keys, name refers to the existing ConfigMap, keyName refers to the ConfigMap key with Kafbat-UI config in Yaml format | `{}` | +| `yamlApplicationConfigSecret` | Secret with name and keyName keys, name refers to the existing ConfigMap, keyName refers to the ConfigMap key with Kafbat-UI config in Yaml format | `{}` | +| `existingSecret` | Name of the existing Secret with Kafbat-UI environment variables | `""` | +| `envs.secret` | Set of the sensitive environment variables to pass to Kafbat-UI | `{}` | +| `envs.config` | Set of the environment variables to pass to Kafbat-UI | `{}` | +| `envs.secretMappings` | The mapping of existing secret to env variable. | `{}` | +| `envs.configMappings` | The mapping of configmap and keyName to get env variable. | `{}` | +| `env` | Envs to be added to the Kafka-UI container | `{}` | +| `resources` | Set Kafka-UI container requests and limits for different resources like CPU or memory (essential for production workloads) | `{}` | +| `initContainers` | Add additional init containers to the Kafka-UI pods | `{}` | +| `volumeMounts` | Optionally specify additional volumeMounts for the kafka-UI container | `{}` | +| `volumes` | Optionally specify additional volumes for the Kafka-UI pods | `{}` | +| `hostAliases` | Kafka-UI pods host aliases | `{}` | +| `extraContainers` | Specify additional containers in extraContainers. | `""` | + +### Network Policies + +| Name | Description | Value | +| ----------------------- | --------------------------------------------------------- | ------- | +| `networkPolicy.enabled` | Specifies whether a NetworkPolicy should be created | `false` | +| `podAnnotations` | Annotations for Kafka-UI pods | `{}` | +| `podLabels` | Extra labels for Kafka-UI pods | `{}` | +| `annotations` | Annotations to be added to kafka-ui Deployment | `{}` | +| `probes.useHttpsScheme` | Set field schema as HTTPS for readines and liveness probe | `false` | + +### Security Context + +| Name | Description | Value | +| -------------------- | ----------------------------------------------------------------------------------- | ----- | +| `podSecurityContext` | The security settings that you specify for a Pod apply to all Containers in the Pod | `{}` | +| `securityContext` | The security settings that you specify for a Kafka-UI container | `{}` | + +### Traffic Exposure Parameters + +| Name | Description | Value | +| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| `service.type` | Kafka-UI service type | `ClusterIP` | +| `service.port` | Kafka-UI pod port number | `80` | +| `ingress.enabled` | Enable ingress record generation for Kafka-UI | `""` | +| `ingress.annotations` | Additional annotations for the Ingress resource. To enable certificate autogeneration, place here your cert-manager annotations. | `{}` | +| `ingress.labels` | Labels for the Ingress | `{}` | +| `ingress.ingressClassName` | IngressClass that will be be used to implement the Ingress (Kubernetes 1.18+) | `""` | +| `ingress.path` | Default path for the ingress record | `/` | +| `ingress.pathType` | Ingress path type | `Prefix` | +| `ingress.host` | Default hostname for the ingress record | `""` | +| `ingress.tls.enabled` | Enable TLS configuration for the host defined at `ingress.host` parameter | `false` | +| `ingress.tls.secretName` | The name of a pre-created Secret containing a TLS private key and certificate | `""` | +| `ingress.precedingPaths` | HTTP paths to add to the Ingress before the default path | `[]` | +| `ingress.succeedingPaths` | Http paths to add to the Ingress after the default path | `[]` | +| `resources` | Set Kafka-UI pod requests and limits for different resources like CPU or memory (essential for production workloads) | `{}` | + +### Scheduling + +| Name | Description | Value | +| ---------------------- | ----------------------------------------------------------------------- | ----- | +| `nodeSelector` | Node labels for Kafka-UI pods assignment | `{}` | +| `tolerations` | Tolerations for Kafka-UI pods assignment | `[]` | +| `affinity` | Affinity for Kafka-UI pods assignment | `{}` | +| `revisionHistoryLimit` | Specify how many old ReplicaSets for this Deployment you want to retain | `nil` | diff --git a/charts/kafka-ui/values.yaml b/charts/kafka-ui/values.yaml index 95e2864..f176e2f 100644 --- a/charts/kafka-ui/values.yaml +++ b/charts/kafka-ui/values.yaml @@ -1,5 +1,11 @@ +## @section Common +## @param replicaCount Number of Kafka-UI replicas to deploy replicaCount: 1 +## @param image.registry [string] image registry +## @param image.repository [string] image repository +## @param image.pullPolicy [string] image pull policy +## @param image.tag [string] image tag (immutable tags are recommended) image: registry: ghcr.io repository: kafbat/kafka-ui @@ -7,20 +13,28 @@ image: # Overrides the image tag whose default is the chart appVersion. tag: "" +## @param imagePullSecrets Docker registry secret names as an array imagePullSecrets: [] +## @param nameOverride String to partially override chart name nameOverride: "" +## @param fullnameOverride String to fully override app name fullnameOverride: "" +## @section ServiceAccount configuration serviceAccount: - # Specifies whether a service account should be created + ## @param serviceAccount.name The name of the ServiceAccount to use. + name: "" + ## @param serviceAccount.create Specifies whether a ServiceAccount should be created create: true - # Annotations to add to the service account + ## @param serviceAccount.annotations Additional Service Account annotations 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: "" +## @section Application configuration +## @param existingConfigMap [string] Name of the existing ConfigMap with kafbat-ui environment variables existingConfigMap: "" +## @param yamlApplicationConfig Kafbat-UI config in Yaml format yamlApplicationConfig: {} # kafka: @@ -36,30 +50,86 @@ yamlApplicationConfig: # health: # ldap: # enabled: false +## @param yamlApplicationConfigConfigMap Map with name and keyName keys, name refers to the existing ConfigMap, keyName refers to the ConfigMap key with Kafbat-UI config in Yaml format yamlApplicationConfigConfigMap: {} # keyName: config.yml # name: configMapName +## @param yamlApplicationConfigSecret Secret with name and keyName keys, name refers to the existing ConfigMap, keyName refers to the ConfigMap key with Kafbat-UI config in Yaml format yamlApplicationConfigSecret: {} # keyName: config.yml # name: secretName - +## @param existingSecret Name of the existing Secret with Kafbat-UI environment variables existingSecret: "" +### @section Environment variables from envs: + ## @param envs.secret Set of the sensitive environment variables to pass to Kafbat-UI secret: {} + ## @param envs.config Set of the environment variables to pass to Kafbat-UI config: {} + ## @param envs.secretMappings The mapping of existing secret to env variable. secretMappings: {} #ENV_NAME: # name: kubernetes-secret-name # keyName: kubernetes-secret-key + ## @param envs.configMappings The mapping of configmap and keyName to get env variable. configMappings: {} #ENV_NAME: # name: kubernetes-configmap-name # keyName: kubernetes-configmap-key +## @param env [object] Envs to be added to the Kafka-UI container +env: {} +## @param resources Set Kafka-UI container requests and limits for different resources like CPU or memory (essential for production workloads) +resources: + {} + # limits: + # cpu: 200m + # memory: 512Mi + # requests: + # cpu: 200m + # memory: 256Mi + +## @param initContainers Add additional init containers to the Kafka-UI pods +## ref: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ +## e.g: +initContainers: {} + +## @param volumeMounts [object] Optionally specify additional volumeMounts for the kafka-UI container +volumeMounts: {} +## @param volumes [object] Optionally specify additional volumes for the Kafka-UI pods +volumes: {} +## @param hostAliases [object] Kafka-UI pods host aliases +## https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/ +## +hostAliases: {} + +## @param extraContainers Specify additional containers in extraContainers. +## For example, to add an authentication proxy to a kafka-ui pod. +extraContainers: | +# - name: proxy +# image: quay.io/gambol99/keycloak-proxy:latest +# args: +# - -provider=github +# - -client-id= +# - -client-secret= +# - -github-org= +# - -email-domain=* +# - -cookie-secret= +# - -http-address=http://0.0.0.0:4181 +# - -upstream-url=http://127.0.0.1:3000 +# ports: +# - name: proxy-web +# containerPort: 4181 + +## @section Network Policies +## Ref: https://kubernetes.io/docs/concepts/services-networking/network-policies/ +## networkPolicy: + ## @param networkPolicy.enabled Specifies whether a NetworkPolicy should be created enabled: false + ## @skip networkPolicy.egressRules egressRules: ## Additional custom egress rules ## e.g: @@ -69,6 +139,7 @@ networkPolicy: ## matchLabels: ## label: example customRules: [] + ## @skip networkPolicy.ingressRules ingressRules: ## Additional custom ingress rules ## e.g: @@ -79,22 +150,26 @@ networkPolicy: ## label: example customRules: [] +## @param podAnnotations Annotations for Kafka-UI pods podAnnotations: {} +## @param podLabels Extra labels for Kafka-UI pods podLabels: {} -## Annotations to be added to kafka-ui Deployment -## +## @param annotations [object] Annotations to be added to kafka-ui Deployment annotations: {} -## Set field schema as HTTPS for readines and liveness probe +## @param probes.useHttpsScheme Set field schema as HTTPS for readines and liveness probe ## probes: useHttpsScheme: false +## @section Security Context +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## @param podSecurityContext [object] The security settings that you specify for a Pod apply to all Containers in the Pod podSecurityContext: {} # fsGroup: 2000 - +## @param securityContext [object] The security settings that you specify for a Kafka-UI container securityContext: {} # capabilities: @@ -104,97 +179,90 @@ securityContext: # runAsNonRoot: true # runAsUser: 1000 +## @section Traffic Exposure Parameters +## Kafka-UI service parameters +## service: + ## @param service.type Kafka-UI service type type: ClusterIP + ## @param service.port Kafka-UI pod port number port: 80 # In case of service type LoadBalancer, you can specify reserved static IP # loadBalancerIP: 10.11.12.13 # if you want to force a specific nodePort. Must be use with service.type=NodePort # nodePort: -# Ingress configuration +## Kafka-UI Ingress configuration +## ref: http://kubernetes.io/docs/concepts/services-networking/ingress/ +## ingress: - # Enable ingress resource + ## @param ingress.enabled [string] Enable ingress record generation for Kafka-UI enabled: false - - # Annotations for the Ingress + ## @param ingress.annotations [object] Additional annotations for the Ingress resource. To enable certificate autogeneration, place here your cert-manager annotations. annotations: {} - # Labels for the Ingress + ## @param ingress.labels [object] Labels for the Ingress labels: {} - # ingressClassName for the Ingress + ## @param ingress.ingressClassName IngressClass that will be be used to implement the Ingress (Kubernetes 1.18+) + ## This is supported in Kubernetes 1.18+ and required if you have more than one IngressClass marked as the default for your cluster . + ## ref: https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/ + ## ingressClassName: "" - # The path for the Ingress + ## @param ingress.path Default path for the ingress record + ## NOTE: You may need to set this to '/*' in order to use this with ALB ingress controllers + ## path: "/" - # The path type for the Ingress - pathType: "Prefix" - # The hostname for the Ingress + ## @param ingress.pathType Ingress path type + pathType: "Prefix" + + ## @param ingress.host Default hostname for the ingress record host: "" # configs for Ingress TLS tls: # Enable TLS termination for the Ingress + ## @param ingress.tls.enabled Enable TLS configuration for the host defined at `ingress.host` parameter enabled: false - # the name of a pre-created Secret containing a TLS private key and certificate + ## @param ingress.tls.secretName [string] The name of a pre-created Secret containing a TLS private key and certificate secretName: "" - # HTTP paths to add to the Ingress before the default path + ## @param ingress.precedingPaths [array] HTTP paths to add to the Ingress before the default path precedingPaths: [] - # Http paths to add to the Ingress after the default path + ## @param ingress.succeedingPaths [array] Http paths to add to the Ingress after the default path succeedingPaths: [] +## @param resources [object] Set Kafka-UI pod requests and limits for different resources like CPU or memory (essential for production workloads) -resources: - {} - # limits: - # cpu: 200m - # memory: 512Mi - # requests: - # cpu: 200m - # memory: 256Mi +## @section Scheduling +## Autoscaling configuration +## ref: https://kubernetes.io/docs/concepts/workloads/autoscaling/ +## @skip autoscaling autoscaling: enabled: false minReplicas: 1 maxReplicas: 100 - targetCPUUtilizationPercentage: 80 + # targetCPUUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80 +## @param nodeSelector Node labels for Kafka-UI pods assignment +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/ +## nodeSelector: {} +## @param tolerations Tolerations for Kafka-UI pods assignment +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## tolerations: [] - +## @param affinity Affinity for Kafka-UI pods assignment +## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## NOTE: `podAffinityPreset`, `podAntiAffinityPreset`, and `nodeAffinityPreset` will be ignored when it's set +## affinity: {} -env: {} - -initContainers: {} - -volumeMounts: {} - -volumes: {} - -hostAliases: {} - -## Specify additional containers in extraContainers. -## For example, to add an authentication proxy to a kafka-ui pod. -extraContainers: | -# - name: proxy -# image: quay.io/gambol99/keycloak-proxy:latest -# args: -# - -provider=github -# - -client-id= -# - -client-secret= -# - -github-org= -# - -email-domain=* -# - -cookie-secret= -# - -http-address=http://0.0.0.0:4181 -# - -upstream-url=http://127.0.0.1:3000 -# ports: -# - name: proxy-web -# containerPort: 4181 +## @param revisionHistoryLimit [nullable] Specify how many old ReplicaSets for this Deployment you want to retain revisionHistoryLimit: null From 212a3c1e635fceb3af4b6ffbb94b3141846b2dab Mon Sep 17 00:00:00 2001 From: Dadang NH Date: Wed, 9 Oct 2024 20:10:23 +0800 Subject: [PATCH 2/2] feat: add support for deployment labels (#27) Co-authored-by: Azat Safin --- charts/kafka-ui/Chart.yaml | 2 +- charts/kafka-ui/README.md | 1 + charts/kafka-ui/templates/deployment.yaml | 3 +++ charts/kafka-ui/values.yaml | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/charts/kafka-ui/Chart.yaml b/charts/kafka-ui/Chart.yaml index 030a8c7..75f02a6 100644 --- a/charts/kafka-ui/Chart.yaml +++ b/charts/kafka-ui/Chart.yaml @@ -2,6 +2,6 @@ apiVersion: v2 name: kafka-ui description: A Helm chart for kafka-UI type: application -version: 1.4.6 +version: 1.4.7 appVersion: v1.0.0 icon: https://raw.githubusercontent.com/kafbat/kafka-ui/main/documentation/images/logo_new.png diff --git a/charts/kafka-ui/README.md b/charts/kafka-ui/README.md index e96d502..29b2319 100644 --- a/charts/kafka-ui/README.md +++ b/charts/kafka-ui/README.md @@ -50,6 +50,7 @@ | `podAnnotations` | Annotations for Kafka-UI pods | `{}` | | `podLabels` | Extra labels for Kafka-UI pods | `{}` | | `annotations` | Annotations to be added to kafka-ui Deployment | `{}` | +| `labels` | Labels to be added to kafka-ui Deployment | `{}` | | `probes.useHttpsScheme` | Set field schema as HTTPS for readines and liveness probe | `false` | ### Security Context diff --git a/charts/kafka-ui/templates/deployment.yaml b/charts/kafka-ui/templates/deployment.yaml index b44831a..d10460b 100644 --- a/charts/kafka-ui/templates/deployment.yaml +++ b/charts/kafka-ui/templates/deployment.yaml @@ -5,6 +5,9 @@ metadata: namespace: {{ .Release.Namespace }} labels: {{- include "kafka-ui.labels" . | nindent 4 }} + {{- if .Values.labels }} + {{- toYaml .Values.labels | nindent 4 }} + {{- end }} {{- with .Values.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/kafka-ui/values.yaml b/charts/kafka-ui/values.yaml index f176e2f..47ba40a 100644 --- a/charts/kafka-ui/values.yaml +++ b/charts/kafka-ui/values.yaml @@ -158,6 +158,9 @@ podLabels: {} ## @param annotations [object] Annotations to be added to kafka-ui Deployment annotations: {} +## @param labels [object] Labels to be added to kafka-ui Deployment +labels: {} + ## @param probes.useHttpsScheme Set field schema as HTTPS for readines and liveness probe ## probes: