From b28012f9f7b9bfa4b9b6e8288e37b0358d727b3f Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Wed, 21 Jun 2023 18:51:25 +0700 Subject: [PATCH 1/2] add finalizer to the dep only if object is not being deleted Signed-off-by: Chanwit Kaewkasi --- controllers/tf_controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/tf_controller.go b/controllers/tf_controller.go index a907ba95..240b4d3f 100644 --- a/controllers/tf_controller.go +++ b/controllers/tf_controller.go @@ -504,8 +504,8 @@ func (r *TerraformReconciler) checkDependencies(source sourcev1.Source, terrafor return fmt.Errorf("unable to get '%s' dependency: %w", dName, err) } - // add finalizer to the dependency - if !controllerutil.ContainsFinalizer(&tf, dependantFinalizer) { + // add finalizer to the dependency only if object is not being deleted + if tf.ObjectMeta.DeletionTimestamp.IsZero() && !controllerutil.ContainsFinalizer(&tf, dependantFinalizer) { patch := client.MergeFrom(tf.DeepCopy()) controllerutil.AddFinalizer(&tf, dependantFinalizer) if err := r.Patch(context.Background(), &tf, patch, client.FieldOwner(r.statusManager)); err != nil { From 87e2dc192c8afb4a64ab96faac07cf266b48e516 Mon Sep 17 00:00:00 2001 From: Chanwit Kaewkasi Date: Tue, 27 Jun 2023 20:30:47 +0700 Subject: [PATCH 2/2] update docker images Signed-off-by: Chanwit Kaewkasi --- Dockerfile | 8 ++++++-- runner-azure.Dockerfile | 8 ++++++-- runner.Dockerfile | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4df2d7c4..e6cb5293 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,11 +28,15 @@ COPY utils/ utils/ # Build RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -gcflags=all="-N -l" -a -o tf-controller cmd/manager/main.go -FROM alpine:3.16.5 +FROM alpine:3.18 LABEL org.opencontainers.image.source="https://github.com/weaveworks/tf-controller" -RUN apk add --no-cache ca-certificates tini git openssh-client gnupg && \ +RUN apk update + +RUN apk add --no-cache libcrypto3=3.1.1-r1 && \ + apk add --no-cache libssl3=3.1.1-r1 && \ + apk add --no-cache ca-certificates tini git openssh-client gnupg && \ apk add --no-cache libretls && \ apk add --no-cache busybox diff --git a/runner-azure.Dockerfile b/runner-azure.Dockerfile index caee1959..64fc8157 100644 --- a/runner-azure.Dockerfile +++ b/runner-azure.Dockerfile @@ -32,11 +32,15 @@ ARG TF_VERSION=1.3.9 ADD https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_${TARGETARCH}.zip /terraform_${TF_VERSION}_linux_${TARGETARCH}.zip RUN unzip -q /terraform_${TF_VERSION}_linux_${TARGETARCH}.zip -FROM alpine:3.16.5 +FROM alpine:3.18 LABEL org.opencontainers.image.source="https://github.com/weaveworks/tf-controller" -RUN apk add --no-cache ca-certificates tini git openssh-client gnupg && \ +RUN apk update + +RUN apk add --no-cache libcrypto3=3.1.1-r1 && \ + apk add --no-cache libssl3=3.1.1-r1 && \ + apk add --no-cache ca-certificates tini git openssh-client gnupg && \ apk add --no-cache libretls && \ apk add --no-cache busybox diff --git a/runner.Dockerfile b/runner.Dockerfile index 6dd3a74d..17cb43a3 100644 --- a/runner.Dockerfile +++ b/runner.Dockerfile @@ -32,11 +32,15 @@ ARG TF_VERSION=1.3.9 ADD https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_${TARGETARCH}.zip /terraform_${TF_VERSION}_linux_${TARGETARCH}.zip RUN unzip -q /terraform_${TF_VERSION}_linux_${TARGETARCH}.zip -FROM alpine:3.16.5 +FROM alpine:3.18 LABEL org.opencontainers.image.source="https://github.com/weaveworks/tf-controller" -RUN apk add --no-cache ca-certificates tini git openssh-client gnupg && \ +RUN apk update + +RUN apk add --no-cache libcrypto3=3.1.1-r1 && \ + apk add --no-cache libssl3=3.1.1-r1 && \ + apk add --no-cache ca-certificates tini git openssh-client gnupg && \ apk add --no-cache libretls && \ apk add --no-cache busybox