Skip to content

Commit

Permalink
Merge branch 'main' into EVEREST-1180
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankshah1607 authored Dec 13, 2024
2 parents fe8f81e + ac14cc7 commit a632960
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 10 deletions.
6 changes: 3 additions & 3 deletions charts/everest/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies:
- name: common
repository: file://charts/common
version: 0.0.9
version: 0.0.11
- name: everest-db-namespace
repository: file://charts/everest-db-namespace
version: 0.0.0
Expand All @@ -11,5 +11,5 @@ dependencies:
- name: victoria-metrics-operator
repository: https://victoriametrics.github.io/helm-charts
version: 0.37.0
digest: sha256:8a1adcd2e53bc836e6a7a238a85abb4e751de72dc83eef33829c8a1bc548c7af
generated: "2024-12-09T21:17:34.358806+05:30"
digest: sha256:54860d2efc9709c4b9808b3f3929e5dc1e744681c9c81c40f698d2d06cf184ff
generated: "2024-12-12T20:56:54.266112+05:30"
2 changes: 1 addition & 1 deletion charts/everest/charts/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: common
description: A library chart for Everest containing common resources.
type: library
version: 0.0.9
version: 0.0.11
appVersion: "0.0.3"
maintainers:
- name: mayankshah1607
Expand Down
2 changes: 1 addition & 1 deletion charts/everest/charts/common/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# common

![Version: 0.0.9](https://img.shields.io/badge/Version-0.0.9-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: 0.0.3](https://img.shields.io/badge/AppVersion-0.0.3-informational?style=flat-square)
![Version: 0.0.11](https://img.shields.io/badge/Version-0.0.11-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: 0.0.3](https://img.shields.io/badge/AppVersion-0.0.3-informational?style=flat-square)

A library chart for Everest containing common resources.

Expand Down
98 changes: 96 additions & 2 deletions charts/everest/charts/common/templates/_upgrade_checks.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,87 @@
#
{{- define "everest.preUpgradeChecks" }}
{{- $hookName := printf "everest-helm-pre-upgrade-hook" }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ $hookName }}
namespace: {{ .namespace }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ $hookName }}
namespace: {{ .namespace }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
rules:
- apiGroups:
- apps
resources:
- deployments
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ $hookName }}
namespace: {{ .namespace }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ $hookName }}
subjects:
- kind: ServiceAccount
name: {{ $hookName }}
namespace: {{ .namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ $hookName }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
rules:
- apiGroups:
- ""
resources:
- namespaces
verbs:
- list
- apiGroups:
- operators.coreos.com
resources:
- subscriptions
- clusterserviceversions
verbs:
- get
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ $hookName }}
annotations:
"helm.sh/hook": pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ $hookName }}
subjects:
- kind: ServiceAccount
name: {{ $hookName }}
namespace: {{ .namespace }}
---
apiVersion: batch/v1
kind: Job
metadata:
Expand All @@ -21,18 +102,31 @@ spec:
name: {{ $hookName }}
command:
- /bin/sh
- -c
- -ec
- |
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)

# Map ARCH to match available builds
if [ "$ARCH" = "x86_64" ]; then
ARCH="amd64"
elif [ "$ARCH" = "aarch64" ]; then
ARCH="arm64"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi

VERSION={{ .version }}
apk add --no-cache --quiet curl
curl -sSL -o everestctl https://github.com/percona/everest/releases/download/v${VERSION}/everestctl-${OS}-${ARCH}
chmod -R 777 ./everestctl

echo "Checking requirements for upgrade to version ${VERSION}"
./everestctl upgrade --dry-run --version-metadata-url={{ .versionMetadataURL }}
./everestctl upgrade --in-cluster --dry-run --version-metadata-url={{ .versionMetadataURL }} --kubeconfig=""
dnsPolicy: ClusterFirst
restartPolicy: OnFailure
terminationGracePeriodSeconds: 30
serviceAccount: {{ $hookName }}
serviceAccountName: {{ $hookName }}
{{- end }}
6 changes: 3 additions & 3 deletions charts/everest/charts/everest-db-namespace/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: common
repository: file://../common
version: 0.0.9
digest: sha256:9556a266d6497f3284b4df070b840145be1bff3c5ee235f81bf4a7973780e0d0
generated: "2024-12-09T21:17:37.704211+05:30"
version: 0.0.11
digest: sha256:76207a0fd5b735778bb6df03fb4859334fff0381b71fc719cdaa89d1608049bb
generated: "2024-12-12T20:56:58.278472+05:30"

0 comments on commit a632960

Please sign in to comment.