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

Commit

Permalink
add sa to the deployment (#60)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
aabughosh authored Jun 22, 2023
1 parent 842458b commit 9e6a00d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/pre-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ jobs:

- name: Show controller's container image
run: oc get pods -n "${TNF_TEST_NAMESPACE}" -o json | jq '.items[] | .spec.containers[] | select(.name == "manager") | .image'


- name: Run Make install to install dependencies
run: make install

- name: Create operator cluster role.
run: make addrole

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ endif
.PHONY: install
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -
kubectl apply -f service-account-for-crd-deployment.yaml

.PHONY: uninstall
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.
Expand Down
3 changes: 2 additions & 1 deletion controllers/foo_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func (r *FooReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
log.Error(err, "unable to fetch Foo")
return ctrl.Result{}, client.IgnoreNotFound(err)
}

log.Info("create deployment")
size := foo.Spec.Replicas
faleb := false
Expand Down Expand Up @@ -84,6 +83,7 @@ func (r *FooReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
},
},
Spec: corev1.PodSpec{
ServiceAccountName: "role-sa-name",
TerminationGracePeriodSeconds: &tim,
AutomountServiceAccountToken: &faleb,
Containers: []corev1.Container{{
Expand Down Expand Up @@ -170,6 +170,7 @@ func (r *FooReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R
},
},
}

log.Info("after create deployment")
found := &appsv1.Deployment{}
errf := r.Get(context.TODO(), types.NamespacedName{
Expand Down
5 changes: 5 additions & 0 deletions service-account-for-crd-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: role-sa-name
namespace: tnf

0 comments on commit 9e6a00d

Please sign in to comment.