Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable nightlies for 1.11 and 1.12 and 1.13 #1339

Merged
merged 5 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,8 @@ 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"
- HELM_CHART_VERSION: "0.47.1"
machine:
image: ubuntu-2004:202010-01
resource_class: xlarge
Expand All @@ -902,21 +903,22 @@ 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:
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"
- HELM_CHART_VERSION: "0.47.1"
- CONSUL_K8S_IMAGE: "docker.mirror.hashicorp.services/hashicorp/consul-k8s-control-plane:0.47.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be the default image or this specific image version?

Copy link
Contributor Author

@kschoche kschoche Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention was to run latest release against nightly builds of previous consul versions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are changes in the helm chart that require a dev image, then these tests will break, right? I think if we wanted to run the release image, we'd need to use a tag of the helm chart to make sure it always works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that makes sense!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a new flag for helm chart version which plumbs into the testConfig.Version param we already had in place, it defaults to the chart-dir.

machine:
image: ubuntu-2004:202010-01
resource_class: xlarge
Expand All @@ -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:
Expand All @@ -952,7 +954,8 @@ 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"
kschoche marked this conversation as resolved.
Show resolved Hide resolved
kschoche marked this conversation as resolved.
Show resolved Hide resolved
- 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"
- HELM_CHART_VERSION: "0.47.1"
machine:
image: ubuntu-2004:202010-01
resource_class: xlarge
Expand All @@ -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:
Expand Down Expand Up @@ -1047,15 +1050,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
ishustava marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 5 additions & 4 deletions acceptance/framework/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions acceptance/framework/consul/helm_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func NewHelmCluster(
KubectlOptions: ctx.KubectlOptions(t),
Logger: logger,
ExtraArgs: extraArgs,
Version: cfg.HelmChartVersion,
curtbushko marked this conversation as resolved.
Show resolved Hide resolved
}
return &HelmCluster{
ctx: ctx,
Expand All @@ -110,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))
}
Expand Down Expand Up @@ -271,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))
}

Expand Down
19 changes: 11 additions & 8 deletions acceptance/framework/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions acceptance/tests/snapshot-agent/snapshot_agent_vault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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()

Expand Down