From f1173ea80cd069c5535b6783df06a09e5b537cdb Mon Sep 17 00:00:00 2001 From: Senthil Raja Chermapandian Date: Fri, 27 Aug 2021 10:31:19 +0530 Subject: [PATCH 1/8] expose helm parameters in operator CR --- ...ubefledged.io_v1alpha2_kubefledged_cr.yaml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml b/deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml index 31f8214e..3accb482 100644 --- a/deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml +++ b/deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml @@ -5,4 +5,21 @@ metadata: namespace: kubefledged-operator spec: # Defaults defined in /helm-charts/kubefledged/values.yaml - kubefledgedNameSpace: kube-fledged + controllerReplicaCount: 1 + webhookServerReplicaCount: 1 + image: + kubefledgedControllerRepository: docker.io/senthilrch/kubefledged-controller + kubefledgedCRIClientRepository: docker.io/senthilrch/kubefledged-cri-client + kubefledgedWebhookServerRepository: docker.io/senthilrch/kubefledged-webhook-server + pullPolicy: Always + args: + controllerLogLevel: INFO + controllerImagePullDeadlineDuration: 5m + controllerImageCacheRefreshFrequency: 15m + controllerImagePullPolicy: IfNotPresent + webhookServerLogLevel: INFO + webhookServerCertFile: /var/run/secrets/webhook-server/tls.crt + webhookServerKeyFile: /var/run/secrets/webhook-server/tls.key + webhookServerPort: 443 + nameOverride: "" + fullnameOverride: "" \ No newline at end of file From 462133df2ce13da33759f0afad3e019defb6f435 Mon Sep 17 00:00:00 2001 From: Senthil Raja Chermapandian Date: Fri, 27 Aug 2021 12:44:08 +0530 Subject: [PATCH 2/8] document helm parameters --- README.md | 5 +++++ docs/helm-parameters.md | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 docs/helm-parameters.md diff --git a/README.md b/README.md index db022b8b..a2dd94a2 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ _kube-fledged_ provides CRUD APIs to manage the lifecycle of the image cache, an - [Quick Install using YAML manifests](#quick-install-using-yaml-manifests) - [Quick Install using Helm chart](#quick-install-using-helm-chart) - [Quick Install using Helm operator](#quick-install-using-helm-operator) +- [Helm chart parameters](#helm-chart-parameters) - [Build and Deploy](#build-and-deploy) - [Build](#build) - [Deploy](#deploy) @@ -126,6 +127,10 @@ These instructions install _kube-fledged_ to a separate namespace called "kube-f $ kubectl get imagecaches -n kube-fledged (Output should be: 'No resources found') ``` +## Helm chart parameters + +Parameters of the helm chart are documented [here](docs/helm-parameters.md) + ## Build and Deploy These instructions will help you build _kube-fledged_ from source and deploy it to a separate namespace called "kube-fledged". If you need to deploy it to a different namespace, edit the namespace field of the manifests in "kube-fledged/deploy" accordingly. diff --git a/docs/helm-parameters.md b/docs/helm-parameters.md new file mode 100644 index 00000000..46970ba5 --- /dev/null +++ b/docs/helm-parameters.md @@ -0,0 +1,21 @@ +# Helm chart parameters + +| Parameter | Default value | Description | +| --------- | ------------- | ----------- | +| controllerReplicaCount | 1 | No. of replicas of kubefledged-controller | +| webhookServerReplicaCount | 1 | No. of replicas of kubefledged-webhook-server | +| image.kubefledgedControllerRepository | docker.io/senthilrch/kubefledged-controller | Repository name of kubefledged-controller image | +| image.kubefledgedCRIClientRepository | docker.io/senthilrch/kubefledged-cri-client | Repository name of kubefledged-cri-client image | +| image.kubefledgedWebhookServerRepository | docker.io/senthilrch/kubefledged-webhook-server | Repository name of kubefledged-webhook-server image | +| image.pullPolicy | Always | Image pull policy for kubefledged-controller and kubefledged-webhook-server pods | +| args.controllerLogLevel | INFO | Log level of kubefledged-controller | +| args.controllerImagePullDeadlineDuration | 5m | Maximum duration allowed for pulling an image. After this duration, image pull is considered to have failed | +| args.controllerImageCacheRefreshFrequency | 15m | The image cache is refreshed periodically to ensure the cache is up to date. Setting this flag to "0s" will disable refresh | +| args.controllerImagePullPolicy | IfNotPresent | Image pull policy for pulling images into and refreshing the cache. Possible values are 'IfNotPresent' and 'Always'. Default value is 'IfNotPresent'. Image with no or ":latest" tag are always pulled | +| args.webhookServerLogLevel | INFO | Log level of kubefledged-webhook-server | +| args.webhookServerCertFile | /var/run/secrets/webhook-server/tls.crt | Path of server certificate of kubefledged-webhook-server | +| args.webhookServerKeyFile | /var/run/secrets/webhook-server/tls.key | Path of server key of kubefledged-webhook-server | +| args.webhookServerPort | 443 | Listening port of kubefledged-webhook-server | +| nameOverride | "" | nameOverride replaces the name of the chart in Chart.yaml, when this is used to construct Kubernetes object names | +| fullnameOverride | "" | fullnameOverride completely replaces the generated name | +| | | | \ No newline at end of file From 40cb746e3c1ab33a5e5f997c45f14f00c77cf275 Mon Sep 17 00:00:00 2001 From: Senthil Raja Chermapandian Date: Fri, 27 Aug 2021 22:18:08 +0530 Subject: [PATCH 3/8] update release version to v0.8.2 --- Makefile | 2 +- deploy/kubefledged-deployment-controller.yaml | 6 +++--- deploy/kubefledged-deployment-webhook-server.yaml | 4 ++-- deploy/kubefledged-operator/deploy/operator.yaml | 2 +- .../kubefledged-operator/helm-charts/kubefledged/Chart.yaml | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 2f9c55ad..e2300af5 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ ifndef OPERATOR_IMAGE_REPO endif ifndef RELEASE_VERSION - RELEASE_VERSION=v0.8.1 + RELEASE_VERSION=v0.8.2 endif ifndef DOCKER_VERSION diff --git a/deploy/kubefledged-deployment-controller.yaml b/deploy/kubefledged-deployment-controller.yaml index 94deab7f..20eecb21 100644 --- a/deploy/kubefledged-deployment-controller.yaml +++ b/deploy/kubefledged-deployment-controller.yaml @@ -19,7 +19,7 @@ spec: spec: initContainers: - name: wait - image: senthilrch/kubefledged-cri-client:v0.8.1 + image: senthilrch/kubefledged-cri-client:v0.8.2 command: ["curl"] args: - "--insecure" @@ -31,7 +31,7 @@ spec: - "https://kubefledged-webhook-server.kube-fledged.svc:3443/readyz" imagePullPolicy: Always containers: - - image: senthilrch/kubefledged-controller:v0.8.1 + - image: senthilrch/kubefledged-controller:v0.8.2 command: ["/opt/bin/kubefledged-controller"] args: - "--stderrthreshold=INFO" @@ -46,7 +46,7 @@ spec: fieldRef: fieldPath: metadata.namespace - name: KUBEFLEDGED_CRI_CLIENT_IMAGE - value: "senthilrch/kubefledged-cri-client:v0.8.1" + value: "senthilrch/kubefledged-cri-client:v0.8.2" - name: BUSYBOX_IMAGE value: "gcr.io/google-containers/busybox:1.27.2" serviceAccountName: kubefledged-controller diff --git a/deploy/kubefledged-deployment-webhook-server.yaml b/deploy/kubefledged-deployment-webhook-server.yaml index 368aa956..6c8ac899 100644 --- a/deploy/kubefledged-deployment-webhook-server.yaml +++ b/deploy/kubefledged-deployment-webhook-server.yaml @@ -18,7 +18,7 @@ spec: app: kubefledged spec: initContainers: - - image: senthilrch/kubefledged-webhook-server:v0.8.1 + - image: senthilrch/kubefledged-webhook-server:v0.8.2 command: ["/opt/bin/kubefledged-webhook-server"] args: - "--stderrthreshold=INFO" @@ -40,7 +40,7 @@ spec: - name: certkey-volume mountPath: "/var/run/secrets/webhook-server" containers: - - image: senthilrch/kubefledged-webhook-server:v0.8.1 + - image: senthilrch/kubefledged-webhook-server:v0.8.2 command: ["/opt/bin/kubefledged-webhook-server"] args: - "--stderrthreshold=INFO" diff --git a/deploy/kubefledged-operator/deploy/operator.yaml b/deploy/kubefledged-operator/deploy/operator.yaml index 605485c5..2e920d1a 100644 --- a/deploy/kubefledged-operator/deploy/operator.yaml +++ b/deploy/kubefledged-operator/deploy/operator.yaml @@ -17,7 +17,7 @@ spec: containers: - name: kubefledged-operator # Replace this with the built image name - image: docker.io/senthilrch/kubefledged-operator:v0.8.1 + image: docker.io/senthilrch/kubefledged-operator:v0.8.2 imagePullPolicy: Always env: - name: WATCH_NAMESPACE diff --git a/deploy/kubefledged-operator/helm-charts/kubefledged/Chart.yaml b/deploy/kubefledged-operator/helm-charts/kubefledged/Chart.yaml index f8df8752..e3b91be2 100644 --- a/deploy/kubefledged-operator/helm-charts/kubefledged/Chart.yaml +++ b/deploy/kubefledged-operator/helm-charts/kubefledged/Chart.yaml @@ -14,8 +14,8 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: v0.8.1 +version: v0.8.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. -appVersion: v0.8.1 +appVersion: v0.8.2 From af221d3b25658847ea4d2c1ae0d041627d029a09 Mon Sep 17 00:00:00 2001 From: Senthil Raja Chermapandian Date: Fri, 27 Aug 2021 23:42:16 +0530 Subject: [PATCH 4/8] set status to known when unable to fetch pod --- pkg/images/image_manager.go | 85 +++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 37 deletions(-) diff --git a/pkg/images/image_manager.go b/pkg/images/image_manager.go index 3bbfa433..c5402727 100644 --- a/pkg/images/image_manager.go +++ b/pkg/images/image_manager.go @@ -53,6 +53,8 @@ const ( ImageWorkResultStatusJobCreated = "jobcreated" //ImageWorkResultStatusAlreadyPulled means image is already present in the node ImageWorkResultStatusAlreadyPulled = "alreadypulled" + //ImageWorkResultStatusUnknown means status of image pull/delete unknown + ImageWorkResultStatusUnknown = "unknown" ) // ImageManager provides the functionalities for pulling and deleting images @@ -208,52 +210,61 @@ func (m *ImageManager) updatePendingImageWorkResults(imageCacheName string) erro glog.Errorf("Error listing Pods: %v", err) return err } - if len(pods) == 0 { - glog.Errorf("No pods matched job %s", job) - return fmt.Errorf("no pods matched job %s", job) - } if len(pods) > 1 { glog.Errorf("More than one pod matched job %s", job) return fmt.Errorf("more than one pod matched job %s", job) } - iwres.Status = ImageWorkResultStatusFailed - if iwres.ImageWorkRequest.WorkType == ImageCachePurge { - glog.Infof("Job %s expired (delete: %s --> %s)", job, iwres.ImageWorkRequest.Image, iwres.ImageWorkRequest.Node.Labels["kubernetes.io/hostname"]) - } else { - glog.Infof("Job %s expired (pull: %s --> %s)", job, iwres.ImageWorkRequest.Image, iwres.ImageWorkRequest.Node.Labels["kubernetes.io/hostname"]) - } - if pods[0].Status.Phase == corev1.PodPending { - if len(pods[0].Status.ContainerStatuses) == 1 { - if pods[0].Status.ContainerStatuses[0].State.Waiting != nil { - iwres.Reason = pods[0].Status.ContainerStatuses[0].State.Waiting.Reason - iwres.Message = pods[0].Status.ContainerStatuses[0].State.Waiting.Message - } - if pods[0].Status.ContainerStatuses[0].State.Terminated != nil { - iwres.Reason = pods[0].Status.ContainerStatuses[0].State.Terminated.Reason - iwres.Message = pods[0].Status.ContainerStatuses[0].State.Terminated.Message - } + if len(pods) == 0 { + glog.Warningf("No pods matched job %s", job) + if iwres.ImageWorkRequest.WorkType == ImageCachePurge { + glog.Warningf("Job %s status unknown (delete: %s --> %s)", job, iwres.ImageWorkRequest.Image, iwres.ImageWorkRequest.Node.Labels["kubernetes.io/hostname"]) } else { - iwres.Reason = "Pending" - iwres.Message = "Check if node is ready" + glog.Warningf("Job %s status unknown (pull: %s --> %s)", job, iwres.ImageWorkRequest.Image, iwres.ImageWorkRequest.Node.Labels["kubernetes.io/hostname"]) } + iwres.Status = ImageWorkResultStatusUnknown + iwres.Reason = fmt.Sprintf("No pods matched job %s", job) + iwres.Message = fmt.Sprintf("No pods matched job %s", job) } - if iwres.ImageWorkRequest.WorkType != ImageCachePurge { - fieldSelector := fields.Set{ - "involvedObject.kind": "Pod", - "involvedObject.name": pods[0].Name, - "involvedObject.namespace": m.fledgedNameSpace, - "reason": "Failed", - }.AsSelector().String() - - eventlist, err := m.kubeclientset.CoreV1().Events(m.fledgedNameSpace). - List(context.TODO(), metav1.ListOptions{FieldSelector: fieldSelector}) - if err != nil { - glog.Errorf("Error listing events for pod (%s): %v", pods[0].Name, err) - return err + if len(pods) == 1 { + iwres.Status = ImageWorkResultStatusFailed + if iwres.ImageWorkRequest.WorkType == ImageCachePurge { + glog.Infof("Job %s expired (delete: %s --> %s)", job, iwres.ImageWorkRequest.Image, iwres.ImageWorkRequest.Node.Labels["kubernetes.io/hostname"]) + } else { + glog.Infof("Job %s expired (pull: %s --> %s)", job, iwres.ImageWorkRequest.Image, iwres.ImageWorkRequest.Node.Labels["kubernetes.io/hostname"]) + } + if pods[0].Status.Phase == corev1.PodPending { + if len(pods[0].Status.ContainerStatuses) == 1 { + if pods[0].Status.ContainerStatuses[0].State.Waiting != nil { + iwres.Reason = pods[0].Status.ContainerStatuses[0].State.Waiting.Reason + iwres.Message = pods[0].Status.ContainerStatuses[0].State.Waiting.Message + } + if pods[0].Status.ContainerStatuses[0].State.Terminated != nil { + iwres.Reason = pods[0].Status.ContainerStatuses[0].State.Terminated.Reason + iwres.Message = pods[0].Status.ContainerStatuses[0].State.Terminated.Message + } + } else { + iwres.Reason = "Pending" + iwres.Message = "Check if node is ready" + } } + if iwres.ImageWorkRequest.WorkType != ImageCachePurge { + fieldSelector := fields.Set{ + "involvedObject.kind": "Pod", + "involvedObject.name": pods[0].Name, + "involvedObject.namespace": m.fledgedNameSpace, + "reason": "Failed", + }.AsSelector().String() + + eventlist, err := m.kubeclientset.CoreV1().Events(m.fledgedNameSpace). + List(context.TODO(), metav1.ListOptions{FieldSelector: fieldSelector}) + if err != nil { + glog.Errorf("Error listing events for pod (%s): %v", pods[0].Name, err) + return err + } - for _, v := range eventlist.Items { - iwres.Message = iwres.Message + ":" + v.Message + for _, v := range eventlist.Items { + iwres.Message = iwres.Message + ":" + v.Message + } } } m.imageworkstatus[job] = iwres From f41758f611865cc75bd68cf8a6c5b6e074d87e10 Mon Sep 17 00:00:00 2001 From: Senthil Raja Chermapandian Date: Sat, 28 Aug 2021 00:04:04 +0530 Subject: [PATCH 5/8] add check for image pull/delete status unknown --- cmd/controller/app/controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/controller/app/controller.go b/cmd/controller/app/controller.go index afd91d3f..67c452f6 100644 --- a/cmd/controller/app/controller.go +++ b/cmd/controller/app/controller.go @@ -577,7 +577,7 @@ func (c *Controller) syncHandler(wqKey images.WorkQueueKey) error { status.Message = v1alpha2.ImageCacheMessageImagesPulledSuccessfully } } - if v.Status == images.ImageWorkResultStatusFailed && !failures { + if (v.Status == images.ImageWorkResultStatusFailed || v.Status == images.ImageWorkResultStatusUnknown) && !failures { failures = true status.Status = v1alpha2.ImageCacheActionStatusFailed if v.ImageWorkRequest.WorkType == images.ImageCachePurge { @@ -586,7 +586,7 @@ func (c *Controller) syncHandler(wqKey images.WorkQueueKey) error { status.Message = v1alpha2.ImageCacheMessageImagePullFailedForSomeImages } } - if v.Status == images.ImageWorkResultStatusFailed { + if v.Status == images.ImageWorkResultStatusFailed || v.Status == images.ImageWorkResultStatusUnknown { status.Failures[v.ImageWorkRequest.Image] = append( status.Failures[v.ImageWorkRequest.Image], v1alpha2.NodeReasonMessage{ Node: v.ImageWorkRequest.Node.Labels["kubernetes.io/hostname"], From edebbdacb7ecda61f98ae13bbc37efa694101f9a Mon Sep 17 00:00:00 2001 From: Senthil Raja Chermapandian Date: Sat, 28 Aug 2021 00:24:27 +0530 Subject: [PATCH 6/8] update log messages --- cmd/controller/app/controller.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/controller/app/controller.go b/cmd/controller/app/controller.go index 67c452f6..af43af7a 100644 --- a/cmd/controller/app/controller.go +++ b/cmd/controller/app/controller.go @@ -221,30 +221,30 @@ func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error { defer c.imageworkqueue.ShutDown() // Start the informer factories to begin populating the informer caches - glog.Info("Starting fledged controller") + glog.Info("Starting kubefledged-controller") // Wait for the caches to be synced before starting workers - glog.Info("Waiting for informer caches to sync") if ok := cache.WaitForCacheSync(stopCh, c.nodesSynced, c.imageCachesSynced); !ok { return fmt.Errorf("failed to wait for caches to sync") } + glog.Info("Informer caches synched successfull") - glog.Info("Starting image cache worker") // Launch workers to process ImageCache resources for i := 0; i < threadiness; i++ { go wait.Until(c.runWorker, time.Second, stopCh) } + glog.Info("Image cache worker started") if c.imageCacheRefreshFrequency.Nanoseconds() != int64(0) { - glog.Info("Starting cache refresh worker") go wait.Until(c.runRefreshWorker, c.imageCacheRefreshFrequency, stopCh) + glog.Info("Image cache refresh worker started") } - glog.Info("Started workers") c.imageManager.Run(stopCh) if err := c.imageManager.Run(stopCh); err != nil { glog.Fatalf("Error running image manager: %s", err.Error()) } + glog.Info("Image manager started") <-stopCh glog.Info("Shutting down workers") From 3b5895b7f3549603463265c2b08cb1792427a52b Mon Sep 17 00:00:00 2001 From: Senthil Raja Chermapandian Date: Sat, 28 Aug 2021 00:52:52 +0530 Subject: [PATCH 7/8] deploy controller and operator to same namespace --- Makefile | 25 +++++++------------ README.md | 2 +- .../deploy/clusterrole_binding.yaml | 2 +- ...ubefledged.io_v1alpha2_kubefledged_cr.yaml | 2 +- .../kubefledged-operator/deploy/operator.yaml | 2 +- .../deploy/service_account.yaml | 2 +- 6 files changed, 14 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index e2300af5..c7544678 100644 --- a/Makefile +++ b/Makefile @@ -82,10 +82,6 @@ ifndef PROGRESS PROGRESS=auto endif -ifndef OPERATOR_NAMESPACE - OPERATOR_NAMESPACE=kubefledged-operator -endif - ifndef KUBEFLEDGED_NAMESPACE KUBEFLEDGED_NAMESPACE=kube-fledged endif @@ -206,22 +202,20 @@ deploy-using-yaml: kubectl rollout status deployment kubefledged-controller -n kube-fledged --watch deploy-using-operator: - # Create the namespaces for operator and kubefledged - -kubectl create namespace ${OPERATOR_NAMESPACE} + # Create the namespace -kubectl create namespace ${KUBEFLEDGED_NAMESPACE} - # Deploy the operator to a separate namespace - sed -i "s|{{OPERATOR_NAMESPACE}}|${OPERATOR_NAMESPACE}|g" deploy/kubefledged-operator/deploy/service_account.yaml - sed -i "s|{{OPERATOR_NAMESPACE}}|${OPERATOR_NAMESPACE}|g" deploy/kubefledged-operator/deploy/clusterrole_binding.yaml - sed -i "s|{{OPERATOR_NAMESPACE}}|${OPERATOR_NAMESPACE}|g" deploy/kubefledged-operator/deploy/operator.yaml + # Deploy the operator + sed -i "s|{{KUBEFLEDGED_NAMESPACE}}|${KUBEFLEDGED_NAMESPACE}|g" deploy/kubefledged-operator/deploy/service_account.yaml + sed -i "s|{{KUBEFLEDGED_NAMESPACE}}|${KUBEFLEDGED_NAMESPACE}|g" deploy/kubefledged-operator/deploy/clusterrole_binding.yaml + sed -i "s|{{KUBEFLEDGED_NAMESPACE}}|${KUBEFLEDGED_NAMESPACE}|g" deploy/kubefledged-operator/deploy/operator.yaml kubectl apply -f deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_kubefledgeds_crd.yaml kubectl apply -f deploy/kubefledged-operator/deploy/service_account.yaml kubectl apply -f deploy/kubefledged-operator/deploy/clusterrole.yaml kubectl apply -f deploy/kubefledged-operator/deploy/clusterrole_binding.yaml kubectl apply -f deploy/kubefledged-operator/deploy/operator.yaml - # Deploy kube-fledged to a separate namespace - sed -i "s|{{OPERATOR_NAMESPACE}}|${OPERATOR_NAMESPACE}|g" deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml + # Deploy kube-fledged sed -i "s|{{KUBEFLEDGED_NAMESPACE}}|${KUBEFLEDGED_NAMESPACE}|g" deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml - kubectl rollout status deployment kubefledged-operator -n kubefledged-operator --watch + kubectl rollout status deployment kubefledged-operator -n ${KUBEFLEDGED_NAMESPACE} --watch kubectl apply -f deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml update: @@ -239,17 +233,16 @@ remove-kubefledged: -kubectl delete -f deploy/kubefledged-validatingwebhook.yaml remove-operator-and-kubefledged: - # Remove kubefledged and the namespace + # Remove kubefledged -kubectl delete -f deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml -kubectl delete validatingwebhookconfigurations -l app.kubernetes.io/name=kube-fledged - -kubectl delete namespace ${KUBEFLEDGED_NAMESPACE} # Remove the kubefledged operator and the namespace -kubectl delete -f deploy/kubefledged-operator/deploy/operator.yaml -kubectl delete -f deploy/kubefledged-operator/deploy/clusterrole_binding.yaml -kubectl delete -f deploy/kubefledged-operator/deploy/clusterrole.yaml -kubectl delete -f deploy/kubefledged-operator/deploy/service_account.yaml -kubectl delete -f deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_kubefledgeds_crd.yaml - -kubectl delete namespace ${OPERATOR_NAMESPACE} + -kubectl delete namespace ${KUBEFLEDGED_NAMESPACE} -git checkout deploy/kubefledged-operator/deploy/operator.yaml -git checkout deploy/kubefledged-operator/deploy/clusterrole_binding.yaml -git checkout deploy/kubefledged-operator/deploy/service_account.yaml diff --git a/README.md b/README.md index a2dd94a2..a34135b1 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ These instructions install _kube-fledged_ to a separate namespace called "kube-f $ cd $HOME/src/github.com/senthilrch/kube-fledged ``` -- Deploy the helm operator to a separate namespace called "kubefledged-operator" and _kube-fledged_ to a separate namespace called "kube-fledged". If you need to deploy to a different namespace, export the variables OPERATOR_NAMESPACE and KUBEFLEDGED_NAMESPACE +- Deploy the helm operator and _kube-fledged_ to namespace "kube-fledged". If you need to deploy to a different namespace, export the variable KUBEFLEDGED_NAMESPACE ``` $ make deploy-using-operator diff --git a/deploy/kubefledged-operator/deploy/clusterrole_binding.yaml b/deploy/kubefledged-operator/deploy/clusterrole_binding.yaml index 8ca12f66..6932d18d 100644 --- a/deploy/kubefledged-operator/deploy/clusterrole_binding.yaml +++ b/deploy/kubefledged-operator/deploy/clusterrole_binding.yaml @@ -5,7 +5,7 @@ metadata: subjects: - kind: ServiceAccount name: kubefledged-operator - namespace: {{OPERATOR_NAMESPACE}} + namespace: {{KUBEFLEDGED_NAMESPACE}} roleRef: kind: ClusterRole name: kubefledged-operator diff --git a/deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml b/deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml index 3accb482..a80e7e11 100644 --- a/deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml +++ b/deploy/kubefledged-operator/deploy/crds/charts.helm.kubefledged.io_v1alpha2_kubefledged_cr.yaml @@ -2,7 +2,7 @@ apiVersion: charts.helm.kubefledged.io/v1alpha2 kind: KubeFledged metadata: name: kube-fledged - namespace: kubefledged-operator + namespace: {{KUBEFLEDGED_NAMESPACE}} spec: # Defaults defined in /helm-charts/kubefledged/values.yaml controllerReplicaCount: 1 diff --git a/deploy/kubefledged-operator/deploy/operator.yaml b/deploy/kubefledged-operator/deploy/operator.yaml index 2e920d1a..a1566a3b 100644 --- a/deploy/kubefledged-operator/deploy/operator.yaml +++ b/deploy/kubefledged-operator/deploy/operator.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: kubefledged-operator - namespace: {{OPERATOR_NAMESPACE}} + namespace: {{KUBEFLEDGED_NAMESPACE}} spec: replicas: 1 selector: diff --git a/deploy/kubefledged-operator/deploy/service_account.yaml b/deploy/kubefledged-operator/deploy/service_account.yaml index f35e251a..cb586013 100644 --- a/deploy/kubefledged-operator/deploy/service_account.yaml +++ b/deploy/kubefledged-operator/deploy/service_account.yaml @@ -2,4 +2,4 @@ apiVersion: v1 kind: ServiceAccount metadata: name: kubefledged-operator - namespace: {{OPERATOR_NAMESPACE}} + namespace: {{KUBEFLEDGED_NAMESPACE}} From 304712ae598be4f334569d9c340c551c474e1d53 Mon Sep 17 00:00:00 2001 From: Senthil Raja Chermapandian Date: Wed, 1 Sep 2021 12:39:45 +0530 Subject: [PATCH 8/8] fix unit test errors --- pkg/images/image_manager_test.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkg/images/image_manager_test.go b/pkg/images/image_manager_test.go index dcd4f9ba..32667003 100644 --- a/pkg/images/image_manager_test.go +++ b/pkg/images/image_manager_test.go @@ -501,7 +501,7 @@ func TestUpdateImageCacheStatus(t *testing.T) { expectError: false, }, { - name: "#6: Purge - Unsuccessful", + name: "#6: Purge - Successful", imageworkstatus: map[string]ImageWorkResult{ "fakejob": { ImageWorkRequest: ImageWorkRequest{ @@ -523,8 +523,7 @@ func TestUpdateImageCacheStatus(t *testing.T) { }, }, }, - expectError: true, - expectedErrorString: "no pods matched job", + expectError: false, }, { name: "#7: Purge - Unsuccessful", @@ -562,7 +561,7 @@ func TestUpdateImageCacheStatus(t *testing.T) { expectedErrorString: "more than one pod matched job", }, { - name: "#8: Create - Unsuccessful", + name: "#8: Create - Successful", imageworkstatus: map[string]ImageWorkResult{ "fakejob": { ImageWorkRequest: ImageWorkRequest{ @@ -597,9 +596,7 @@ func TestUpdateImageCacheStatus(t *testing.T) { }, }, }, - jobDeleteErr: true, - expectError: true, - expectedErrorString: "Internal error occurred: fake error", + expectError: false, }, }