From df35fedd2d7aba11699e33d7bfb0ab6558f093f0 Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Fri, 22 Dec 2023 09:58:15 -0500 Subject: [PATCH 1/2] making kubectl scale down preupgrade container configurable Signed-off-by: Hung Nguyen --- stable/feeds/Chart.yaml | 2 +- stable/feeds/templates/hooks/pre-upgrade/upgrade_job.yaml | 2 +- stable/feeds/values.yaml | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/stable/feeds/Chart.yaml b/stable/feeds/Chart.yaml index 5be6b259..82918dfd 100644 --- a/stable/feeds/Chart.yaml +++ b/stable/feeds/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: feeds type: application -version: "2.1.0" +version: "2.1.1" appVersion: "5.1.0" kubeVersion: 1.23.x - 1.27.x || 1.23.x-x - 1.28.x-x description: Anchore feeds service diff --git a/stable/feeds/templates/hooks/pre-upgrade/upgrade_job.yaml b/stable/feeds/templates/hooks/pre-upgrade/upgrade_job.yaml index 45f6c6fa..df6f0d7b 100644 --- a/stable/feeds/templates/hooks/pre-upgrade/upgrade_job.yaml +++ b/stable/feeds/templates/hooks/pre-upgrade/upgrade_job.yaml @@ -64,7 +64,7 @@ spec: {{- end }} initContainers: - name: scale-down-anchore - image: bitnami/kubectl:1.27 + image: {{ .Values.feedsUpgradeJob.kubectlImage }} command: ["/bin/bash", "-c"] args: - | diff --git a/stable/feeds/values.yaml b/stable/feeds/values.yaml index a1ce5a0b..81ec7264 100644 --- a/stable/feeds/values.yaml +++ b/stable/feeds/values.yaml @@ -485,6 +485,12 @@ feedsUpgradeJob: ## usePostUpgradeHook: false + + ## @param feedsUpgradeJob.kubectlImage the image to use for the upgrade job's init container that uses kubectl to scale down deployments before an upgrade + ## This is only used in the preupgrade job. + ## + kubectlImage: bitnami/kubectl:1.27 + ## @param feedsUpgradeJob.nodeSelector Node labels for the Anchore Feeds upgrade job pod assignment ## nodeSelector: {} From 51bf07c2e05bc50a5093114c7198e8263bb3b5d3 Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Fri, 22 Dec 2023 10:05:33 -0500 Subject: [PATCH 2/2] update README.md with new param Signed-off-by: Hung Nguyen --- stable/feeds/README.md | 29 +++++++++++++++-------------- stable/feeds/values.yaml | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/stable/feeds/README.md b/stable/feeds/README.md index 7b3b1c05..aa42cb00 100644 --- a/stable/feeds/README.md +++ b/stable/feeds/README.md @@ -434,20 +434,21 @@ anchoreConfig: ### Anchore Feeds Upgrade Job Parameters -| Name | Description | Value | -| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| `feedsUpgradeJob.enabled` | Enable the Anchore Feeds database upgrade job | `true` | -| `feedsUpgradeJob.force` | Force the Anchore Feeds database upgrade job to run as a regular job instead of as a Helm hook | `false` | -| `feedsUpgradeJob.rbacCreate` | Create RBAC resources for the upgrade job | `true` | -| `feedsUpgradeJob.serviceAccountName` | Use an existing service account for the upgrade job | `""` | -| `feedsUpgradeJob.usePostUpgradeHook` | Use a Helm post-upgrade hook to run the upgrade job instead of the default pre-upgrade hook. This job does not require creating RBAC resources. | `false` | -| `feedsUpgradeJob.nodeSelector` | Node labels for the Anchore Feeds upgrade job pod assignment | `{}` | -| `feedsUpgradeJob.tolerations` | Tolerations for the Anchore Feeds upgrade job pod assignment | `[]` | -| `feedsUpgradeJob.affinity` | Affinity for the Anchore Feeds upgrade job pod assignment | `{}` | -| `feedsUpgradeJob.annotations` | Annotations for the Anchore Feeds upgrade job | `{}` | -| `feedsUpgradeJob.labels` | Labels for the Anchore Feeds upgrade job | `{}` | -| `feedsUpgradeJob.resources` | Resources for the Anchore Feeds upgrade job | `{}` | -| `feedsUpgradeJob.ttlSecondsAfterFinished` | The time period in seconds the upgrade job, and it's related pods should be retained for | `-1` | +| Name | Description | Value | +| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | +| `feedsUpgradeJob.enabled` | Enable the Anchore Feeds database upgrade job | `true` | +| `feedsUpgradeJob.force` | Force the Anchore Feeds database upgrade job to run as a regular job instead of as a Helm hook | `false` | +| `feedsUpgradeJob.rbacCreate` | Create RBAC resources for the upgrade job | `true` | +| `feedsUpgradeJob.serviceAccountName` | Use an existing service account for the upgrade job | `""` | +| `feedsUpgradeJob.usePostUpgradeHook` | Use a Helm post-upgrade hook to run the upgrade job instead of the default pre-upgrade hook. This job does not require creating RBAC resources. | `false` | +| `feedsUpgradeJob.kubectlImage` | The image to use for the upgrade job's init container that uses kubectl to scale down deployments before an upgrade | `bitnami/kubectl:1.27` | +| `feedsUpgradeJob.nodeSelector` | Node labels for the Anchore Feeds upgrade job pod assignment | `{}` | +| `feedsUpgradeJob.tolerations` | Tolerations for the Anchore Feeds upgrade job pod assignment | `[]` | +| `feedsUpgradeJob.affinity` | Affinity for the Anchore Feeds upgrade job pod assignment | `{}` | +| `feedsUpgradeJob.annotations` | Annotations for the Anchore Feeds upgrade job | `{}` | +| `feedsUpgradeJob.labels` | Labels for the Anchore Feeds upgrade job | `{}` | +| `feedsUpgradeJob.resources` | Resources for the Anchore Feeds upgrade job | `{}` | +| `feedsUpgradeJob.ttlSecondsAfterFinished` | The time period in seconds the upgrade job, and it's related pods should be retained for | `-1` | ### Ingress Parameters diff --git a/stable/feeds/values.yaml b/stable/feeds/values.yaml index 81ec7264..4f221ec2 100644 --- a/stable/feeds/values.yaml +++ b/stable/feeds/values.yaml @@ -486,7 +486,7 @@ feedsUpgradeJob: usePostUpgradeHook: false - ## @param feedsUpgradeJob.kubectlImage the image to use for the upgrade job's init container that uses kubectl to scale down deployments before an upgrade + ## @param feedsUpgradeJob.kubectlImage The image to use for the upgrade job's init container that uses kubectl to scale down deployments before an upgrade ## This is only used in the preupgrade job. ## kubectlImage: bitnami/kubectl:1.27