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

Commit 9e6a00d

Browse files
authored
add sa to the deployment (#60)
* add sa to the deployment * add sa to the deployment * add sa to the deployment * add debug * add creating csv * add creating csv * add creating csv * add creating csv with apply * add creating csv with apply * add creating csv with apply * make install to the pre-main * make install to the pre-main * make install to the pre-main * make install to the pre-main * make install to the pre-main
1 parent 842458b commit 9e6a00d

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

.github/workflows/pre-main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ jobs:
9292

9393
- name: Show controller's container image
9494
run: oc get pods -n "${TNF_TEST_NAMESPACE}" -o json | jq '.items[] | .spec.containers[] | select(.name == "manager") | .image'
95-
95+
96+
- name: Run Make install to install dependencies
97+
run: make install
98+
9699
- name: Create operator cluster role.
97100
run: make addrole
98101

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ endif
108108
.PHONY: install
109109
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
110110
$(KUSTOMIZE) build config/crd | kubectl apply -f -
111+
kubectl apply -f service-account-for-crd-deployment.yaml
111112

112113
.PHONY: uninstall
113114
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.

controllers/foo_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ func (r *FooReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
4646
log.Error(err, "unable to fetch Foo")
4747
return ctrl.Result{}, client.IgnoreNotFound(err)
4848
}
49-
5049
log.Info("create deployment")
5150
size := foo.Spec.Replicas
5251
faleb := false
@@ -84,6 +83,7 @@ func (r *FooReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
8483
},
8584
},
8685
Spec: corev1.PodSpec{
86+
ServiceAccountName: "role-sa-name",
8787
TerminationGracePeriodSeconds: &tim,
8888
AutomountServiceAccountToken: &faleb,
8989
Containers: []corev1.Container{{
@@ -170,6 +170,7 @@ func (r *FooReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
170170
},
171171
},
172172
}
173+
173174
log.Info("after create deployment")
174175
found := &appsv1.Deployment{}
175176
errf := r.Get(context.TODO(), types.NamespacedName{
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: role-sa-name
5+
namespace: tnf

0 commit comments

Comments
 (0)