Skip to content

Commit

Permalink
backport of commit 14cb1c8
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkermichael committed Sep 29, 2022
1 parent 7746adc commit 8a1780b
Show file tree
Hide file tree
Showing 145 changed files with 12,664 additions and 11,092 deletions.
47 changes: 22 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ commands:
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
wget https://get.helm.sh/helm-v3.9.4-linux-amd64.tar.gz
tar -zxvf helm-v3.9.4-linux-amd64.tar.gz
wget https://get.helm.sh/helm-v3.7.0-linux-amd64.tar.gz
tar -zxvf helm-v3.7.0-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
create-kind-clusters:
parameters:
Expand Down Expand Up @@ -110,10 +110,9 @@ commands:
do
if ! gotestsum --no-summary=all --jsonfile=jsonfile-${pkg////-} -- $pkg -p 1 -timeout 2h -failfast \
<< parameters.additional-flags >> \
-enable-multi-cluster \
${ENABLE_ENTERPRISE:+-enable-enterprise} \
-enable-multi-cluster \
-debug-directory="$TEST_RESULTS/debug" \
-consul-image=hashicorppreview/consul-enterprise:1.14-dev \
-consul-k8s-image=<< parameters.consul-k8s-image >>
then
echo "Tests in ${pkg} failed, aborting early"
Expand Down Expand Up @@ -486,7 +485,7 @@ jobs:
unit-test-helm-templates:
docker:
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.14.0
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.12.0

steps:
- checkout
Expand Down Expand Up @@ -597,7 +596,7 @@ jobs:
##########################
cleanup-gcp-resources:
docker:
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.14.0
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.12.0
steps:
- run:
name: cleanup leftover resources
Expand All @@ -615,7 +614,7 @@ jobs:

cleanup-azure-resources:
docker:
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.14.0
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.12.0
steps:
- run:
name: cleanup leftover resources
Expand All @@ -633,7 +632,7 @@ jobs:

cleanup-eks-resources:
docker:
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.14.0
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.12.0
steps:
- checkout
- run:
Expand All @@ -658,10 +657,9 @@ jobs:
parallelism: 2
environment:
- TEST_RESULTS: /tmp/test-results
- USE_GKE_GCLOUD_AUTH_PLUGIN: true
docker:
# This image is built from test/docker/Test.dockerfile
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.14.0
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.12.0

steps:
- run:
Expand Down Expand Up @@ -727,10 +725,9 @@ jobs:
parallelism: 2
environment:
- TEST_RESULTS: /tmp/test-results
- USE_GKE_GCLOUD_AUTH_PLUGIN: true
docker:
# This image is built from test/docker/Test.dockerfile
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.14.0
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.12.0

steps:
- run:
Expand Down Expand Up @@ -798,7 +795,7 @@ jobs:
- TEST_RESULTS: /tmp/test-results
docker:
# This image is built from test/docker/Test.dockerfile
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.14.0
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.12.0

steps:
- checkout
Expand Down Expand Up @@ -855,7 +852,7 @@ jobs:
- TEST_RESULTS: /tmp/test-results
docker:
# This image is built from test/docker/Test.dockerfile
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.14.0
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.12.0

steps:
- checkout
Expand Down Expand Up @@ -911,7 +908,7 @@ jobs:
- TEST_RESULTS: /tmp/test-results
docker:
# This image is built from test/docker/Test.dockerfile
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.14.0
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.12.0

steps:
- checkout
Expand Down Expand Up @@ -974,7 +971,7 @@ jobs:
- TEST_RESULTS: /tmp/test-results
docker:
# This image is built from test/docker/Test.dockerfile
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.14.0
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.12.0

steps:
- checkout
Expand Down Expand Up @@ -1037,7 +1034,7 @@ jobs:
parallelism: 1
docker:
# This image is built from test/docker/Test.dockerfile
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.14.0
- image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.12.0

steps:
- checkout
Expand Down Expand Up @@ -1220,14 +1217,14 @@ workflows:
context: consul-ci
requires:
- dev-upload-docker
# - acceptance-tproxy-cni:
# context: consul-ci
# requires:
# - dev-upload-docker
# - acceptance-tproxy:
# context: consul-ci
# requires:
# - dev-upload-docker
- acceptance-tproxy-cni:
context: consul-ci
requires:
- dev-upload-docker
- acceptance-tproxy:
context: consul-ci
requires:
- dev-upload-docker
nightly-acceptance-tests:
triggers:
- schedule:
Expand Down
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
## UNRELEASED

## 0.49.0 (September 29, 2022)

FEATURES:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ func TestExample(t *testing.T) {
}
```

Please see [wan federation tests](acceptance/tests/wan-federation/wan_federation_test.go)
Please see [mesh gateway tests](acceptance/tests/mesh-gateway/mesh_gateway_test.go)
for an example of how to use write a test that uses multiple contexts.

#### Writing Assertions
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ use Consul with Kubernetes, please see the
[Consul and Kubernetes documentation](https://www.consul.io/docs/platform/k8s/index.html).

### Prerequisites
* **Helm 3.6+**
* **Helm 3.2+** (Helm 2 is not supported)
* **Kubernetes 1.21-1.24** - This is the earliest version of Kubernetes tested.
It is possible that this chart works with earlier versions, but it is
untested.
Expand Down
13 changes: 4 additions & 9 deletions acceptance/framework/consul/helm_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ type HelmCluster struct {
// a bootstrap token from a Kubernetes secret stored in the cluster.
ACLToken string

// SkipCheckForPreviousInstallations is a toggle for skipping the check
// if there are any previous installations of this Helm chart in the cluster.
SkipCheckForPreviousInstallations bool

ctx environment.TestContext
helmOptions *helm.Options
releaseName string
Expand Down Expand Up @@ -113,9 +109,7 @@ func (h *HelmCluster) Create(t *testing.T) {
})

// Fail if there are any existing installations of the Helm chart.
if !h.SkipCheckForPreviousInstallations {
helpers.CheckForPriorInstallations(t, h.kubernetesClient, h.helmOptions, "consul-helm", "chart=consul-helm")
}
helpers.CheckForPriorInstallations(t, h.kubernetesClient, h.helmOptions, "consul-helm", "chart=consul-helm")

chartName := config.HelmChartPath
if h.helmOptions.Version != config.HelmChartPath {
Expand Down Expand Up @@ -571,8 +565,9 @@ func configureSCCs(t *testing.T, client kubernetes.Interface, cfg *config.TestCo

func defaultValues() map[string]string {
values := map[string]string{
"global.logLevel": "debug",
"server.replicas": "1",
"server.replicas": "1",
"connectInject.envoyExtraArgs": "--log-level debug",
"connectInject.logLevel": "debug",
// Disable DNS since enabling it changes the policy for the anonymous token,
// which could result in tests passing due to that token having privileges to read services
// (false positive).
Expand Down
47 changes: 25 additions & 22 deletions acceptance/framework/consul/helm_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,41 @@ func TestNewHelmCluster(t *testing.T) {
name: "defaults are used when no helmValues are set",
helmValues: map[string]string{},
want: map[string]string{
"global.image": "test-config-image",
"global.logLevel": "debug",
"server.replicas": "1",
"global.image": "test-config-image",
"server.replicas": "1",
"connectInject.envoyExtraArgs": "--log-level debug",
"connectInject.logLevel": "debug",
"connectInject.transparentProxy.defaultEnabled": "false",
"dns.enabled": "false",
"server.extraConfig": `"{\"log_level\": \"TRACE\"}"`,
"client.extraConfig": `"{\"log_level\": \"TRACE\"}"`,
"dns.enabled": "false",
"server.extraConfig": `"{\"log_level\": \"TRACE\"}"`,
"client.extraConfig": `"{\"log_level\": \"TRACE\"}"`,
},
},
{
name: "when using helmValues, defaults are overridden",
helmValues: map[string]string{
"global.image": "test-image",
"global.logLevel": "debug",
"server.bootstrapExpect": "3",
"server.replicas": "3",
"global.image": "test-image",
"server.bootstrapExpect": "3",
"server.replicas": "3",
"connectInject.envoyExtraArgs": "--foo",
"connectInject.logLevel": "debug",
"connectInject.transparentProxy.defaultEnabled": "true",
"dns.enabled": "true",
"server.extraConfig": `"{\"foo\": \"bar\"}"`,
"client.extraConfig": `"{\"foo\": \"bar\"}"`,
"feature.enabled": "true",
"dns.enabled": "true",
"server.extraConfig": `"{\"foo\": \"bar\"}"`,
"client.extraConfig": `"{\"foo\": \"bar\"}"`,
"feature.enabled": "true",
},
want: map[string]string{
"global.image": "test-image",
"global.logLevel": "debug",
"server.bootstrapExpect": "3",
"server.replicas": "3",
"global.image": "test-image",
"server.bootstrapExpect": "3",
"server.replicas": "3",
"connectInject.envoyExtraArgs": "--foo",
"connectInject.logLevel": "debug",
"connectInject.transparentProxy.defaultEnabled": "true",
"dns.enabled": "true",
"server.extraConfig": `"{\"foo\": \"bar\"}"`,
"client.extraConfig": `"{\"foo\": \"bar\"}"`,
"feature.enabled": "true",
"dns.enabled": "true",
"server.extraConfig": `"{\"foo\": \"bar\"}"`,
"client.extraConfig": `"{\"foo\": \"bar\"}"`,
"feature.enabled": "true",
},
},
}
Expand Down
3 changes: 3 additions & 0 deletions acceptance/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,11 @@ github.com/gruntwork-io/terratest v0.31.2 h1:xvYHA80MUq5kx670dM18HInewOrrQrAN+Xb
github.com/gruntwork-io/terratest v0.31.2/go.mod h1:EEgJie28gX/4AD71IFqgMj6e99KP5mi81hEtzmDjxTo=
github.com/hashicorp/consul-k8s/control-plane v0.0.0-20211207212234-aea9efea5638 h1:z68s6H6O3RjxDmNvou/2/3UBrsJkrMcNzI0IQN5scAM=
github.com/hashicorp/consul-k8s/control-plane v0.0.0-20211207212234-aea9efea5638/go.mod h1:7ZeaiADGbvJDuoWAT8UKj6KCcLsFUk+34OkUGMVtdXg=
github.com/hashicorp/consul/api v1.10.1-0.20220726130109-a6a79d6811df h1:CCh336XUGPaMNqMkzRAeEL0BFin7LhX729xy3IxE5Y4=
github.com/hashicorp/consul/api v1.10.1-0.20220726130109-a6a79d6811df/go.mod h1:bcaw5CSZ7NE9qfOfKCI1xb7ZKjzu/MyvQkCLTfqLqxQ=
github.com/hashicorp/consul/api v1.14.0 h1:Y64GIJ8hYTu+tuGekwO4G4ardXoiCivX9wv1iP/kihk=
github.com/hashicorp/consul/api v1.14.0/go.mod h1:bcaw5CSZ7NE9qfOfKCI1xb7ZKjzu/MyvQkCLTfqLqxQ=
github.com/hashicorp/consul/sdk v0.10.0 h1:rGLEh2AWK4K0KCMvqWAz2EYxQqgciIfMagWZ0nVe5MI=
github.com/hashicorp/consul/sdk v0.10.0/go.mod h1:yPkX5Q6CsxTFMjQQDJwzeNmUUF5NUGGbrDsv9wTb8cw=
github.com/hashicorp/consul/sdk v0.11.0 h1:HRzj8YSCln2yGgCumN5CL8lYlD3gBurnervJRJAZyC4=
github.com/hashicorp/consul/sdk v0.11.0/go.mod h1:yPkX5Q6CsxTFMjQQDJwzeNmUUF5NUGGbrDsv9wTb8cw=
Expand Down
Loading

0 comments on commit 8a1780b

Please sign in to comment.