nokia / danm

TelCo grade network management in a Kubernetes cluster
BSD 3-Clause "New" or "Revised" License
373 stars 81 forks source link

Not able to deploy Danm 4.3.0 in kubernetes 1.21.8 using installer job. #266

Closed sriramec closed 2 years ago

sriramec commented 2 years ago

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

bug feature

What happened: Not able to deploy Danm 4.3.0 in kubernetes 1.21.8 using installer job.

What you expected to happen: Danm should get deployed in Kubernetes 1.21.8 using installer job. How to reproduce it: kubectl apply -f integration/install

Anything else we need to know?:

controller-0:~$ kubectl logs -f -n kube-system danm-installer-g6xmc
Using configured image registry prefix: 10.222.26.1:30003/danm/
Using configured image tag: :2.0
Not using any image pull secret
Using supplied CNI configuration data

Using supplied CA certificate

Applying CRDs to extend Kubernetes API...
Warning: apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
customresourcedefinition.apiextensions.k8s.io/clusternetworks.danm.k8s.io unchanged
customresourcedefinition.apiextensions.k8s.io/danmeps.danm.k8s.io unchanged
customresourcedefinition.apiextensions.k8s.io/tenantconfigs.danm.k8s.io unchanged
customresourcedefinition.apiextensions.k8s.io/tenantnetworks.danm.k8s.io unchanged

Creating Service Account
error: failed to create serviceaccount: serviceaccounts "danm" already exists
clusterrole.rbac.authorization.k8s.io/caas:danm unchanged
clusterrolebinding.rbac.authorization.k8s.io/caas:danm unchanged

Creating WebHook certificate...
creating certs in tmpdir /tmp/tmp.ldAphE
Generating RSA private key, 2048 bit long modulus (2 primes)
.........+++++
.....................+++++
e is 65537 (0x010001)
Warning: certificates.k8s.io/v1beta1 CertificateSigningRequest is deprecated in v1.19+, unavailable in v1.22+; use certificates.k8s.io/v1 CertificateSigningRequest
Error from server (AlreadyExists): error when creating "STDIN": certificatesigningrequests.certificates.k8s.io "danm-webhook-svc.kube-system" already exists

Environment:

shubham-gaur commented 2 years ago

Looks like few authorization modes and one authorization group is missing from the RBAC file of danm installer. Following changes in RBAC file of danm-installer resolved the issue for me.

--- a/integration/install/0danm-installer-rbac.yaml
+++ b/integration/install/0danm-installer-rbac.yaml
@@ -20,6 +20,7 @@ rules:
   - clusterroles
   - clusterrolebindings
   verbs:
+  - bind
   - get
   - create
   - patch
@@ -84,6 +85,9 @@ rules:
   - watch
   - create
   - update
+  - patch
+  - approve
+  - delete
 - apiGroups:
   - "certificates.k8s.io"
   resources:
@@ -132,6 +136,15 @@ rules:
   verbs:
   - list
   - watch
+- apiGroups:
+  - k8s.cni.cncf.io
+  resources:
+  - network-attachment-definitions
+  verbs:
+  - get
+  - list
+  - watch
+  - update
 ---
 apiVersion: rbac.authorization.k8s.io/v1
 kind: ClusterRoleBinding