From da6f9fd2d99063a8b1217cda47bc4d94e349b3dd Mon Sep 17 00:00:00 2001 From: Kyle Schochenmaier Date: Tue, 12 Jul 2022 16:28:41 -0500 Subject: [PATCH 1/5] enable nightlies for 1.11 and 1.12 and 1.13 --- .circleci/config.yml | 32 +++++++++---------- .../snapshot_agent_vault_test.go | 7 ++++ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0ddc7c8302..11b3e04469 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -880,7 +880,7 @@ jobs: - TEST_RESULTS: /tmp/test-results - CONSUL_IMAGE: "docker.mirror.hashicorp.services/hashicorppreview/consul-enterprise:1.11-dev" - ENVOY_IMAGE: "envoyproxy/envoy:v1.20.2" - - CONSUL_K8S_IMAGE: "docker.mirror.hashicorp.services/hashicorp/consul-k8s-control-plane:0.45.0" + - CONSUL_K8S_IMAGE: "docker.mirror.hashicorp.services/hashicorp/consul-k8s-control-plane:0.47.1" machine: image: ubuntu-2004:202010-01 resource_class: xlarge @@ -909,14 +909,14 @@ jobs: path: /tmp/test-results - slack/status: fail_only: true - failure_message: "Acceptance tests against Kind with Kubernetes v1.23 with Consul 1.11.x nightly failed. Check the logs at: ${CIRCLE_BUILD_URL}" + failure_message: "Acceptance tests against Kind with Kubernetes v1.23 with Consul 1.11 nightly failed. Check the logs at: ${CIRCLE_BUILD_URL}" acceptance-kind-1-23-consul-nightly-1-12: environment: - TEST_RESULTS: /tmp/test-results - CONSUL_IMAGE: "docker.mirror.hashicorp.services/hashicorppreview/consul-enterprise:1.12-dev" - ENVOY_IMAGE: "envoyproxy/envoy:v1.22.2" - - CONSUL_K8S_IMAGE: "docker.mirror.hashicorp.services/hashicorp/consul-k8s-control-plane:0.45.0" + - CONSUL_K8S_IMAGE: "docker.mirror.hashicorp.services/hashicorp/consul-k8s-control-plane:0.47.1" machine: image: ubuntu-2004:202010-01 resource_class: xlarge @@ -952,7 +952,7 @@ jobs: - TEST_RESULTS: /tmp/test-results - CONSUL_IMAGE: "docker.mirror.hashicorp.services/hashicorppreview/consul-enterprise:1.13-dev" - ENVOY_IMAGE: "envoyproxy/envoy:v1.22.2" - - CONSUL_K8S_IMAGE: "docker.mirror.hashicorp.services/hashicorp/consul-k8s-control-plane:0.45.0" + - CONSUL_K8S_IMAGE: "docker.mirror.hashicorp.services/hashicorp/consul-k8s-control-plane:0.47.1" machine: image: ubuntu-2004:202010-01 resource_class: xlarge @@ -1047,15 +1047,15 @@ workflows: requires: - dev-upload-docker -# nightly-acceptance-tests-consul: -# triggers: -# - schedule: -# cron: "0 0 * * *" -# filters: -# branches: -# only: -# - main -# jobs: -# - acceptance-kind-1-23-consul-nightly-1-11 -# - acceptance-kind-1-23-consul-nightly-1-12 -# - acceptance-kind-1-23-consul-nightly-1-13 + nightly-acceptance-tests-consul: + triggers: + - schedule: + cron: "0 0 * * *" + filters: + branches: + only: + - main + jobs: + - acceptance-kind-1-23-consul-nightly-1-11 + - acceptance-kind-1-23-consul-nightly-1-12 + - acceptance-kind-1-23-consul-nightly-1-13 diff --git a/acceptance/tests/snapshot-agent/snapshot_agent_vault_test.go b/acceptance/tests/snapshot-agent/snapshot_agent_vault_test.go index bde2d88ab0..a3ede3e984 100644 --- a/acceptance/tests/snapshot-agent/snapshot_agent_vault_test.go +++ b/acceptance/tests/snapshot-agent/snapshot_agent_vault_test.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/consul-k8s/acceptance/framework/logger" "github.com/hashicorp/consul-k8s/acceptance/framework/vault" "github.com/hashicorp/go-uuid" + "github.com/hashicorp/go-version" "github.com/stretchr/testify/require" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -31,6 +32,12 @@ func TestSnapshotAgent_Vault(t *testing.T) { kubectlOptions := ctx.KubectlOptions(t) ns := kubectlOptions.Namespace + ver, err := version.NewVersion("1.12.0") + require.NoError(t, err) + if cfg.ConsulVersion != nil && cfg.ConsulVersion.LessThan(ver) { + t.Skipf("skipping this test because vault secrets backend is not supported in version %v", cfg.ConsulVersion.String()) + } + consulReleaseName := helpers.RandomName() vaultReleaseName := helpers.RandomName() From 815d44b1b652e4d94888e63d0cfef43efd5d34d3 Mon Sep 17 00:00:00 2001 From: Kyle Schochenmaier Date: Mon, 22 Aug 2022 15:46:23 -0500 Subject: [PATCH 2/5] use helm chart version --- .circleci/config.yml | 9 ++++++--- acceptance/framework/config/config.go | 9 +++++---- acceptance/framework/consul/helm_cluster.go | 1 + acceptance/framework/flags/flags.go | 19 +++++++++++-------- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 11b3e04469..e52b29f000 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -881,6 +881,7 @@ jobs: - CONSUL_IMAGE: "docker.mirror.hashicorp.services/hashicorppreview/consul-enterprise:1.11-dev" - ENVOY_IMAGE: "envoyproxy/envoy:v1.20.2" - CONSUL_K8S_IMAGE: "docker.mirror.hashicorp.services/hashicorp/consul-k8s-control-plane:0.47.1" + - HELM_CHART_VERSION: "0.47.1" machine: image: ubuntu-2004:202010-01 resource_class: xlarge @@ -902,7 +903,7 @@ jobs: - ~/.go_workspace/pkg/mod - run: mkdir -p $TEST_RESULTS - run-acceptance-tests: - additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2" -enable-transparent-proxy -consul-k8s-image=$CONSUL_K8S_IMAGE -consul-image=$CONSUL_IMAGE -consul-version="1.11" -envoy-image=$ENVOY_IMAGE + additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2" -enable-transparent-proxy -consul-k8s-image=$CONSUL_K8S_IMAGE -consul-image=$CONSUL_IMAGE -consul-version="1.11" -envoy-image=$ENVOY_IMAGE -helm-chart-version=$HELM_CHART_VERSION - store_test_results: path: /tmp/test-results - store_artifacts: @@ -916,6 +917,7 @@ jobs: - TEST_RESULTS: /tmp/test-results - CONSUL_IMAGE: "docker.mirror.hashicorp.services/hashicorppreview/consul-enterprise:1.12-dev" - ENVOY_IMAGE: "envoyproxy/envoy:v1.22.2" + - HELM_CHART_VERSION: "0.47.1" - CONSUL_K8S_IMAGE: "docker.mirror.hashicorp.services/hashicorp/consul-k8s-control-plane:0.47.1" machine: image: ubuntu-2004:202010-01 @@ -938,7 +940,7 @@ jobs: - ~/.go_workspace/pkg/mod - run: mkdir -p $TEST_RESULTS - run-acceptance-tests: - additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2" -enable-transparent-proxy -consul-k8s-image=$CONSUL_K8S_IMAGE -consul-image=$CONSUL_IMAGE -consul-version="1.12" -envoy-image=$ENVOY_IMAGE + additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2" -enable-transparent-proxy -consul-k8s-image=$CONSUL_K8S_IMAGE -consul-image=$CONSUL_IMAGE -consul-version="1.12" -envoy-image=$ENVOY_IMAGE -helm-chart-version=$HELM_CHART_VERSION - store_test_results: path: /tmp/test-results - store_artifacts: @@ -953,6 +955,7 @@ jobs: - CONSUL_IMAGE: "docker.mirror.hashicorp.services/hashicorppreview/consul-enterprise:1.13-dev" - ENVOY_IMAGE: "envoyproxy/envoy:v1.22.2" - CONSUL_K8S_IMAGE: "docker.mirror.hashicorp.services/hashicorp/consul-k8s-control-plane:0.47.1" + - HELM_CHART_VERSION: "0.47.1" machine: image: ubuntu-2004:202010-01 resource_class: xlarge @@ -974,7 +977,7 @@ jobs: - ~/.go_workspace/pkg/mod - run: mkdir -p $TEST_RESULTS - run-acceptance-tests: - additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2" -enable-transparent-proxy -consul-k8s-image=$CONSUL_K8S_IMAGE -consul-image=$CONSUL_IMAGE -consul-version="1.13" -envoy-image=$ENVOY_IMAGE + additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2" -enable-transparent-proxy -consul-k8s-image=$CONSUL_K8S_IMAGE -consul-image=$CONSUL_IMAGE -consul-version="1.13" -envoy-image=$ENVOY_IMAGE -helm-chart-version=$HELM_CHART_VERSION - store_test_results: path: /tmp/test-results - store_artifacts: diff --git a/acceptance/framework/config/config.go b/acceptance/framework/config/config.go index 62fd094a33..6850839cd9 100644 --- a/acceptance/framework/config/config.go +++ b/acceptance/framework/config/config.go @@ -42,10 +42,11 @@ type TestConfig struct { DisablePeering bool - ConsulImage string - ConsulK8SImage string - ConsulVersion *version.Version - EnvoyImage string + HelmChartVersion string + ConsulImage string + ConsulK8SImage string + ConsulVersion *version.Version + EnvoyImage string NoCleanupOnFailure bool DebugDirectory string diff --git a/acceptance/framework/consul/helm_cluster.go b/acceptance/framework/consul/helm_cluster.go index 085ceda493..e1b52252d5 100644 --- a/acceptance/framework/consul/helm_cluster.go +++ b/acceptance/framework/consul/helm_cluster.go @@ -86,6 +86,7 @@ func NewHelmCluster( KubectlOptions: ctx.KubectlOptions(t), Logger: logger, ExtraArgs: extraArgs, + Version: cfg.HelmChartVersion, } return &HelmCluster{ ctx: ctx, diff --git a/acceptance/framework/flags/flags.go b/acceptance/framework/flags/flags.go index b275bb0904..ac11fc021d 100644 --- a/acceptance/framework/flags/flags.go +++ b/acceptance/framework/flags/flags.go @@ -29,10 +29,11 @@ type TestFlags struct { flagEnableTransparentProxy bool - flagConsulImage string - flagConsulK8sImage string - flagConsulVersion string - flagEnvoyImage string + flagHelmChartVersion string + flagConsulImage string + flagConsulK8sImage string + flagConsulVersion string + flagEnvoyImage string flagNoCleanupOnFailure bool @@ -62,6 +63,7 @@ func (t *TestFlags) init() { flag.StringVar(&t.flagConsulImage, "consul-image", "", "The Consul image to use for all tests.") flag.StringVar(&t.flagConsulK8sImage, "consul-k8s-image", "", "The consul-k8s image to use for all tests.") flag.StringVar(&t.flagConsulVersion, "consul-version", "", "The consul version used for all tests.") + flag.StringVar(&t.flagHelmChartVersion, "helm-chart-version", config.HelmChartPath, "The helm chart used for all tests.") flag.StringVar(&t.flagEnvoyImage, "envoy-image", "", "The Envoy image to use for all tests.") flag.BoolVar(&t.flagEnableMultiCluster, "enable-multi-cluster", false, @@ -146,10 +148,11 @@ func (t *TestFlags) TestConfigFromFlags() *config.TestConfig { DisablePeering: t.flagDisablePeering, - ConsulImage: t.flagConsulImage, - ConsulK8SImage: t.flagConsulK8sImage, - ConsulVersion: consulVersion, - EnvoyImage: t.flagEnvoyImage, + HelmChartVersion: t.flagHelmChartVersion, + ConsulImage: t.flagConsulImage, + ConsulK8SImage: t.flagConsulK8sImage, + ConsulVersion: consulVersion, + EnvoyImage: t.flagEnvoyImage, NoCleanupOnFailure: t.flagNoCleanupOnFailure, DebugDirectory: tempDir, From 072c655f9df7b456761a6bc3009ea761b52c851e Mon Sep 17 00:00:00 2001 From: Kyle Schochenmaier Date: Tue, 23 Aug 2022 11:43:32 -0500 Subject: [PATCH 3/5] test --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e52b29f000..a1c906e7f8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -506,7 +506,7 @@ jobs: - run: mkdir -p $TEST_RESULTS - run-acceptance-tests: failfast: true - additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2" + additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2" -helm-chart-version="0.47.1" - store_test_results: path: /tmp/test-results - store_artifacts: From 2650669b205dee06c6d7ec7a0db49778713d93c0 Mon Sep 17 00:00:00 2001 From: Kyle Schochenmaier Date: Tue, 23 Aug 2022 13:23:15 -0500 Subject: [PATCH 4/5] fix a bug in how we used chart version --- acceptance/framework/consul/helm_cluster.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/acceptance/framework/consul/helm_cluster.go b/acceptance/framework/consul/helm_cluster.go index e1b52252d5..70e7d51502 100644 --- a/acceptance/framework/consul/helm_cluster.go +++ b/acceptance/framework/consul/helm_cluster.go @@ -111,7 +111,11 @@ func (h *HelmCluster) Create(t *testing.T) { // Fail if there are any existing installations of the Helm chart. helpers.CheckForPriorInstallations(t, h.kubernetesClient, h.helmOptions, "consul-helm", "chart=consul-helm") - helm.Install(t, h.helmOptions, config.HelmChartPath, h.releaseName) + chartName := "hashicorp/consul" + if h.helmOptions.Version == config.HelmChartPath { + chartName = config.HelmChartPath + } + helm.Install(t, h.helmOptions, chartName, h.releaseName) k8s.WaitForAllPodsToBeReady(t, h.kubernetesClient, h.helmOptions.KubectlOptions.Namespace, fmt.Sprintf("release=%s", h.releaseName)) } @@ -272,7 +276,11 @@ func (h *HelmCluster) Upgrade(t *testing.T, helmValues map[string]string) { t.Helper() helpers.MergeMaps(h.helmOptions.SetValues, helmValues) - helm.Upgrade(t, h.helmOptions, config.HelmChartPath, h.releaseName) + chartName := "hashicorp/consul" + if h.helmOptions.Version == config.HelmChartPath { + chartName = config.HelmChartPath + } + helm.Upgrade(t, h.helmOptions, chartName, h.releaseName) k8s.WaitForAllPodsToBeReady(t, h.kubernetesClient, h.helmOptions.KubectlOptions.Namespace, fmt.Sprintf("release=%s", h.releaseName)) } From 21a741c8b99d6cae87f22473457deabba87d90c9 Mon Sep 17 00:00:00 2001 From: Kyle Schochenmaier Date: Tue, 23 Aug 2022 13:58:45 -0500 Subject: [PATCH 5/5] remove test code --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a1c906e7f8..e52b29f000 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -506,7 +506,7 @@ jobs: - run: mkdir -p $TEST_RESULTS - run-acceptance-tests: failfast: true - additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2" -helm-chart-version="0.47.1" + additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2" - store_test_results: path: /tmp/test-results - store_artifacts: