@@ -17,7 +17,7 @@ import (
1717// NOTE: RBAC not needed here.
1818//+kubebuilder:rbac:groups="",resources=pods,verbs=get;list;watch;create;update;patch;delete
1919//+kubebuilder:rbac:groups="",resources=configmaps,verbs=get;list;watch;create;update;patch;delete
20- // +kubebuilder:webhook:path=/mutate-v1-pod,mutating=true,failurePolicy=Ignore,groups="",resources=pods,verbs=create;update,versions=v1,name=mpod.kb.io,admissionReviewVersions=v1,sideEffects=NoneOnDryRun
20+ // +kubebuilder:webhook:path=/mutate-v1-pod,mutating=true,failurePolicy=Ignore,groups="",resources=pods;deployments ,verbs=create;update,versions=v1,name=mpod.kb.io,admissionReviewVersions=v1,sideEffects=NoneOnDryRun
2121
2222// PodMutator annotates Pods
2323type PodMutator struct {
@@ -39,11 +39,11 @@ func (m *PodMutator) Handle(ctx context.Context, req admission.Request) admissio
3939 // Check enablement
4040 val , ok := pod .GetAnnotations ()["openfeature.dev" ]
4141 if ! ok {
42- return admission.Response {}
42+ return admission .Allowed ( "no annotation" )
4343 } else {
4444 if val != "enabled" {
4545 m .Log .V (2 ).Info ("openfeature.dev Annotation is not enabled" )
46- return admission.Response {}
46+ return admission .Allowed ( "openfeature is disabled" )
4747 }
4848 }
4949 var featureFlagCustomResource corev1alpha1.FeatureFlagConfiguration
@@ -81,7 +81,9 @@ func (m *PodMutator) Handle(ctx context.Context, req admission.Request) admissio
8181 "config.yaml" : featureFlagCustomResource .Spec .FeatureFlagSpec ,
8282 },
8383 }); err != nil {
84- fmt .Printf (fmt .Sprintf ("failed to create config map %s" , configName ))
84+
85+ m .Log .V (1 ).Info (fmt .Sprintf ("failed to create config map %s" , configName ))
86+
8587 return admission .Errored (http .StatusInternalServerError , err )
8688 }
8789
0 commit comments