Skip to content

Commit

Permalink
support bluegreen release: webhook update
Browse files Browse the repository at this point in the history
Signed-off-by: yunbo <[email protected]>
  • Loading branch information
Funinu committed Nov 19, 2024
1 parent 692c7e4 commit ab52d6c
Show file tree
Hide file tree
Showing 10 changed files with 496 additions and 148 deletions.
8 changes: 8 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ rules:
- patch
- update
- watch
- apiGroups:
- apps
resources:
- controllerrevisions
verbs:
- get
- list
- watch
- apiGroups:
- apps
resources:
Expand Down
102 changes: 0 additions & 102 deletions config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,108 +5,6 @@ metadata:
creationTimestamp: null
name: mutating-webhook-configuration
webhooks:
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-apps-kruise-io-v1alpha1-cloneset
failurePolicy: Fail
name: mcloneset.kb.io
rules:
- apiGroups:
- apps.kruise.io
apiVersions:
- v1alpha1
operations:
- UPDATE
resources:
- clonesets
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-apps-kruise-io-v1alpha1-daemonset
failurePolicy: Fail
name: mdaemonset.kb.io
rules:
- apiGroups:
- apps.kruise.io
apiVersions:
- v1alpha1
operations:
- UPDATE
resources:
- daemonsets
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-apps-v1-deployment
failurePolicy: Fail
name: mdeployment.kb.io
rules:
- apiGroups:
- apps
apiVersions:
- v1
operations:
- UPDATE
resources:
- deployments
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-apps-v1-statefulset
failurePolicy: Fail
name: mstatefulset.kb.io
rules:
- apiGroups:
- apps
apiVersions:
- v1
operations:
- UPDATE
resources:
- statefulsets
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-apps-kruise-io-statefulset
failurePolicy: Fail
name: madvancedstatefulset.kb.io
rules:
- apiGroups:
- apps.kruise.io
apiVersions:
- v1alpha1
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- statefulsets
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
Expand Down
54 changes: 29 additions & 25 deletions config/webhook/patch_manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,6 @@ metadata:
name: mutating-webhook-configuration
webhooks:
- name: munifiedworload.kb.io
objectSelector:
matchExpressions:
- key: rollouts.kruise.io/workload-type
operator: Exists
- name: mcloneset.kb.io
objectSelector:
matchExpressions:
- key: rollouts.kruise.io/workload-type
operator: Exists
- name: mdaemonset.kb.io
objectSelector:
matchExpressions:
- key: rollouts.kruise.io/workload-type
operator: Exists
- name: mstatefulset.kb.io
objectSelector:
matchExpressions:
- key: rollouts.kruise.io/workload-type
operator: Exists
- name: madvancedstatefulset.kb.io
objectSelector:
matchExpressions:
- key: rollouts.kruise.io/workload-type
operator: Exists
- name: mdeployment.kb.io
objectSelector:
matchExpressions:
- key: control-plane
Expand All @@ -37,3 +12,32 @@ webhooks:
- controller-manager
- key: rollouts.kruise.io/workload-type
operator: Exists
# - name: mcloneset.kb.io
# objectSelector:
# matchExpressions:
# - key: rollouts.kruise.io/workload-type
# operator: Exists
# - name: mdaemonset.kb.io
# objectSelector:
# matchExpressions:
# - key: rollouts.kruise.io/workload-type
# operator: Exists
# - name: mstatefulset.kb.io
# objectSelector:
# matchExpressions:
# - key: rollouts.kruise.io/workload-type
# operator: Exists
# - name: madvancedstatefulset.kb.io
# objectSelector:
# matchExpressions:
# - key: rollouts.kruise.io/workload-type
# operator: Exists
# - name: mdeployment.kb.io
# objectSelector:
# matchExpressions:
# - key: control-plane
# operator: NotIn
# values:
# - controller-manager
# - key: rollouts.kruise.io/workload-type
# operator: Exists
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ var (

func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(kruisev1aplphal1.AddToScheme(clientgoscheme.Scheme))
utilruntime.Must(kruisev1aplphal1.AddToScheme(scheme))
utilruntime.Must(kruisev1beta1.AddToScheme(scheme))
utilruntime.Must(rolloutapi.AddToScheme(scheme))
Expand Down
1 change: 1 addition & 0 deletions pkg/webhook/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func SetupWithManager(mgr manager.Manager) error {
// +kubebuilder:rbac:groups=admissionregistration.k8s.io,resources=mutatingwebhookconfigurations,verbs=get;list;watch;update;patch
// +kubebuilder:rbac:groups=admissionregistration.k8s.io,resources=validatingwebhookconfigurations,verbs=get;list;watch;update;patch
// +kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch;update;patch
// +kubebuilder:rbac:groups=apps,resources=controllerrevisions,verbs=get;list;watch

func initialize(ctx context.Context, cfg *rest.Config) error {
c, err := webhookcontroller.New(cfg, HandlerMap)
Expand Down
Loading

0 comments on commit ab52d6c

Please sign in to comment.