Skip to content

Commit 9812d30

Browse files
zhixian82zhouyan
authored andcommitted
fix: remove unneccessary ns validation
1 parent db72ce1 commit 9812d30

File tree

4 files changed

+0
-48
lines changed

4 files changed

+0
-48
lines changed

manifests/v1beta1/components/webhook/webhooks.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ webhooks:
6363
name: katib-controller
6464
namespace: kubeflow
6565
path: /mutate-pod
66-
namespaceSelector:
67-
matchLabels:
68-
katib.kubeflow.org/metrics-collector-injection: enabled
6966
rules:
7067
- apiGroups:
7168
- ""

operators/katib-controller/src/webhooks.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ webhooks:
6363
name: katib-controller
6464
namespace: kubeflow
6565
path: /mutate-pod
66-
namespaceSelector:
67-
matchLabels:
68-
katib.kubeflow.org/metrics-collector-injection: enabled
6966
rules:
7067
- apiGroups:
7168
- ""

pkg/webhook/v1beta1/common/const.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

pkg/webhook/v1beta1/experiment/validation_webhook.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
suggestionsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1beta1"
3636
"github.com/kubeflow/katib/pkg/controller.v1beta1/experiment/manifest"
3737
"github.com/kubeflow/katib/pkg/controller.v1beta1/util"
38-
"github.com/kubeflow/katib/pkg/webhook/v1beta1/common"
3938
"github.com/kubeflow/katib/pkg/webhook/v1beta1/experiment/validator"
4039
)
4140

@@ -79,25 +78,6 @@ func (v *ExperimentValidator) Handle(ctx context.Context, req admission.Request)
7978
}
8079
}
8180

82-
// After metrics collector sidecar injection in Job level done, delete validation for namespace labels
83-
ns := &v1.Namespace{}
84-
if err := v.client.Get(context.TODO(), types.NamespacedName{Name: req.AdmissionRequest.Namespace}, ns); err != nil {
85-
return admission.Errored(http.StatusInternalServerError, err)
86-
}
87-
validNS := true
88-
if ns.Labels == nil {
89-
validNS = false
90-
} else {
91-
if v, ok := ns.Labels[common.KatibMetricsCollectorInjection]; !ok || v != common.KatibMetricsCollectorInjectionEnabled {
92-
validNS = false
93-
}
94-
}
95-
if !validNS {
96-
err = fmt.Errorf("Cannot create the Experiment %q in namespace %q: the namespace lacks label \"%s: %s\"",
97-
inst.Name, req.AdmissionRequest.Namespace, common.KatibMetricsCollectorInjection, common.KatibMetricsCollectorInjectionEnabled)
98-
return admission.Errored(http.StatusBadRequest, err)
99-
}
100-
10181
err = v.ValidateExperiment(inst, oldInst)
10282
if err != nil {
10383
return admission.Errored(http.StatusBadRequest, err)

0 commit comments

Comments
 (0)