-
Notifications
You must be signed in to change notification settings - Fork 1k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable datadog chart EKS E2E tests in CI #1320
Changes from 12 commits
29a29da
e7f2b5d
dac4ae5
c583603
b6006db
7311cd6
82a9ab3
09b0988
1f1e47d
8f72cb2
4d881cd
4a4c102
ac54ee2
fd98413
5143e74
76972ab
2bc2778
3b29137
afde959
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
variables: | ||
# Do not modify this - must be the repository name for Kubernetes gitlab runners to run | ||
KUBERNETES_SERVICE_ACCOUNT_OVERWRITE: helm-charts | ||
|
||
stages: | ||
- e2e | ||
|
||
|
@@ -14,22 +10,26 @@ e2e: | |
- charts/**/*.yaml | ||
- test/**/* | ||
compare_to: "refs/heads/main" | ||
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/test-infra-definitions/runner:986d192b | ||
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/test-infra-definitions/runner:95dca87f269a | ||
tags: ["arch:amd64"] | ||
variables: | ||
AWS_KEYPAIR_NAME: datadog-agent-ci | ||
AWS_PRIVATE_KEY_FILE: $CI_PROJECT_DIR/ssh_key | ||
before_script: | ||
# Update awscli v2 | ||
- aws --version | ||
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | ||
- unzip awscliv2.zip | ||
- ./aws/install --update | ||
- aws --version | ||
# Setup AWS Credentials | ||
- mkdir -p ~/.aws | ||
Comment on lines
-20
to
-26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated test-infra-definitions runner image uses newer awscli v2, so we don't need to update the version in the job |
||
- set +x | ||
# Set GITHUB_TOKEN to avoid getting rate-limited when pulumi sdk downloads the kubernetes provider | ||
- export GITHUB_TOKEN=$(aws ssm get-parameter --region us-east-1 --name ci.helm-charts.github_token --with-decryption --query "Parameter.Value" --out text) | ||
# Configure AWS EC2 ssh key needed for create pulumi EKS environment | ||
- aws ssm get-parameter --region us-east-1 --name ci.helm-charts.ssh_key --with-decryption --query "Parameter.Value" --out text > $AWS_PRIVATE_KEY_FILE | ||
- set -x | ||
# Without the newline ssh silently fails and moves on to try other auth methods | ||
- echo "" >> $AWS_PRIVATE_KEY_FILE | ||
- chmod 600 $AWS_PRIVATE_KEY_FILE | ||
# Configure AWS profile | ||
- aws ssm get-parameter --region us-east-1 --name ci.helm-charts.e2e-agent-qa-profile --with-decryption --query "Parameter.Value" --out text >> ~/.aws/config | ||
- set -x | ||
- export AWS_PROFILE=agent-qa-ci | ||
- pulumi login "s3://dd-pulumi-state?region=us-east-1&awssdk=v2&profile=$AWS_PROFILE" | ||
script: | ||
# TODO: enable running E2E tests when upstream pulumi-eks fix is merged https://github.com/pulumi/pulumi-eks/pull/886 | ||
- echo "Success!" | ||
- make test-e2e |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
//go:build e2e | ||
// +build e2e | ||
|
||
package datadog | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/DataDog/datadog-agent/test/new-e2e/runner" | ||
"github.com/DataDog/helm-charts/test/common" | ||
"github.com/pulumi/pulumi/sdk/v3/go/auto" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
v1 "k8s.io/api/core/v1" | ||
"k8s.io/client-go/kubernetes" | ||
"k8s.io/client-go/rest" | ||
|
||
"github.com/DataDog/helm-charts/test/common" | ||
) | ||
|
||
const namespace = "datadog" | ||
|
@@ -30,8 +34,6 @@ func Test_E2E_AgentOnEKS(t *testing.T) { | |
"ddtestworkload:deploy": auto.ConfigValue{Value: "false"}, | ||
"ddinfra:aws/eks/linuxBottlerocketNodeGroup": auto.ConfigValue{Value: "false"}, | ||
"ddinfra:aws/eks/windowsNodeGroup": auto.ConfigValue{Value: "false"}, | ||
// TODO: remove when upstream eks-pulumi bug is fixed https://github.com/pulumi/pulumi-eks/pull/886 | ||
"pulumi:disable-default-providers": auto.ConfigValue{Value: "[]"}, | ||
} | ||
stackConfig.Merge(config) | ||
|
||
|
@@ -48,14 +50,14 @@ func Test_E2E_AgentOnEKS(t *testing.T) { | |
kc := kubeconfig.Value.(map[string]interface{}) | ||
_, restConfig, k8sClient, err = common.NewClientFromKubeconfig(kc) | ||
if err == nil { | ||
verifyPods(t) | ||
t.Run("Agent pods should be created", verifyPods) | ||
} | ||
} else { | ||
err = fmt.Errorf("could not create Kubernetes client, cluster kubeconfig is nil") | ||
} | ||
} | ||
if err != nil { | ||
t.Skipf("Skipping test. Encountered problem creating or updating E2E stack: %s", err) | ||
t.Errorf("Skipping tests. Encountered problem creating or updating E2E stack: %s", err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the job fail if there's an issue creating the E2E environment. |
||
} | ||
} | ||
|
||
|
@@ -79,10 +81,15 @@ func verifyPods(t *testing.T) { | |
RestConfig: restConfig, | ||
} | ||
|
||
assertPodStatus(t, podExec, ddaPodList, "agent") | ||
assertPodStatus(t, podExec, dcaPodList, "cluster-agent") | ||
assertPodStatus(t, podExec, ccPodList, "agent") | ||
|
||
t.Run("exec `agent status` for `agent` pod should not error", func(t *testing.T) { | ||
assertPodStatus(t, podExec, ddaPodList, "agent") | ||
}) | ||
t.Run("`exec `agent status` for `cluster-agent` pod should not error", func(t *testing.T) { | ||
assertPodStatus(t, podExec, dcaPodList, "cluster-agent") | ||
}) | ||
t.Run("exec `agent status` for `cluster-check-runner` pod should not error", func(t *testing.T) { | ||
assertPodStatus(t, podExec, ccPodList, "agent") | ||
}) | ||
} | ||
|
||
func assertPodStatus(t *testing.T, podExec common.K8sExec, podList *v1.PodList, containerName string) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Env variable is no longer used: https://github.com/DataDog/gitlab-runner-cirel/commit/1efc85c1dbf54c63b8635b5fd60e8d9ba1f19167#diff-d3a55eef9d7c1c66fa9d35e0056f568d3ffa20d77709e1483a4729cab4f8ee9dR171-R174