Skip to content

Commit

Permalink
chore: fix install 1.0 bug when existing KB 0.9 (#8457)
Browse files Browse the repository at this point in the history
(cherry picked from commit 6c08d23)
  • Loading branch information
wangyelei committed Nov 15, 2024
1 parent a3037c5 commit 7fc92ee
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions deploy/helm/templates/conversion-patch-hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ spec:
old_kb_json=$(kubectl get deployment ${name} -n ${namespace} -o json)
version=$(echo ${old_kb_json} | jq '.metadata.labels["app.kubernetes.io/version"]' | tr -d '"')
replicas=$(echo ${old_kb_json} | jq '.spec.replicas')
statusReplicas=$(echo ${old_kb_json} | jq '.status.replicas')
if echo "$version" | grep -q '^0\.9'; then
echo "TODO: add it when released 0.9.2"
# patch_num=$(echo $version | awk -F. '{print $3}' | awk -F- '{print $1}')
Expand All @@ -59,6 +60,11 @@ spec:
echo "ERROR: You must stop the existing ${namespace}/${name} version (${version}) before installing version 1.0."
exit 1
fi
echo "status: $statusReplicas"
if [ "$statusReplicas" != "null" ] || [ $statusReplicas -ne 0 ]; then
echo "ERROR: You must stop the existing ${namespace}/${name} version (${version}) before installing version 1.0."
exit 1
fi
done
IFS=$OLD_IFS
# 2. patch crds
Expand Down
26 changes: 26 additions & 0 deletions deploy/helm/templates/rbac/shardingdefinition_editor_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# permissions for end users to edit shardingdefinitions.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "kubeblocks.fullname" . }}-shardingdefinition-editor-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
rules:
- apiGroups:
- apps.kubeblocks.io
resources:
- shardingdefinitions
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps.kubeblocks.io
resources:
- shardingdefinitions/status
verbs:
- get

0 comments on commit 7fc92ee

Please sign in to comment.