From 0bb0ecc8767fcd8149628b263398e94d7d73d814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20T=C3=BCrken?= Date: Wed, 25 Sep 2024 15:23:39 +0300 Subject: [PATCH 1/3] Fix directory name in Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fatih Türken --- Makefile | 2 +- README.md | 2 +- cluster/images/provider-opentofu/Dockerfile | 4 ++-- internal/controller/{terraform.go => opentofu.go} | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename internal/controller/{terraform.go => opentofu.go} (100%) diff --git a/Makefile b/Makefile index ad5cc5e..a5d00e0 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ GO111MODULE = on # KIND_VERSION = v0.15.0 UP_VERSION = v0.33.0 # UP_CHANNEL = stable -UPTEST_VERSION = v1.1.2 +UPTEST_VERSION = v0.13.1 CROSSPLANE_VERSION = 1.17.1 -include build/makelib/k8s_tools.mk diff --git a/README.md b/README.md index 9682c34..9c5a622 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ configurable using `DeploymentRuntimeConfig`. ## Known limitations: * You must either use remote state or ensure the provider container's `/tf` - directory is not lost. `provider-opentofy` __does not persist state__; + directory is not lost. `provider-opentofu` __does not persist state__; consider using the [Kubernetes](https://opentofu.org/docs/language/settings/backends/kubernetes/) remote state backend. * If the module takes longer than the value of `--timeout` (default is 20m) to apply the underlying `tofu` process will be killed. You will potentially lose state diff --git a/cluster/images/provider-opentofu/Dockerfile b/cluster/images/provider-opentofu/Dockerfile index 32bc504..653ece7 100644 --- a/cluster/images/provider-opentofu/Dockerfile +++ b/cluster/images/provider-opentofu/Dockerfile @@ -5,7 +5,7 @@ ARG TARGETARCH ENV OPENTOFU_VERSION=1.8.2 ENV TF_IN_AUTOMATION=1 -ENV TOFU_PLUGIN_CACHE_DIR=/tf/plugin-cache +ENV TOFU_PLUGIN_CACHE_DIR=/tofu/plugin-cache ADD "bin/${TARGETOS}_${TARGETARCH}/provider" /usr/local/bin/crossplane-opentofu-provider ADD .gitconfig .gitconfig @@ -15,7 +15,7 @@ RUN curl -s -L https://github.com/opentofu/opentofu/releases/download/v${OPENTOF && rm tofu.zip \ && chmod +x /usr/local/bin/tofu \ && mkdir -p ${TOFU_PLUGIN_CACHE_DIR} \ - && chown -R 2000 /tf + && chown -R 2000 /tofu # As of Crossplane v1.3.0 provider controllers run as UID 2000. # https://github.com/crossplane/crossplane/blob/v1.3.0/internal/controller/pkg/revision/deployment.go#L32 diff --git a/internal/controller/terraform.go b/internal/controller/opentofu.go similarity index 100% rename from internal/controller/terraform.go rename to internal/controller/opentofu.go From 8e254ca636bac508396e08bdfa34d40c9a52d555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20T=C3=BCrken?= Date: Wed, 25 Sep 2024 16:29:40 +0300 Subject: [PATCH 2/3] Disable import for workspace-inline-aws MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fatih Türken --- examples/workspace-inline-aws.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/workspace-inline-aws.yaml b/examples/workspace-inline-aws.yaml index 7273486..0dbcd4a 100644 --- a/examples/workspace-inline-aws.yaml +++ b/examples/workspace-inline-aws.yaml @@ -1,6 +1,8 @@ apiVersion: opentofu.upbound.io/v1beta1 kind: Workspace metadata: + annotations: + uptest.upbound.io/disable-import: "true" name: sample-inline spec: providerConfigRef: From a3c8a8b0688b114d642638acfb84ed51402676b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20T=C3=BCrken?= Date: Wed, 25 Sep 2024 17:40:55 +0300 Subject: [PATCH 3/3] Switch chainsaw tool in uptest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fatih Türken --- Makefile | 6 +++--- examples/workspace-inline-aws.yaml | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a5d00e0..76c4741 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ GO111MODULE = on # KIND_VERSION = v0.15.0 UP_VERSION = v0.33.0 # UP_CHANNEL = stable -UPTEST_VERSION = v0.13.1 +UPTEST_VERSION = v1.1.2 CROSSPLANE_VERSION = 1.17.1 -include build/makelib/k8s_tools.mk @@ -112,9 +112,9 @@ CROSSPLANE_NAMESPACE = upbound-system # - UPTEST_EXAMPLE_LIST, a comma-separated list of examples to test # - UPTEST_CLOUD_CREDENTIALS (optional), cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat ~/.aws/credentials) # - UPTEST_DATASOURCE_PATH (optional), see https://github.com/upbound/uptest#injecting-dynamic-values-and-datasource -uptest: $(UPTEST) $(KUBECTL) $(KUTTL) +uptest: $(UPTEST) $(KUBECTL) $(CHAINSAW) $(CROSSPLANE_CLI) @$(INFO) running automated tests - @KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=cluster/test/setup.sh || $(FAIL) + @KUBECTL=$(KUBECTL) CHAINSAW=$(CHAINSAW) CROSSPLANE_CLI=$(CROSSPLANE_CLI) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=cluster/test/setup.sh --skip-import || $(FAIL) @$(OK) running automated tests local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME) diff --git a/examples/workspace-inline-aws.yaml b/examples/workspace-inline-aws.yaml index 0dbcd4a..7273486 100644 --- a/examples/workspace-inline-aws.yaml +++ b/examples/workspace-inline-aws.yaml @@ -1,8 +1,6 @@ apiVersion: opentofu.upbound.io/v1beta1 kind: Workspace metadata: - annotations: - uptest.upbound.io/disable-import: "true" name: sample-inline spec: providerConfigRef: