-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add e2e tests for the remote config updater (#1243)
* Add basic E2E test of kind on EC2 * add minimal dda tests * update gitlab config * update gitlab config * fix gitlab and update docs * build e2e image * use public-images trigger * add image pull secret * fix imgpullsecret syntax * configure ecr creds * use kube provider * fix imagePullSecret transformation * add imagePullSecret to manager deployment.yaml * fix gitlab syntax * disable webhook * use terratest * use unique stack names and refactor * refactor * remove transformation func * fix make command * increase retry * fix img env var, increase retry * fix image edit * increase retry, get pod logs * agent pod logs * debug * remove waituntilpodavailable assertion * add go.work * update image env var * fix go.work version * remove go.work * fix capitlization * Add rc-updater e2e tests Signed-off-by: Momar TOURÉ <momar.toure@datadoghq.com> * changes after review * use patches in kustomize * Update test * add sleep time to allow for the agent to have the time to be deployed * fix bug * fix bug * debug * fix bugs * debug * update kustomization * update after rebase --------- Signed-off-by: Momar TOURÉ <momar.toure@datadoghq.com> Co-authored-by: Fanny Jiang <fanny.jiang@datadoghq.com>
- Loading branch information
1 parent
7984f26
commit 0d97b8a
Showing
12 changed files
with
789 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: manager | ||
namespace: system | ||
labels: | ||
app.kubernetes.io/name: datadog-operator | ||
control-plane: controller-manager | ||
spec: | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: datadog-operator | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: datadog-operator | ||
spec: | ||
containers: | ||
- command: | ||
- /manager | ||
args: | ||
- --enable-leader-election | ||
- --pprof | ||
- --remoteConfigEnabled | ||
image: controller:latest | ||
imagePullPolicy: IfNotPresent | ||
name: manager | ||
env: | ||
- name: DD_API_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: datadog-secret | ||
key: api-key | ||
- name: DD_APP_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: datadog-secret | ||
key: app-key | ||
- name: DD_CLUSTER_NAME | ||
value: rc-updater-e2e-test-cluster | ||
- name: DD_SITE | ||
value: datadoghq.com | ||
resources: | ||
limits: | ||
cpu: 100m | ||
memory: 250Mi | ||
requests: | ||
cpu: 100m | ||
memory: 250Mi | ||
ports: | ||
- name: metrics | ||
containerPort: 8080 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz/ | ||
port: 8081 | ||
periodSeconds: 10 | ||
imagePullSecrets: | ||
- name: registry-credentials | ||
terminationGracePeriodSeconds: 10 | ||
serviceAccountName: controller-manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
apiVersion: datadoghq.com/v2alpha1 | ||
kind: DatadogAgent | ||
metadata: | ||
name: datadog | ||
spec: | ||
features: | ||
clusterChecks: | ||
enabled: true | ||
useClusterChecksRunners: true | ||
liveContainerCollection: | ||
enabled: true | ||
cws: | ||
enabled: false | ||
usm: | ||
enabled: false | ||
cspm: | ||
enabled: false | ||
sbom: | ||
enabled: false | ||
global: | ||
credentials: | ||
apiSecret: | ||
secretName: datadog-secret | ||
keyName: api-key | ||
appSecret: | ||
secretName: datadog-secret | ||
keyName: app-key | ||
clusterName: rc-updater-e2e-test-cluster | ||
site: datadoghq.com | ||
kubelet: | ||
tlsVerify: false | ||
override: | ||
nodeAgent: | ||
labels: | ||
agent.datadoghq.com/e2e-test: datadog-agent-rc | ||
containers: | ||
agent: | ||
env: | ||
- name: DD_SKIP_SSL_VALIDATION | ||
value: "false" | ||
clusterAgent: | ||
labels: | ||
agent.datadoghq.com/e2e-test: datadog-agent-minimum | ||
env: | ||
- name: DD_CLUSTER_NAME | ||
valueFrom: | ||
configMapKeyRef: | ||
name: datadog-cluster-name | ||
key: DD_CLUSTER_NAME | ||
clusterChecksRunner: | ||
labels: | ||
agent.datadoghq.com/e2e-test: datadog-agent-minimum | ||
env: | ||
- name: DD_CLUSTER_NAME | ||
valueFrom: | ||
configMapKeyRef: | ||
name: datadog-cluster-name | ||
key: DD_CLUSTER_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
// Package api provides test helpers to interact with the Datadog API | ||
package api | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"net/http" | ||
|
||
"github.com/DataDog/datadog-api-client-go/v2/api/datadog" | ||
|
||
"github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner" | ||
"github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner/parameters" | ||
) | ||
|
||
// Client represents the datadog API context | ||
type Client struct { | ||
api *datadog.APIClient | ||
ctx context.Context | ||
http http.Client | ||
apiKey string | ||
appKey string | ||
} | ||
|
||
// NewClient initialise a client with the API and APP keys | ||
func NewClient() *Client { | ||
apiKey, _ := runner.GetProfile().SecretStore().Get(parameters.APIKey) | ||
appKey, _ := runner.GetProfile().SecretStore().Get(parameters.APPKey) | ||
ctx := context.WithValue( | ||
context.Background(), | ||
datadog.ContextAPIKeys, | ||
map[string]datadog.APIKey{ | ||
"apiKeyAuth": { | ||
Key: apiKey, | ||
}, | ||
"appKeyAuth": { | ||
Key: appKey, | ||
}, | ||
}, | ||
) | ||
|
||
cfg := datadog.NewConfiguration() | ||
|
||
return &Client{ | ||
api: datadog.NewAPIClient(cfg), | ||
ctx: ctx, | ||
http: http.Client{}, | ||
apiKey: apiKey, | ||
appKey: appKey, | ||
} | ||
} | ||
|
||
// GetAPIKey returns the APIKey | ||
func GetAPIKey() (string, error) { | ||
apiKey, err := runner.GetProfile().SecretStore().Get(parameters.APIKey) | ||
if err != nil { | ||
return "", fmt.Errorf("could not get APIKey") | ||
} | ||
return apiKey, nil | ||
} | ||
|
||
// GetAPPKey returns the APPKey | ||
func GetAPPKey() (string, error) { | ||
appKey, err := runner.GetProfile().SecretStore().Get(parameters.APPKey) | ||
if err != nil { | ||
return "", fmt.Errorf("could not get APPKey") | ||
} | ||
return appKey, nil | ||
} |
Oops, something went wrong.