From 82c0c4126a4875c175889086bff2f2568d5566cb Mon Sep 17 00:00:00 2001 From: dm4 Date: Tue, 23 May 2023 18:40:38 +0800 Subject: [PATCH] Workaround for job name too long Signed-off-by: dm4 --- .github/workflows/docker-build-push.yml | 8 ++++---- charts/kwasm-operator/values.yaml | 2 +- controllers/provisioner_controller.go | 4 ++-- controllers/provisioner_controller_test.go | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index ec9a1cf..1b8d421 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -2,10 +2,10 @@ name: Docker Image CI on: push: - branches: [ main ] + branches: [ '*' ] tags: [ '*' ] pull_request: - branches: [ main ] + branches: [ '*' ] env: REGISTRY: ghcr.io @@ -64,7 +64,7 @@ jobs: version: v3.10.0 - name: Run chart-releaser - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/release' uses: helm/chart-releaser-action@v1.4.1 env: - CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/charts/kwasm-operator/values.yaml b/charts/kwasm-operator/values.yaml index 59e3c85..0e30282 100644 --- a/charts/kwasm-operator/values.yaml +++ b/charts/kwasm-operator/values.yaml @@ -5,7 +5,7 @@ replicaCount: 1 image: - repository: ghcr.io/kwasm/kwasm-operator + repository: ghcr.io/second-state/kwasm-operator pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: kwasm-operator-0.2.1 diff --git a/controllers/provisioner_controller.go b/controllers/provisioner_controller.go index 7eb37fd..2ceb29c 100644 --- a/controllers/provisioner_controller.go +++ b/controllers/provisioner_controller.go @@ -109,7 +109,7 @@ func (r *ProvisionerReconciler) Reconcile(ctx context.Context, req ctrl.Request) err := r.Delete(ctx, &batchv1.Job{ ObjectMeta: metav1.ObjectMeta{ - Name: req.Name + "-provision-kwasm", + Name: req.Name + "-pk", Namespace: os.Getenv("CONTROLLER_NAMESPACE"), }, }, client.PropagationPolicy(metav1.DeletePropagationBackground)) @@ -142,7 +142,7 @@ func (r *ProvisionerReconciler) deployJob(n *corev1.Node, req ctrl.Request) *bat dep := &batchv1.Job{ ObjectMeta: metav1.ObjectMeta{ - Name: req.Name + "-provision-kwasm", + Name: req.Name + "-pk", Namespace: os.Getenv("CONTROLLER_NAMESPACE"), Labels: map[string]string{"kwasm.sh/job": "true"}, }, diff --git a/controllers/provisioner_controller_test.go b/controllers/provisioner_controller_test.go index 4ae01ad..62f409a 100644 --- a/controllers/provisioner_controller_test.go +++ b/controllers/provisioner_controller_test.go @@ -74,7 +74,7 @@ var _ = Describe("ProvisionerController", func() { // Check that the job was created. job = &batchv1.Job{} - err = k8sClient.Get(ctx, types.NamespacedName{Name: nodeName + "-provision-kwasm", Namespace: namespaceName}, job) + err = k8sClient.Get(ctx, types.NamespacedName{Name: nodeName + "-pk", Namespace: namespaceName}, job) Expect(err).NotTo(HaveOccurred()) Expect(job).NotTo(BeNil()) @@ -109,7 +109,7 @@ var _ = Describe("ProvisionerController", func() { // Check that the job was created. job = &batchv1.Job{} - err = k8sClient.Get(ctx, types.NamespacedName{Name: nodeName + "-provision-kwasm", Namespace: namespaceName}, job) + err = k8sClient.Get(ctx, types.NamespacedName{Name: nodeName + "-pk", Namespace: namespaceName}, job) Expect(err).To(HaveOccurred()) }) @@ -135,7 +135,7 @@ var _ = Describe("ProvisionerController", func() { }) // Check that the job was created. job = &batchv1.Job{} - err = k8sClient.Get(ctx, types.NamespacedName{Name: nodeName + "-provision-kwasm", Namespace: namespaceName}, job) + err = k8sClient.Get(ctx, types.NamespacedName{Name: nodeName + "-pk", Namespace: namespaceName}, job) Expect(err).NotTo(HaveOccurred()) }) })