-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add pre-upgrade job to delete jaeger HR (#1417)
* feat: Add pre-upgrade job to delete jaeger HR * refactor: Delete jaeger HR older than v2.46.2
- Loading branch information
Showing
5 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 | |
kind: Kustomization | ||
resources: | ||
- helmrelease.yaml | ||
- pre-upgrade.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 | ||
kind: Kustomization | ||
metadata: | ||
name: jaeger-pre-upgrade | ||
namespace: ${releaseNamespace} | ||
spec: | ||
force: false | ||
prune: true | ||
wait: true | ||
interval: 6h | ||
retryInterval: 1m | ||
path: ./services/jaeger/2.46.2/pre-upgrade | ||
sourceRef: | ||
kind: GitRepository | ||
name: management | ||
namespace: kommander-flux | ||
timeout: 1m | ||
# passing releaseNamespace to 2nd level configuration files for ability to configure namespace correctly in attached clusters | ||
# Using `substituteFrom` with `substitution-vars` creates 2nd level resources in `kommander` namespace instead of workspace ns | ||
postBuild: | ||
substitute: | ||
releaseNamespace: ${releaseNamespace} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# For upgrades from DKP <2.6 to 2.6.x. | ||
# **REMOVE THIS AFTER 2.6 IS RELEASED** | ||
# Delete the jaeger helmrelease prior to upgrading. | ||
# This must be done because upgrading does not apply the newly added priorityClassName field on the | ||
# Jaeger spec, perhaps because the CRD has not been upgraded yet. Recreating the HelmRelease applies the | ||
# Jaeger spec properly. This job will only delete helmreleases from 2.5, so rerunning this job | ||
# during upgrades within 2.6 will not result in the recreation of the helmrelease. | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: jaeger-pre-upgrade | ||
namespace: ${releaseNamespace} | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: jaeger-pre-upgrade | ||
namespace: ${releaseNamespace} | ||
rules: | ||
- apiGroups: ["helm.toolkit.fluxcd.io"] | ||
resources: ["helmreleases"] | ||
verbs: ["get", "watch", "list", "delete"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: jaeger-pre-upgrade | ||
namespace: ${releaseNamespace} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: jaeger-pre-upgrade | ||
subjects: | ||
- kind: ServiceAccount | ||
name: jaeger-pre-upgrade | ||
namespace: ${releaseNamespace} | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: delete-jaeger-helmrelease | ||
namespace: ${releaseNamespace} | ||
spec: | ||
ttlSecondsAfterFinished: 100 | ||
template: | ||
metadata: | ||
name: delete-jaeger-helmrelease | ||
spec: | ||
serviceAccountName: jaeger-pre-upgrade | ||
restartPolicy: OnFailure | ||
priorityClassName: dkp-high-priority | ||
containers: | ||
- name: kubectl | ||
image: bitnami/kubectl:1.26.4 | ||
command: | ||
- sh | ||
- "-c" | ||
- |- | ||
/bin/bash <<'EOF' | ||
set -o nounset | ||
set -o errexit | ||
set -o pipefail | ||
echo "checking jaeger helmrelease and deleting it pre-upgrade if older than v2.46.2" | ||
VERSION=$(set -o errexit; kubectl get helmrelease -n ${releaseNamespace} jaeger --ignore-not-found -o=jsonpath='{.spec.chart.spec.version}') | ||
echo "pre-upgrade jaeger version $VERSION" | ||
if [[ $VERSION < "2.46.2" ]]; then | ||
echo "deleting jaeger helmrelease" | ||
kubectl delete helmrelease jaeger -n ${releaseNamespace} --ignore-not-found | ||
exit 0 | ||
fi | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- delete-jaeger-hr.yaml |