provider-datadog is a Crossplane provider that
is built using Upjet code
generation tools and exposes XRM-conformant managed resources for the
Datadog API.
The provider serves every resource in two API trees:
*.datadog.upbound.io: the legacy cluster-scoped managed resources, configured through a cluster-scopedProviderConfig.datadog.upbound.io.*.datadog.m.upbound.io: namespaced managed resources for Crossplane v2, configured through a namespacedProviderConfig.datadog.m.upbound.ioor a cluster-scopedClusterProviderConfig.datadog.m.upbound.io. A namespaced resource that omitsspec.providerConfigRefuses theClusterProviderConfignameddefault.
This provider interacts with a
Datadog account. It authenticates
to the account with either a Datadog API key and Application key
pair or a bearer token (a personal access token, ddpat_*, or a
service-account access token), plus the account's API endpoint URL.
The keys can be generated inside the account
and be stored in a Kubernetes secret on the Crossplane
management cluster. The format of the secret is as follows:
{
"api_key": "INSERT_API_KEY",
"app_key": "INSERT_APP_KEY",
"api_url": "https://api.datadoghq.com/"
}
or, with a bearer token instead of the key pair:
{
"bearer_token": "ddpat_INSERT_TOKEN",
"api_url": "https://api.datadoghq.com/"
}
Note that your preferred endpoint may differ. When both are present the bearer token takes precedence over the key pair.
The same document accepts the other arguments of the Terraform provider
block: validate and http_client_retry_enabled (booleans, or the strings
"true"/"false"), the integers http_client_retry_max_retries,
http_client_retry_timeout, http_client_retry_backoff_base,
http_client_retry_backoff_multiplier and http_client_retry_jitter, and
ignore_tag_keys, a JSON array of tag keys whose drift the provider ignores
on Monitors and Service Level Objectives (experimental upstream):
{
"api_key": "INSERT_API_KEY",
"app_key": "INSERT_APP_KEY",
"http_client_retry_jitter": 2,
"ignore_tag_keys": ["team", "env"]
}
Anything left out keeps the Terraform provider's default. The Kubernetes secret can be referenced by the ProviderConfig, so that the provider-datadog can connect to the desired Datadog account. A ProviderConfig for the cluster-scoped resources may look as follows:
apiVersion: datadog.upbound.io/v1beta1
kind: ProviderConfig
metadata:
name: default
spec:
credentials:
source: Secret
secretRef:
name: datadog-creds
namespace: upbound-system
key: credentials
Namespaced resources reference a ClusterProviderConfig by default:
apiVersion: datadog.m.upbound.io/v1beta1
kind: ClusterProviderConfig
metadata:
name: default
spec:
credentials:
source: Secret
secretRef:
name: datadog-creds
namespace: upbound-system
key: credentials
A namespaced ProviderConfig in the namespace of the managed resources works
the same way; its secretRef is always resolved in that namespace. See
examples/namespaced/providerconfig and
examples/cluster/providerconfig.
To run local tests, create a datadog-secret file per above.
Then create an UPTEST_CLOUD_CREDENTIALS environment variable
as follows
export UPTEST_CLOUD_CREDENTIALS=$(cat <PATH-TO-DATADOG-SECRET-FILE> )
Once complete, specify the tests that you would like to run
in the UPTEST_EXAMPLE_LIST environment variable. An example
is as follows:
export UPTEST_EXAMPLE_LIST="./examples/cluster/datadog/v1alpha1/dashboardjson.yaml"
Note that you may specify multiple comma separated tests.
Now run make e2e. This will create a local kind cluster,
install Crossplane and the provider-datadog from a local build
and run Uptests managed resources apply, update, import, delete
tests.
Install the provider by using the following command after changing the image tag to the latest release:
up ctp provider install upbound/provider-datadog:v0.1.0
Alternatively, you can use declarative installation:
cat <<EOF | kubectl apply -f -
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-datadog
spec:
package: upbound/provider-datadog:v0.1.0
EOF
You can see the API reference here.
Run code-generation pipeline:
make clean; make generateRun against a Kubernetes cluster:
make runBuild, push, and install:
make allBuild binary:
make buildFor filing bugs, suggesting improvements, or requesting new features, please open an issue.