Skip to content

Commit d16ca1f

Browse files
committed
Update operator to deploy 'simple' namespaced objects
Signed-off-by: Anish Asthana <anishasthana1@gmail.com>
1 parent 548f896 commit d16ca1f

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

config/internal/mcad/rolebinding_custom-metrics-auth-reader.yaml renamed to config/internal/mcad/rolebinding_custom-metrics-auth-reader.yaml.tmpl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# {{ if .Values.serviceAccount }}
21
apiVersion: rbac.authorization.k8s.io/v1
32
kind: RoleBinding
43
metadata:
5-
name: custom-metrics-auth-reader
6-
namespace: kube-system
4+
name: {{.Name}}-custom-metrics-auth-reader
5+
namespace: {{.Namespace}}
76
roleRef:
87
apiGroup: rbac.authorization.k8s.io
98
kind: Role
109
name: extension-apiserver-authentication-reader
1110
subjects:
1211
- kind: ServiceAccount
13-
name: {{.Values.serviceAccount}}
14-
namespace: kube-system
12+
name: mcad-controller-{{.Name}}
13+
namespace: {{.Namespace}}

config/internal/mcad/serviceaccount.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: mcad-controller-{{.Name}}
5+
namespace: {{.Namespace}}

controllers/mcad_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525

2626
codeflarev1alpha1 "github.com/project-codeflare/codeflare-operator/api/v1alpha1"
2727
corev1 "k8s.io/api/core/v1"
28+
rbacv1 "k8s.io/api/rbac/v1"
2829
apierrs "k8s.io/apimachinery/pkg/api/errors"
2930
"k8s.io/apimachinery/pkg/runtime"
3031
ctrl "sigs.k8s.io/controller-runtime"
@@ -144,6 +145,9 @@ func (r *MCADReconciler) SetupWithManager(mgr ctrl.Manager) error {
144145
return ctrl.NewControllerManagedBy(mgr).
145146
For(&codeflarev1alpha1.MCAD{}).
146147
Owns(&corev1.ConfigMap{}).
148+
Owns(&corev1.Service{}).
149+
Owns(&corev1.ServiceAccount{}).
150+
Owns(&rbacv1.RoleBinding{}).
147151
Complete(r)
148152
}
149153

controllers/multi_cluster_app_dispatcher.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import (
88

99
var multiClusterAppDispatcherTemplates = []string{
1010
"mcad/configmap.yaml.tmpl",
11+
"mcad/service.yaml.tmpl",
12+
"mcad/serviceaccount.yaml.tmpl",
13+
"mcad/service.yaml.tmpl",
14+
"mcad/rolebinding_custom-metrics-auth-reader.yaml.tmpl",
1115
}
1216

1317
func (r *MCADReconciler) ReconcileMCAD(ctx context.Context, mcad *codeflarev1alpha1.MCAD, req ctrl.Request, params *MCADParams) error {

0 commit comments

Comments
 (0)