Skip to content

Commit

Permalink
Implemented initial provider functionality
Browse files Browse the repository at this point in the history
Implemented initial provider functionality

Update e2e.yaml

rev up to go 1.21.

Update e2e.yaml

standard credentials approach

configured Makefile

added ProviderConfig

added first external name configuration

added first custom configuration

added custom resource configurations

shortened crds for powrpack and dashboard widgets

Implemented initial provider functionality

Update e2e.yaml

rev up to go 1.21.

Update e2e.yaml

standard credentials approach

configured Makefile

added ProviderConfig

added first external name configuration

added first custom configuration

added custom resource configurations

shortened crds for powrpack and dashboard widgets

successful dashboard and other resource creation

updated .gitignore

upgraded to upjet v1.2.0

tested and marked examples

update Makefile

fix for creating teams

added CROSSPLANE_NAMESPACE for uptest

refactored API

added external name id injection for api and app keys

tested and resolved resource CRUD issues

added webhook example

added API version to examples

configured and tested examples

configured and tested pagerduty integration

changed temporary ext name id to number string to resolve dashboardlist resource creation limitation

added custom external name handling for SA app key

updated github workflows

added authn mapping

moved webhook and pagerduty secret yaml to examples

simplified e2e setup

removed toolchain go1.21.4 from go.mod

added DD secret refs to ci.yml

resolved linter items

added DATADOG keys to e2e.yml workflow

reverted e2e go version to 1.20

shortened examples uptest list until github actions config has been end to end tested

added Uptest creds

=> go 1.21

GO and GOLANGCI version update in Makefile

uptest examples list update

added r.SchemaElementOptions.SetEmbeddedObject for single layer nested compositions

updated .gitignore

moved TF provider-datadog to v3.37.0

Implemented initial provider functionality

Pinned TF to 1.5.5

added go 1.21

standard credentials approach

updated setup.sh

removed and ignoring kubeconfig

removed not needed files

reverted backport

removed backport form commands.yml. it is in backport.yml

updated spans_metric

updated downtime_schedule

tested and updated AWS integration examples
  • Loading branch information
humoflife committed Mar 1, 2024
1 parent 509a428 commit f129080
Show file tree
Hide file tree
Showing 541 changed files with 199,488 additions and 753 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ on:
# See also commands.yml for the /backport triggered variant of this workflow.

jobs:
backport:
uses: upbound/uptest/.github/workflows/provider-backport.yml@main
- backport:
- uses: upbound/uptest/.github/workflows/provider-backport.yml@main
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ on:

env:
# Common versions
GO_VERSION: '1.19'
GOLANGCI_VERSION: 'v1.50.0'
DOCKER_BUILDX_VERSION: 'v0.8.2'
GO_VERSION: '1.21.2'
GOLANGCI_VERSION: 'v1.54.2'
DOCKER_BUILDX_VERSION: 'v0.10.0'

# Common users. We can't run a step 'if secrets.XXX != ""' but we can run a
# step 'if env.XXX != ""', so we copy these to succinctly test whether
# credentials have been provided before trying to run steps that need them.
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY }}
UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}

jobs:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
jobs:
e2e:
uses: upbound/uptest/.github/workflows/pr-comment-trigger.yml@main
with:
go-version: '1.21'
secrets:
UPTEST_CLOUD_CREDENTIALS: ${{ secrets.UPTEST_CLOUD_CREDENTIALS }}
UPTEST_DATASOURCE: ${{ secrets.UPTEST_DATASOURCE }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
kubeconfig

/.cache
/.work
/_output
Expand All @@ -9,3 +11,5 @@ cover.out
# ignore IDE folders
.vscode/
.idea/

terraform/
52 changes: 37 additions & 15 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
run:
deadline: 10m
timeout: 10m

skip-files:
- "zz_\\..+\\.go$"
- "zz_generated\\..+\\.go$"

output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
Expand All @@ -27,22 +27,20 @@ linters-settings:
# report about shadowed variables
check-shadowing: false

golint:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8

gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true

goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/upbound/upjet-provider-template
# gci:
# custom-order: true
# sections:
# - standard
# - default
# - prefix(github.com/upbound/provider-datadog)

gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10
min-complexity: 20

maligned:
# print struct with more effective memory layout or not, false by default
Expand Down Expand Up @@ -102,21 +100,40 @@ linters-settings:
rangeValCopy:
sizeThreshold: 32

nolintlint:
require-explanation: false
require-specific: true

revive:
rules:
- name: package-comments
disabled: true


linters:
enable:
- megacheck
- govet
- gocyclo
- gocritic
- interfacer
- goconst
- goimports
# - gci
- gofmt # We enable this as well as goimports for its simplify mode.
- prealloc
- golint
- revive
- unconvert
- misspell
- nakedret
- nolintlint

disable:
# These linters are all deprecated as of golangci-lint v1.49.0. We disable
# them explicitly to avoid the linter logging deprecation warnings.
- deadcode
- varcheck
- scopelint
- structcheck
- interfacer

presets:
- bugs
Expand All @@ -136,7 +153,7 @@ issues:
- gosec
- scopelint
- unparam

# Ease some gocritic warnings on test files.
- path: _test\.go
text: "(unnamedResult|exitAfterDefer)"
Expand Down Expand Up @@ -174,6 +191,11 @@ issues:
- gosec
- gas

# Some k8s dependencies do not have JSON tags on all fields in structs.
- path: k8s.io/
linters:
- musttag

# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [YEAR] Upbound Inc. All rights reserved.
Copyright 2024 Upbound Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
45 changes: 29 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# ====================================================================================
# Setup Project

PROJECT_NAME ?= upjet-provider-template
PROJECT_NAME ?= provider-datadog
PROJECT_REPO ?= github.com/upbound/$(PROJECT_NAME)

export TERRAFORM_VERSION ?= 1.2.1
export TERRAFORM_VERSION ?= 1.5.5

export TERRAFORM_PROVIDER_SOURCE ?= hashicorp/null
export TERRAFORM_PROVIDER_REPO ?= https://github.com/hashicorp/terraform-provider-null
export TERRAFORM_PROVIDER_VERSION ?= 3.1.0
export TERRAFORM_PROVIDER_DOWNLOAD_NAME ?= terraform-provider-null
export TERRAFORM_PROVIDER_SOURCE ?= DataDog/datadog
export TERRAFORM_PROVIDER_REPO ?= https://github.com/DataDog/terraform-provider-datadog
export TERRAFORM_PROVIDER_VERSION ?= 3.37.0
export TERRAFORM_PROVIDER_DOWNLOAD_NAME ?= terraform-provider-datadog
export TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX ?= https://releases.hashicorp.com/$(TERRAFORM_PROVIDER_DOWNLOAD_NAME)/$(TERRAFORM_PROVIDER_VERSION)
export TERRAFORM_NATIVE_PROVIDER_BINARY ?= terraform-provider-null_v3.1.0_x5
export TERRAFORM_NATIVE_PROVIDER_BINARY ?= terraform-provider-datadog_v3.37.0
export TERRAFORM_DOCS_PATH ?= docs/resources


PLATFORMS ?= linux_amd64 linux_arm64

# -include will silently skip missing files, which allows us
Expand All @@ -40,8 +39,8 @@ NPROCS ?= 1
# to half the number of CPU cores.
GO_TEST_PARALLEL := $(shell echo $$(( $(NPROCS) / 2 )))

GO_REQUIRED_VERSION ?= 1.19
GOLANGCILINT_VERSION ?= 1.50.0
GO_REQUIRED_VERSION ?= 1.21.2
GOLANGCILINT_VERSION ?= 1.54.2
GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider $(GO_PROJECT)/cmd/generator
GO_LDFLAGS += -X $(GO_PROJECT)/internal/version.Version=$(VERSION)
GO_SUBDIRS += cmd internal apis
Expand All @@ -50,10 +49,10 @@ GO_SUBDIRS += cmd internal apis
# ====================================================================================
# Setup Kubernetes tools

KIND_VERSION = v0.15.0
UP_VERSION = v0.18.0
KIND_VERSION = v0.20.0
UP_VERSION = v0.22.1
UP_CHANNEL = stable
UPTEST_VERSION = v0.5.0
UPTEST_VERSION = v0.10.0
-include build/makelib/k8s_tools.mk

# ====================================================================================
Expand Down Expand Up @@ -89,7 +88,7 @@ fallthrough: submodules

# NOTE(hasheddan): we force image building to happen prior to xpkg build so that
# we ensure image is present in daemon.
xpkg.build.upjet-provider-template: do.build.images
xpkg.build.provider-datadog: do.build.images

# NOTE(hasheddan): we ensure up is installed prior to running platform-specific
# build steps in parallel to avoid encountering an installation race condition.
Expand Down Expand Up @@ -166,10 +165,20 @@ CROSSPLANE_NAMESPACE = upbound-system
-include build/makelib/local.xpkg.mk
-include build/makelib/controlplane.mk

V="v1alpha1"
EG_DIR="./examples/"
EG_DD_DIR="${EG_DIR}/datadog/${V}"
EG_LOGS_DIR="${EG_DIR}/logs/${V}"
EG_METRIC_DIR="${EG_DIR}/metric/${V}"
EG_SDS_DIR="${EG_DIR}/sensitivedatascanner/${V}"
EG_SYN_DIR="${EG_DIR}/synthetics/${V}"
# UPTEST_EXAMPLE_LIST="${EG_DD_DIR}/dashboardjson.yaml,${EG_DD_DIR}/monitorconfigpolicy.yaml,${EG_DD_DIR}/monitorjson.yaml,${EG_DD_DIR}/monitor.yaml,${EG_DD_DIR}/powerpack.yaml,${EG_DD_DIR}/role.yaml,${EG_DD_DIR}/team.yaml,${EG_DD_DIR}/user.yaml,${EG_DD_DIR}/webhook.yaml,${EG_LOGS_DIR}/metric.yaml,${EG_METRIC_DIR}/metadata.yaml,${EG_SDS_DIR}/group.yaml,${EG_SYN_DIR}/concurrencycap.yaml,${EG_SYN_DIR}/globalvariable.yaml,${EG_SYN_DIR}/privatelocation.yaml"
UPTEST_EXAMPLE_LIST="${EG_DD_DIR}/dashboardjson.yaml"

# This target requires the following environment variables to be set:
# - UPTEST_EXAMPLE_LIST, a comma-separated list of examples to test
# To ensure the proper functioning of the end-to-end test resource pre-deletion hook, it is crucial to arrange your resources appropriately.
# You can check the basic implementation here: https://github.com/upbound/uptest/blob/main/internal/templates/01-delete.yaml.tmpl.
# You can check the basic implementation here: https://github.com/upbound/uptest/blob/main/internal/datadogs/01-delete.yaml.tmpl.
# - UPTEST_CLOUD_CREDENTIALS (optional), multiple sets of AWS IAM User credentials specified as key=value pairs.
# The support keys are currently `DEFAULT` and `PEER`. So, an example for the value of this env. variable is:
# DEFAULT='[default]
Expand All @@ -182,7 +191,7 @@ CROSSPLANE_NAMESPACE = upbound-system
# - UPTEST_DATASOURCE_PATH (optional), see https://github.com/upbound/uptest#injecting-dynamic-values-and-datasource
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
@$(INFO) running automated tests
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=cluster/test/setup.sh --default-conditions="Test" || $(FAIL)
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=cluster/test/setup.sh --default-conditions="Test" || $(FAIL)
@$(OK) running automated tests

local-deploy: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME)
Expand Down Expand Up @@ -236,6 +245,10 @@ endef
# binary will try to use CROSSPLANE_HELP if it is set, and this is for something different.
export CROSSPLANE_MAKE_HELP

gen-clean:
@find . -name "zz_*.go"|xargs rm
@rm -rf ./examples-generated/*

crossplane.help:
@echo "$$CROSSPLANE_MAKE_HELP"

Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Provider Template
# Provider Datadog

`upjet-provider-template` is a [Crossplane](https://crossplane.io/) provider that
`provider-datadog` is a [Crossplane](https://crossplane.io/) provider that
is built using [Upjet](https://github.com/crossplane/upjet) code
generation tools and exposes XRM-conformant managed resources for the
Template API.
Datadog API.

## Getting Started

Install the provider by using the following command after changing the image tag
to the [latest release](https://marketplace.upbound.io/providers/upbound/upjet-provider-template):
to the [latest release](https://marketplace.upbound.io/providers/upbound/provider-datadog):
```
up ctp provider install upbound/upjet-provider-template:v0.1.0
up ctp provider install upbound/provider-datadog:v0.1.0
```

Alternatively, you can use declarative installation:
Expand All @@ -19,15 +19,15 @@ cat <<EOF | kubectl apply -f -
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: upjet-provider-template
name: provider-datadog
spec:
package: upbound/upjet-provider-template:v0.1.0
package: upbound/provider-datadog:v0.1.0
EOF
```

Notice that in this example Provider resource is referencing ControllerConfig with debug enabled.

You can see the API reference [here](https://doc.crds.dev/github.com/upbound/upjet-provider-template).
You can see the API reference [here](https://doc.crds.dev/github.com/upbound/provider-datadog).

## Developing

Expand Down Expand Up @@ -57,4 +57,4 @@ make build
## Report a Bug

For filing bugs, suggesting improvements, or requesting new features, please
open an [issue](https://github.com/upbound/upjet-provider-template/issues).
open an [issue](https://github.com/upbound/provider-datadog/issues).
17 changes: 17 additions & 0 deletions apis/apm/v1alpha1/zz_generated.conversion_hubs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f129080

Please sign in to comment.