Skip to content
This repository was archived by the owner on Aug 17, 2023. It is now read-only.

Patch kubeflow control plane label #123

Merged
merged 2 commits into from
Dec 5, 2019
Merged
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
14 changes: 14 additions & 0 deletions pkg/utils/k8utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import (
const (
YamlSeparator = "(?m)^---[ \t]*$"
CertDir = "/opt/ca"
controlPlaneLabel = "control-plane"
katibMetricsCollectorLabel = "katib-metricscollector-injection"
)

Expand Down Expand Up @@ -431,6 +432,7 @@ func (a *Apply) namespace(namespace string) error {
ObjectMeta: metav1.ObjectMeta{
Name: namespace,
Labels: map[string]string{
controlPlaneLabel: "kubeflow",
katibMetricsCollectorLabel: "enabled",
},
},
Expand All @@ -444,6 +446,17 @@ func (a *Apply) namespace(namespace string) error {
}
}
} else {
if _, ok := namespaceInstance.ObjectMeta.Labels[controlPlaneLabel]; !ok {
patchErr := a.patchNamespaceWithLabel(
namespace, controlPlaneLabel, "kubeflow",
)
if patchErr != nil {
return &kfapis.KfError{
Code: int(kfapis.INTERNAL_ERROR),
Message: fmt.Sprintf("couldn't patch %v Error: %v", namespace, patchErr),
}
}
}
if _, ok := namespaceInstance.ObjectMeta.Labels[katibMetricsCollectorLabel]; !ok {
patchErr := a.patchNamespaceWithLabel(
namespace, katibMetricsCollectorLabel, "enabled",
Expand All @@ -454,6 +467,7 @@ func (a *Apply) namespace(namespace string) error {
Message: fmt.Sprintf("couldn't patch %v Error: %v", namespace, patchErr),
}
}

}
}
return nil
Expand Down