Skip to content

Commit c3e778b

Browse files
authored
Change namespace label for metrics collector injection (#1740)
* Change namespace label for metrics collector injection * Fix var name
1 parent 0e17302 commit c3e778b

File tree

10 files changed

+12
-12
lines changed

10 files changed

+12
-12
lines changed

docs/proposals/metrics-collector.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The sidecar collects metrics of the master and then store them on the persistent
3636
<img src="../images/metrics-collector-design.png" width="80%">
3737

3838
Fig. 1 Architecture of the new design
39+
3940
</center>
4041

4142
## Goal
@@ -117,9 +118,8 @@ For more detail, see [here](https://github.com/kubeflow/katib/pull/697#issuecomm
117118

118119
To avoid collecting duplicated metrics, as we discuss in [kubeflow/katib#685](https://github.com/kubeflow/katib/issues/685), only one metrics collector sidecar will be injected into the master pod during one Experiment.
119120
In the new design, there are two modes for Katib mutating webhook to inject the sidecar: **Pod Level Injecting** and **Job Level Injecting**.
120-
121-
The webhook decides which mode to be used based on the `katib-metricscollector-injection=enabled` label tagged on the namespace.
122-
In the namespace with `katib-metricscollector-injection=enabled` label, the webhook inject the sidecar in the pod level. Otherwise, without this label, injecting in the job level.
121+
The webhook decides which mode to be used based on the `katib.kubeflow.org/metrics-collector-injection=enabled` label tagged on the namespace.
122+
In the namespace with `katib.kubeflow.org/metrics-collector-injection=enabled` label, the webhook inject the sidecar in the pod level. Otherwise, without this label, injecting in the job level.
123123

124124
In **Pod Level Injecting**,
125125

examples/v1beta1/argo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ After that, run below command to enable
2929
[Katib Metrics Collector sidecar injection](https://www.kubeflow.org/docs/components/katib/experiment/#metrics-collector):
3030

3131
```bash
32-
kubectl patch namespace argo -p '{"metadata":{"labels":{"katib-metricscollector-injection":"enabled"}}}'
32+
kubectl patch namespace argo -p '{"metadata":{"labels":{"katib.kubeflow.org/metrics-collector-injection":"enabled"}}}'
3333
```
3434

3535
**Note:** Argo Workflows are using `docker` as a

manifests/v1beta1/components/namespace/namespace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ kind: Namespace
33
metadata:
44
name: kubeflow
55
labels:
6-
katib-metricscollector-injection: enabled
6+
katib.kubeflow.org/metrics-collector-injection: enabled

manifests/v1beta1/components/webhook/webhooks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ webhooks:
6464
path: /mutate-pod
6565
namespaceSelector:
6666
matchLabels:
67-
katib-metricscollector-injection: enabled
67+
katib.kubeflow.org/metrics-collector-injection: enabled
6868
rules:
6969
- apiGroups:
7070
- ""

operators/katib-controller/src/webhooks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ webhooks:
6565
path: /mutate-pod
6666
namespaceSelector:
6767
matchLabels:
68-
katib-metricscollector-injection: enabled
68+
katib.kubeflow.org/metrics-collector-injection: enabled
6969
rules:
7070
- apiGroups:
7171
- ""

pkg/metricscollector/v1beta1/common/const.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const (
5252
)
5353

5454
var (
55-
AutoInjectMetricsCollecterList = [...]v1beta1common.CollectorKind{
55+
AutoInjectMetricsCollectorList = [...]v1beta1common.CollectorKind{
5656
v1beta1common.StdOutCollector,
5757
v1beta1common.TfEventCollector,
5858
v1beta1common.FileCollector,

pkg/webhook/v1beta1/common/const.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ limitations under the License.
1717
package common
1818

1919
const (
20-
KatibMetricsCollectorInjection = "katib-metricscollector-injection"
20+
KatibMetricsCollectorInjection = "katib.kubeflow.org/metrics-collector-injection"
2121
KatibMetricsCollectorInjectionEnabled = "enabled"
2222
)

pkg/webhook/v1beta1/experiment/validator/validator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ func validatePatchJob(runSpec *unstructured.Unstructured, job interface{}, jobTy
392392
func (g *DefaultValidator) validateMetricsCollector(inst *experimentsv1beta1.Experiment) error {
393393
mcSpec := inst.Spec.MetricsCollectorSpec
394394
mcKind := mcSpec.Collector.Kind
395-
for _, mc := range mccommon.AutoInjectMetricsCollecterList {
395+
for _, mc := range mccommon.AutoInjectMetricsCollectorList {
396396
if mcKind != mc {
397397
continue
398398
}

pkg/webhook/v1beta1/pod/const.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const (
3030
)
3131

3232
var (
33-
NeedWrapWorkerMetricsCollecterList = [...]common.CollectorKind{
33+
NeedWrapWorkerMetricsCollectorList = [...]common.CollectorKind{
3434
common.StdOutCollector,
3535
common.TfEventCollector,
3636
common.FileCollector,

pkg/webhook/v1beta1/pod/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func getMountPath(mc common.MetricsCollectorSpec) (string, common.FileSystemKind
129129

130130
func needWrapWorkerContainer(mc common.MetricsCollectorSpec) bool {
131131
mcKind := mc.Collector.Kind
132-
for _, kind := range NeedWrapWorkerMetricsCollecterList {
132+
for _, kind := range NeedWrapWorkerMetricsCollectorList {
133133
if mcKind == kind {
134134
return true
135135
}

0 commit comments

Comments
 (0)