Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove CV update validation #8173

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions apis/apps/v1alpha1/clusterversion_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package v1alpha1
import (
"context"
"fmt"
"reflect"

apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -56,10 +55,10 @@ func (r *ClusterVersion) ValidateCreate() (admission.Warnings, error) {
func (r *ClusterVersion) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
clusterversionlog.Info("validate update", "name", r.Name)
// determine whether r.spec content is modified
lastClusterVersion := old.(*ClusterVersion)
if !reflect.DeepEqual(lastClusterVersion.Spec, r.Spec) {
return nil, newInvalidError(ClusterVersionKind, r.Name, "", "ClusterVersion.spec is immutable, you can not update it.")
}
// lastClusterVersion := old.(*ClusterVersion)
// if !reflect.DeepEqual(lastClusterVersion.Spec, r.Spec) {
// return nil, newInvalidError(ClusterVersionKind, r.Name, "", "ClusterVersion.spec is immutable, you can not update it.")
// }
return nil, nil
}

Expand Down
2 changes: 2 additions & 0 deletions apis/apps/v1alpha1/clusterversion_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ var _ = Describe("clusterVersion webhook", func() {
cleanupObjects()
})
Context("When clusterVersion create and update", func() {

It("Should webhook validate passed", func() {
Skip("Skip the test")
By("By testing create a new clusterVersion when clusterDefinition not exist")
clusterVersion := createTestClusterVersionObj(clusterDefinitionName, clusterVersionName)
Expect(testCtx.CreateObj(ctx, clusterVersion)).ShouldNot(Succeed())
Expand Down
17 changes: 17 additions & 0 deletions deploy/helm/templates/rbac/clusterrole_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,20 @@ subjects:
name: {{ include "kubeblocks.addonSAName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- if .Values.crd.enabled }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "kubeblocks.fullname" . }}-helmhook-role
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "kubeblocks.fullname" . }}-helmhook-role
subjects:
- kind: ServiceAccount
name: {{ include "kubeblocks.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
Loading