Skip to content

Commit ebaaf75

Browse files
fix(manifests): Upgrading metacontroller to v4.11.22 (#11656)
Signed-off-by: Tarek Abouzeid <[email protected]>
1 parent a6b944b commit ebaaf75

File tree

6 files changed

+375
-68
lines changed

6 files changed

+375
-68
lines changed

manifests/kustomize/base/installs/multi-user/pipelines-profile-controller/composite-controller.yaml renamed to manifests/kustomize/base/installs/multi-user/pipelines-profile-controller/decorator-controller.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Change resyncPeriodSeconds to 1 hour from insane 20 seconds
2-
# Only sync namespaces with pipelines.kubeflow.org/enabled = "true"
31
apiVersion: metacontroller.k8s.io/v1alpha1
4-
kind: CompositeController
2+
kind: DecoratorController
53
metadata:
64
name: kubeflow-pipelines-profile-controller
75
spec:
8-
generateSelector: true
96
resyncPeriodSeconds: 3600
10-
parentResource:
11-
apiVersion: v1
7+
resources:
8+
- apiVersion: v1
129
resource: namespaces
13-
childResources:
10+
labelSelector:
11+
matchLabels:
12+
pipelines.kubeflow.org/enabled: "true"
13+
attachments:
1414
- apiVersion: v1
1515
resource: secrets
1616
updateStrategy:
@@ -38,4 +38,4 @@ spec:
3838
hooks:
3939
sync:
4040
webhook:
41-
url: http://kubeflow-pipelines-profile-controller/sync
41+
url: http://kubeflow-pipelines-profile-controller/sync

manifests/kustomize/base/installs/multi-user/pipelines-profile-controller/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ commonLabels:
66
resources:
77
- service.yaml
88
- deployment.yaml
9-
- composite-controller.yaml
9+
- decorator-controller.yaml
1010
configMapGenerator:
1111
- name: kubeflow-pipelines-profile-controller-code
1212
files:

manifests/kustomize/base/installs/multi-user/pipelines-profile-controller/sync.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,14 @@ def server_factory(visualization_server_image,
9999
Returns an HTTPServer populated with Handler with customized settings
100100
"""
101101
class Controller(BaseHTTPRequestHandler):
102-
def sync(self, parent, children):
102+
def sync(self, parent, attachments):
103103
# parent is a namespace
104104
namespace = parent.get("metadata", {}).get("name")
105-
106105
pipeline_enabled = parent.get("metadata", {}).get(
107106
"labels", {}).get("pipelines.kubeflow.org/enabled")
108107

109108
if pipeline_enabled != "true":
110-
return {"status": {}, "children": []}
109+
return {"status": {}, "attachments": []}
111110

112111
desired_configmap_count = 1
113112
desired_resources = []
@@ -129,16 +128,16 @@ def sync(self, parent, children):
129128
# Compute status based on observed state.
130129
desired_status = {
131130
"kubeflow-pipelines-ready":
132-
len(children["Secret.v1"]) == 1 and
133-
len(children["ConfigMap.v1"]) == desired_configmap_count and
134-
len(children["Deployment.apps/v1"]) == 2 and
135-
len(children["Service.v1"]) == 2 and
136-
len(children["DestinationRule.networking.istio.io/v1alpha3"]) == 1 and
137-
len(children["AuthorizationPolicy.security.istio.io/v1beta1"]) == 1 and
131+
len(attachments["Secret.v1"]) == 1 and
132+
len(attachments["ConfigMap.v1"]) == desired_configmap_count and
133+
len(attachments["Deployment.apps/v1"]) == 2 and
134+
len(attachments["Service.v1"]) == 2 and
135+
len(attachments["DestinationRule.networking.istio.io/v1alpha3"]) == 1 and
136+
len(attachments["AuthorizationPolicy.security.istio.io/v1beta1"]) == 1 and
138137
"True" or "False"
139138
}
140139

141-
# Generate the desired child object(s).
140+
# Generate the desired attachment object(s).
142141
desired_resources += [
143142
{
144143
"apiVersion": "v1",
@@ -376,13 +375,13 @@ def sync(self, parent, children):
376375
},
377376
})
378377

379-
return {"status": desired_status, "children": desired_resources}
378+
return {"status": desired_status, "attachments": desired_resources}
380379

381380
def do_POST(self):
382381
# Serve the sync() function as a JSON webhook.
383382
observed = json.loads(
384383
self.rfile.read(int(self.headers.get("content-length"))))
385-
desired = self.sync(observed["parent"], observed["children"])
384+
desired = self.sync(observed["object"], observed["attachments"])
386385

387386
self.send_response(200)
388387
self.send_header("Content-type", "application/json")

manifests/kustomize/third-party/metacontroller/base/cluster-role.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ metadata:
55
rules:
66
- apiGroups: [""]
77
resources: ["namespaces"]
8-
verbs: ["get", "list", "watch"]
8+
verbs: ["get", "list", "watch", "update"]
9+
- apiGroups: [""]
10+
resources: ["namespaces/status"]
11+
verbs: ["get", "list", "watch", "update", "patch"]
912
- apiGroups: [""]
1013
resources: ["secrets", "configmaps"]
1114
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
@@ -24,3 +27,6 @@ rules:
2427
- apiGroups: ["metacontroller.k8s.io"]
2528
resources: ["compositecontrollers", "controllerrevisions", "decoratorcontrollers"]
2629
verbs: ["get", "list", "watch"]
30+
- apiGroups: [""]
31+
resources: ["events"]
32+
verbs: ["create", "patch"]

0 commit comments

Comments
 (0)