diff --git a/Makefile b/Makefile index 078771ebe..c3405bf7d 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,8 @@ export TERRAFORM_DOCS_PATH ?= website/docs/r PLATFORMS ?= linux_amd64 linux_arm64 +export PROJECT_NAME := $(PROJECT_NAME) + # -include will silently skip missing files, which allows us # to load those files with a target in the Makefile. If only # "include" was used, the make command would fail and refuse @@ -43,19 +45,39 @@ export GOPRIVATE = github.com/upbound/* GO_REQUIRED_VERSION ?= 1.19 GOLANGCILINT_VERSION ?= 1.50.0 -GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider $(GO_PROJECT)/cmd/generator +SUBPACKAGES ?= $(shell find cmd/provider -type d -depth 1 | cut -d/ -f3) +GO_STATIC_PACKAGES ?= $(GO_PROJECT)/cmd/generator ${SUBPACKAGES:%=$(GO_PROJECT)/cmd/provider/%} GO_LDFLAGS += -X $(GO_PROJECT)/internal/version.Version=$(VERSION) GO_SUBDIRS += cmd internal apis GO111MODULE = on + +export SUBPACKAGES := $(SUBPACKAGES) + -include build/makelib/golang.mk +# ==================================================================================== +# Setup XPKG + +XPKG_REG_ORGS ?= xpkg.upbound.io/upbound +# NOTE(hasheddan): skip promoting on xpkg.upbound.io as channel tags are +# inferred. +XPKG_REG_ORGS_NO_PROMOTE ?= xpkg.upbound.io/upbound + +export XPKG_REG_ORGS := $(XPKG_REG_ORGS) +export XPKG_REG_ORGS_NO_PROMOTE := $(XPKG_REG_ORGS_NO_PROMOTE) + # ==================================================================================== # Setup Kubernetes tools KIND_VERSION = v0.15.0 +UPTEST_VERSION = v0.5.0 +# dependency for up UP_VERSION = v0.16.1 UP_CHANNEL = stable -UPTEST_VERSION = v0.5.0 + +export UP_VERSION := $(UP_VERSION) +export UP_CHANNEL := $(UP_CHANNEL) + -include build/makelib/k8s_tools.mk # ==================================================================================== @@ -65,20 +87,6 @@ REGISTRY_ORGS ?= xpkg.upbound.io/upbound IMAGES = provider-gcp -include build/makelib/imagelight.mk -# ==================================================================================== -# Setup XPKG - -XPKG_REG_ORGS ?= xpkg.upbound.io/upbound -# NOTE(hasheddan): skip promoting on xpkg.upbound.io as channel tags are -# inferred. -XPKG_REG_ORGS_NO_PROMOTE ?= xpkg.upbound.io/upbound -XPKGS = provider-gcp --include build/makelib/xpkg.mk - -# NOTE(hasheddan): we force image building to happen prior to xpkg build so that -# we ensure image is present in daemon. -xpkg.build.provider-gcp: do.build.images - # ==================================================================================== # Targets diff --git a/apis/generate.go b/apis/generate.go index af83e9349..0d5523731 100644 --- a/apis/generate.go +++ b/apis/generate.go @@ -29,6 +29,8 @@ limitations under the License. //go:generate bash -c "find ../internal/controller -iname 'zz_*' -delete" //go:generate bash -c "find ../internal/controller -type d -empty -delete" //go:generate rm -rf ../examples-generated +//go:generate bash -c "find ../cmd/provider -name 'zz_*' -type f -delete" +//go:generate bash -c "find ../cmd/provider -type d -depth 1 -empty -delete" // Scrape metadata from Terraform registry //go:generate go run github.com/upbound/upjet/cmd/scraper -n hashicorp/terraform-provider-google -r ../.work/terraform-provider-google/website/docs/r -o ../config/provider-metadata.yaml --prelude-xpath "//text()[contains(., \"subcategory\")]" --resource-prefix google diff --git a/cluster/images/provider-gcp/Dockerfile b/cluster/images/provider-gcp/Dockerfile index be470cd1d..5763c88ee 100644 --- a/cluster/images/provider-gcp/Dockerfile +++ b/cluster/images/provider-gcp/Dockerfile @@ -3,6 +3,7 @@ RUN apk --no-cache add ca-certificates bash ARG TARGETOS ARG TARGETARCH +ARG APIGROUP ENV USER_ID=65532 @@ -47,6 +48,6 @@ ENV TERRAFORM_NATIVE_PROVIDER_PATH ${PLUGIN_DIR}/${TERRAFORM_PROVIDER_DOWNLOAD_N USER ${USER_ID} EXPOSE 8080 -ADD "bin/${TARGETOS}_${TARGETARCH}/provider" /usr/local/bin/provider +ADD "bin/${TARGETOS}_${TARGETARCH}/${APIGROUP}" /usr/local/bin/provider ENTRYPOINT ["provider"] diff --git a/cluster/images/provider-gcp/Makefile b/cluster/images/provider-gcp/Makefile index cad426538..fdd282a9b 100755 --- a/cluster/images/provider-gcp/Makefile +++ b/cluster/images/provider-gcp/Makefile @@ -8,23 +8,57 @@ include ../../../build/makelib/common.mk include ../../../build/makelib/imagelight.mk +# ==================================================================================== +# XPKG + +-include ../../../build/makelib/xpkg.mk + +-include ../../../build/makelib/k8s_tools.mk + # ==================================================================================== # Targets img.build: - @$(INFO) docker build $(IMAGE) - @$(MAKE) BUILD_ARGS="--load" img.build.shared - @$(OK) docker build $(IMAGE) + @$(INFO) Subpackages to build: $(SUBPACKAGES) + @for g in $(SUBPACKAGES); do \ + IMAGE=$$(echo $(IMAGE) | sed -r "s/(.*)-/\1-$${g}-/"); \ + $(INFO) Building image $${IMAGE}; \ + $(MAKE) BUILD_ARGS="--load" IMAGE=$${IMAGE} APIGROUP=$${g} XPKG_REG_ORGS=$(XPKG_REG_ORGS) img.build.shared; \ + $(OK) docker build $${IMAGE}; \ + done -img.publish: - @$(INFO) Skipping image publish for $(IMAGE) - @echo Publish is deferred to xpkg machinery - @$(OK) Image publish skipped for $(IMAGE) +# make BRANCH_NAME=main SUBPACKAGES=cloudplatform publish +img.publish: $(UP) + @$(INFO) Subpackages to publish: $(SUBPACKAGES) + @for g in $(SUBPACKAGES); do \ + PACKAGE=$(XPKG_REG_ORGS)/$(PROJECT_NAME)-$${g}:$(VERSION); \ + if [[ $${g} == "monolith" ]]; then PACKAGE=$(XPKG_REG_ORGS)/$(PROJECT_NAME):$(VERSION); fi; \ + $(INFO) Pushing package $${PACKAGE}; \ + $(UP) xpkg push $${PACKAGE} \ + $(foreach p,$(XPKG_LINUX_PLATFORMS),--package $(XPKG_OUTPUT_DIR)/$(p)/$(PROJECT_NAME)-$${g}-$(VERSION).xpkg ) || $(FAIL); \ + $(OK) Done processing $${PACKAGE}. Moving to the next package...; \ + done || $(FAIL) -img.build.shared: +img.build.shared: $(UP) + @mkdir -p $(IMAGE_TEMP_DIR)/package/crds || $(FAIL) + @mkdir $(IMAGE_TEMP_DIR)/examples || $(FAIL) + @if [[ $(APIGROUP) == "config" ]]; then \ + sed -E "s/{{ APIGROUP }}/$(APIGROUP)/g" $(ROOT_DIR)/package/crossplane-config.yaml > $(IMAGE_TEMP_DIR)/package/crossplane.yaml && \ + cp $(ROOT_DIR)/package/crds/gcp.* $(IMAGE_TEMP_DIR)/package/crds/ && \ + cp -r $(ROOT_DIR)/examples/gcp $(IMAGE_TEMP_DIR)/examples/; \ + elif [[ $(APIGROUP) == "monolith" ]]; then \ + cp $(ROOT_DIR)/package/crossplane-monolith.yaml $(IMAGE_TEMP_DIR)/package/crossplane.yaml && \ + cp -r $(ROOT_DIR)/package/crds $(IMAGE_TEMP_DIR)/package/ && \ + cp -r $(ROOT_DIR)/examples $(IMAGE_TEMP_DIR)/; \ + else \ + sed -E "s|{{ APIGROUP }}|$(APIGROUP)|g" $(ROOT_DIR)/package/crossplane.yaml | sed -E "s|{{ XPKG_REG_ORGS }}|$(XPKG_REG_ORGS)|g" | sed -E "s|{{ VERSION }}|$(VERSION)|g" > $(IMAGE_TEMP_DIR)/package/crossplane.yaml && \ + cp $(ROOT_DIR)/package/crds/$(APIGROUP).* $(IMAGE_TEMP_DIR)/package/crds/ && \ + cp -r $(ROOT_DIR)/examples/$(APIGROUP) $(IMAGE_TEMP_DIR)/examples/; \ + fi || $(FAIL) @cp Dockerfile $(IMAGE_TEMP_DIR) || $(FAIL) @cp terraformrc.hcl $(IMAGE_TEMP_DIR) || $(FAIL) - @cp -r $(OUTPUT_DIR)/bin/ $(IMAGE_TEMP_DIR)/bin || $(FAIL) + @mkdir -p $(IMAGE_TEMP_DIR)/bin/$(PLATFORM)/ || $(FAIL) + @cp -r $(OUTPUT_DIR)/bin/$(PLATFORM)/$(APIGROUP) $(IMAGE_TEMP_DIR)/bin/$(PLATFORM)/ || $(FAIL) @docker buildx build $(BUILD_ARGS) \ --platform $(IMAGE_PLATFORMS) \ --build-arg TERRAFORM_VERSION=$(TERRAFORM_VERSION) \ @@ -33,8 +67,12 @@ img.build.shared: --build-arg TERRAFORM_PROVIDER_DOWNLOAD_NAME=$(TERRAFORM_PROVIDER_DOWNLOAD_NAME) \ --build-arg TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX=$(TERRAFORM_PROVIDER_DOWNLOAD_URL_PREFIX) \ --build-arg CROSSPLANE_PROVIDER_VERSION=$(VERSION) \ + --build-arg APIGROUP=$(APIGROUP) \ -t $(IMAGE) \ $(IMAGE_TEMP_DIR) || $(FAIL) + @$(MAKE) UP=$(UP) XPKG_REG_ORGS=$(XPKG_REG_ORGS) XPKG_REG_ORGS_NO_PROMOTE=$(XPKG_REG_ORGS_NO_PROMOTE) XPKGS=$(PROJECT_NAME)-$(APIGROUP) XPKG_DIR=$(IMAGE_TEMP_DIR)/package XPKG_EXAMPLES_DIR=$(IMAGE_TEMP_DIR)/examples build.xpkg || $(FAIL) + +build.xpkg: do.build.xpkgs img.promote: @$(INFO) Skipping image promotion from $(FROM_IMAGE) to $(TO_IMAGE) diff --git a/cmd/generator/main.go b/cmd/generator/main.go index b10065105..f970c5452 100644 --- a/cmd/generator/main.go +++ b/cmd/generator/main.go @@ -45,7 +45,9 @@ func main() { p := config.GetProvider() dumpGeneratedResourceList(p, generatedResourceList) dumpSkippedResourcesCSV(p, skippedResourcesCSV) + // removeCrossResourceReferences(p) pipeline.Run(p, absRootDir) + //partitionProvider(p, absRootDir) } func dumpGeneratedResourceList(p *ujconfig.Provider, targetPath *string) { @@ -77,3 +79,26 @@ func dumpSkippedResourcesCSV(p *ujconfig.Provider, targetPath *string) { panic(fmt.Sprintf("Cannot write skipped resources CSV to file %s: %s", *targetPath, err.Error())) } } + +func removeCrossResourceReferences(p *ujconfig.Provider) { + // Remove cross-resource references from the provider config. + for k := range p.Resources { + p.Resources[k].References = nil + } +} + +// partition the Provider across the API groups +func partitionProvider(p *ujconfig.Provider, absRootDir string) { + partitions := make(map[string]*ujconfig.Provider) + for k, r := range p.Resources { + if partitions[r.ShortGroup] == nil { + p := *p + partitions[r.ShortGroup] = &p + partitions[r.ShortGroup].Resources = make(map[string]*ujconfig.Resource) + } + partitions[r.ShortGroup].Resources[k] = r + } + for g, p := range partitions { + pipeline.Run(p, filepath.Join(absRootDir, g)) + } +} diff --git a/cmd/provider/activedirectory/zz_main.go b/cmd/provider/activedirectory/zz_main.go new file mode 100644 index 000000000..465d5f1ad --- /dev/null +++ b/cmd/provider/activedirectory/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_activedirectory(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/apigee/zz_main.go b/cmd/provider/apigee/zz_main.go new file mode 100644 index 000000000..f2479f5be --- /dev/null +++ b/cmd/provider/apigee/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_apigee(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/appengine/zz_main.go b/cmd/provider/appengine/zz_main.go new file mode 100644 index 000000000..5b3bb1e52 --- /dev/null +++ b/cmd/provider/appengine/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_appengine(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/artifact/zz_main.go b/cmd/provider/artifact/zz_main.go new file mode 100644 index 000000000..5ca79b50e --- /dev/null +++ b/cmd/provider/artifact/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_artifact(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/beyondcorp/zz_main.go b/cmd/provider/beyondcorp/zz_main.go new file mode 100644 index 000000000..2f95c6ff0 --- /dev/null +++ b/cmd/provider/beyondcorp/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_beyondcorp(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/bigquery/zz_main.go b/cmd/provider/bigquery/zz_main.go new file mode 100644 index 000000000..f8784db95 --- /dev/null +++ b/cmd/provider/bigquery/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_bigquery(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/bigtable/zz_main.go b/cmd/provider/bigtable/zz_main.go new file mode 100644 index 000000000..74b449f42 --- /dev/null +++ b/cmd/provider/bigtable/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_bigtable(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/binaryauthorization/zz_main.go b/cmd/provider/binaryauthorization/zz_main.go new file mode 100644 index 000000000..41901bd57 --- /dev/null +++ b/cmd/provider/binaryauthorization/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_binaryauthorization(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/certificatemanager/zz_main.go b/cmd/provider/certificatemanager/zz_main.go new file mode 100644 index 000000000..4be4638af --- /dev/null +++ b/cmd/provider/certificatemanager/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_certificatemanager(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/cloud/zz_main.go b/cmd/provider/cloud/zz_main.go new file mode 100644 index 000000000..5607f46b6 --- /dev/null +++ b/cmd/provider/cloud/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_cloud(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/cloudbuild/zz_main.go b/cmd/provider/cloudbuild/zz_main.go new file mode 100644 index 000000000..3b3c0a764 --- /dev/null +++ b/cmd/provider/cloudbuild/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_cloudbuild(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/cloudfunctions/zz_main.go b/cmd/provider/cloudfunctions/zz_main.go new file mode 100644 index 000000000..d7576d50e --- /dev/null +++ b/cmd/provider/cloudfunctions/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_cloudfunctions(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/cloudfunctions2/zz_main.go b/cmd/provider/cloudfunctions2/zz_main.go new file mode 100644 index 000000000..34b154811 --- /dev/null +++ b/cmd/provider/cloudfunctions2/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_cloudfunctions2(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/cloudiot/zz_main.go b/cmd/provider/cloudiot/zz_main.go new file mode 100644 index 000000000..0c95300f0 --- /dev/null +++ b/cmd/provider/cloudiot/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_cloudiot(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/cloudplatform/zz_main.go b/cmd/provider/cloudplatform/zz_main.go new file mode 100644 index 000000000..921075544 --- /dev/null +++ b/cmd/provider/cloudplatform/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_cloudplatform(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/cloudrun/zz_main.go b/cmd/provider/cloudrun/zz_main.go new file mode 100644 index 000000000..ffe747e51 --- /dev/null +++ b/cmd/provider/cloudrun/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_cloudrun(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/cloudscheduler/zz_main.go b/cmd/provider/cloudscheduler/zz_main.go new file mode 100644 index 000000000..a8f037f7a --- /dev/null +++ b/cmd/provider/cloudscheduler/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_cloudscheduler(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/cloudtasks/zz_main.go b/cmd/provider/cloudtasks/zz_main.go new file mode 100644 index 000000000..19d0217b5 --- /dev/null +++ b/cmd/provider/cloudtasks/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_cloudtasks(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/composer/zz_main.go b/cmd/provider/composer/zz_main.go new file mode 100644 index 000000000..1f5c59c2a --- /dev/null +++ b/cmd/provider/composer/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_composer(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/compute/zz_main.go b/cmd/provider/compute/zz_main.go new file mode 100644 index 000000000..f65af7664 --- /dev/null +++ b/cmd/provider/compute/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_compute(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/config/zz_main.go b/cmd/provider/config/zz_main.go new file mode 100644 index 000000000..cfa28e184 --- /dev/null +++ b/cmd/provider/config/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_config(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/container/zz_main.go b/cmd/provider/container/zz_main.go new file mode 100644 index 000000000..dd7c522c9 --- /dev/null +++ b/cmd/provider/container/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_container(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/containeranalysis/zz_main.go b/cmd/provider/containeranalysis/zz_main.go new file mode 100644 index 000000000..5b57989f3 --- /dev/null +++ b/cmd/provider/containeranalysis/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_containeranalysis(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/containeraws/zz_main.go b/cmd/provider/containeraws/zz_main.go new file mode 100644 index 000000000..18b09d3a8 --- /dev/null +++ b/cmd/provider/containeraws/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_containeraws(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/containerazure/zz_main.go b/cmd/provider/containerazure/zz_main.go new file mode 100644 index 000000000..c39e130d5 --- /dev/null +++ b/cmd/provider/containerazure/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_containerazure(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/datacatalog/zz_main.go b/cmd/provider/datacatalog/zz_main.go new file mode 100644 index 000000000..7d92f8b68 --- /dev/null +++ b/cmd/provider/datacatalog/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_datacatalog(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/dataflow/zz_main.go b/cmd/provider/dataflow/zz_main.go new file mode 100644 index 000000000..2fcdd7b94 --- /dev/null +++ b/cmd/provider/dataflow/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_dataflow(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/datafusion/zz_main.go b/cmd/provider/datafusion/zz_main.go new file mode 100644 index 000000000..a5526f075 --- /dev/null +++ b/cmd/provider/datafusion/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_datafusion(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/datalossprevention/zz_main.go b/cmd/provider/datalossprevention/zz_main.go new file mode 100644 index 000000000..ee717e3dc --- /dev/null +++ b/cmd/provider/datalossprevention/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_datalossprevention(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/dataplex/zz_main.go b/cmd/provider/dataplex/zz_main.go new file mode 100644 index 000000000..39ec0dff6 --- /dev/null +++ b/cmd/provider/dataplex/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_dataplex(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/dataproc/zz_main.go b/cmd/provider/dataproc/zz_main.go new file mode 100644 index 000000000..08116dbcb --- /dev/null +++ b/cmd/provider/dataproc/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_dataproc(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/datastore/zz_main.go b/cmd/provider/datastore/zz_main.go new file mode 100644 index 000000000..bea7ab1cf --- /dev/null +++ b/cmd/provider/datastore/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_datastore(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/datastream/zz_main.go b/cmd/provider/datastream/zz_main.go new file mode 100644 index 000000000..5fef1c749 --- /dev/null +++ b/cmd/provider/datastream/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_datastream(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/dialogflowcx/zz_main.go b/cmd/provider/dialogflowcx/zz_main.go new file mode 100644 index 000000000..961d56b68 --- /dev/null +++ b/cmd/provider/dialogflowcx/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_dialogflowcx(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/main.go b/cmd/provider/dns/zz_main.go similarity index 98% rename from cmd/provider/main.go rename to cmd/provider/dns/zz_main.go index 8726f3f4c..b83fcd302 100644 --- a/cmd/provider/main.go +++ b/cmd/provider/dns/zz_main.go @@ -145,6 +145,6 @@ func main() { log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) } - kingpin.FatalIfError(controller.Setup(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(controller.Setup_dns(mgr, o), "Cannot setup GCP controllers") kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") } diff --git a/cmd/provider/documentai/zz_main.go b/cmd/provider/documentai/zz_main.go new file mode 100644 index 000000000..dac3a17da --- /dev/null +++ b/cmd/provider/documentai/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_documentai(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/essentialcontacts/zz_main.go b/cmd/provider/essentialcontacts/zz_main.go new file mode 100644 index 000000000..380f87456 --- /dev/null +++ b/cmd/provider/essentialcontacts/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_essentialcontacts(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/eventarc/zz_main.go b/cmd/provider/eventarc/zz_main.go new file mode 100644 index 000000000..a7d1109ab --- /dev/null +++ b/cmd/provider/eventarc/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_eventarc(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/filestore/zz_main.go b/cmd/provider/filestore/zz_main.go new file mode 100644 index 000000000..89d93caf2 --- /dev/null +++ b/cmd/provider/filestore/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_filestore(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/firebaserules/zz_main.go b/cmd/provider/firebaserules/zz_main.go new file mode 100644 index 000000000..2d5ce5340 --- /dev/null +++ b/cmd/provider/firebaserules/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_firebaserules(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/gke/zz_main.go b/cmd/provider/gke/zz_main.go new file mode 100644 index 000000000..3c7662305 --- /dev/null +++ b/cmd/provider/gke/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_gke(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/gkehub/zz_main.go b/cmd/provider/gkehub/zz_main.go new file mode 100644 index 000000000..16f83a128 --- /dev/null +++ b/cmd/provider/gkehub/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_gkehub(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/healthcare/zz_main.go b/cmd/provider/healthcare/zz_main.go new file mode 100644 index 000000000..1ebd376c5 --- /dev/null +++ b/cmd/provider/healthcare/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_healthcare(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/iam/zz_main.go b/cmd/provider/iam/zz_main.go new file mode 100644 index 000000000..1ea38db78 --- /dev/null +++ b/cmd/provider/iam/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_iam(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/iap/zz_main.go b/cmd/provider/iap/zz_main.go new file mode 100644 index 000000000..73ccb80be --- /dev/null +++ b/cmd/provider/iap/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_iap(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/identityplatform/zz_main.go b/cmd/provider/identityplatform/zz_main.go new file mode 100644 index 000000000..9ddfadbac --- /dev/null +++ b/cmd/provider/identityplatform/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_identityplatform(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/kms/zz_main.go b/cmd/provider/kms/zz_main.go new file mode 100644 index 000000000..3437014fb --- /dev/null +++ b/cmd/provider/kms/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_kms(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/logging/zz_main.go b/cmd/provider/logging/zz_main.go new file mode 100644 index 000000000..2f61857c7 --- /dev/null +++ b/cmd/provider/logging/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_logging(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/memcache/zz_main.go b/cmd/provider/memcache/zz_main.go new file mode 100644 index 000000000..55db35b90 --- /dev/null +++ b/cmd/provider/memcache/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_memcache(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/mlengine/zz_main.go b/cmd/provider/mlengine/zz_main.go new file mode 100644 index 000000000..fe79377ca --- /dev/null +++ b/cmd/provider/mlengine/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_mlengine(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/monitoring/zz_main.go b/cmd/provider/monitoring/zz_main.go new file mode 100644 index 000000000..c9a31518c --- /dev/null +++ b/cmd/provider/monitoring/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_monitoring(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/monolith/zz_main.go b/cmd/provider/monolith/zz_main.go new file mode 100644 index 000000000..14813bc30 --- /dev/null +++ b/cmd/provider/monolith/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_monolith(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/networkconnectivity/zz_main.go b/cmd/provider/networkconnectivity/zz_main.go new file mode 100644 index 000000000..a9e76fde0 --- /dev/null +++ b/cmd/provider/networkconnectivity/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_networkconnectivity(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/networkmanagement/zz_main.go b/cmd/provider/networkmanagement/zz_main.go new file mode 100644 index 000000000..8fd1663de --- /dev/null +++ b/cmd/provider/networkmanagement/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_networkmanagement(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/notebooks/zz_main.go b/cmd/provider/notebooks/zz_main.go new file mode 100644 index 000000000..67ce7447b --- /dev/null +++ b/cmd/provider/notebooks/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_notebooks(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/osconfig/zz_main.go b/cmd/provider/osconfig/zz_main.go new file mode 100644 index 000000000..b40f9e5cb --- /dev/null +++ b/cmd/provider/osconfig/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_osconfig(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/oslogin/zz_main.go b/cmd/provider/oslogin/zz_main.go new file mode 100644 index 000000000..d02ea711c --- /dev/null +++ b/cmd/provider/oslogin/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_oslogin(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/privateca/zz_main.go b/cmd/provider/privateca/zz_main.go new file mode 100644 index 000000000..f4822bcd7 --- /dev/null +++ b/cmd/provider/privateca/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_privateca(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/pubsub/zz_main.go b/cmd/provider/pubsub/zz_main.go new file mode 100644 index 000000000..18419240d --- /dev/null +++ b/cmd/provider/pubsub/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_pubsub(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/redis/zz_main.go b/cmd/provider/redis/zz_main.go new file mode 100644 index 000000000..95e74a5ee --- /dev/null +++ b/cmd/provider/redis/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_redis(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/secretmanager/zz_main.go b/cmd/provider/secretmanager/zz_main.go new file mode 100644 index 000000000..887c08512 --- /dev/null +++ b/cmd/provider/secretmanager/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_secretmanager(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/servicenetworking/zz_main.go b/cmd/provider/servicenetworking/zz_main.go new file mode 100644 index 000000000..b7a7fa4aa --- /dev/null +++ b/cmd/provider/servicenetworking/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_servicenetworking(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/sourcerepo/zz_main.go b/cmd/provider/sourcerepo/zz_main.go new file mode 100644 index 000000000..b6bb54f20 --- /dev/null +++ b/cmd/provider/sourcerepo/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_sourcerepo(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/spanner/zz_main.go b/cmd/provider/spanner/zz_main.go new file mode 100644 index 000000000..95e504f0b --- /dev/null +++ b/cmd/provider/spanner/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_spanner(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/sql/zz_main.go b/cmd/provider/sql/zz_main.go new file mode 100644 index 000000000..2db03f2ad --- /dev/null +++ b/cmd/provider/sql/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_sql(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/storage/zz_main.go b/cmd/provider/storage/zz_main.go new file mode 100644 index 000000000..ce457378d --- /dev/null +++ b/cmd/provider/storage/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_storage(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/storagetransfer/zz_main.go b/cmd/provider/storagetransfer/zz_main.go new file mode 100644 index 000000000..776a9d360 --- /dev/null +++ b/cmd/provider/storagetransfer/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_storagetransfer(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/tpu/zz_main.go b/cmd/provider/tpu/zz_main.go new file mode 100644 index 000000000..b7b621369 --- /dev/null +++ b/cmd/provider/tpu/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_tpu(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/vertexai/zz_main.go b/cmd/provider/vertexai/zz_main.go new file mode 100644 index 000000000..fca62b873 --- /dev/null +++ b/cmd/provider/vertexai/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_vertexai(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/cmd/provider/workflows/zz_main.go b/cmd/provider/workflows/zz_main.go new file mode 100644 index 000000000..6f3b0d60a --- /dev/null +++ b/cmd/provider/workflows/zz_main.go @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_workflows(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/config/provider.go b/config/provider.go index d035ec70f..006fa3402 100644 --- a/config/provider.go +++ b/config/provider.go @@ -63,6 +63,7 @@ import ( "github.com/upbound/provider-gcp/config/tpu" "github.com/upbound/provider-gcp/config/vertexai" "github.com/upbound/provider-gcp/config/vpcaccess" + "github.com/upbound/provider-gcp/hack" ) const ( @@ -150,7 +151,7 @@ func GetProvider() *tjconfig.Provider { tjconfig.WithReferenceInjectors([]tjconfig.ReferenceInjector{reference.NewInjector(modulePath)}), tjconfig.WithSkipList(skipList), tjconfig.WithFeaturesPackage("internal/features"), - ) + tjconfig.WithMainTemplate(hack.MainTemplate)) for _, configure := range []func(provider *tjconfig.Provider){ accessapproval.Configure, diff --git a/examples/providerconfig/.gitignore b/examples/gcp/.gitignore similarity index 100% rename from examples/providerconfig/.gitignore rename to examples/gcp/.gitignore diff --git a/examples/providerconfig/accesstoken.yaml b/examples/gcp/accesstoken.yaml similarity index 100% rename from examples/providerconfig/accesstoken.yaml rename to examples/gcp/accesstoken.yaml diff --git a/examples/providerconfig/providerconfig.yaml b/examples/gcp/providerconfig.yaml similarity index 100% rename from examples/providerconfig/providerconfig.yaml rename to examples/gcp/providerconfig.yaml diff --git a/examples/providerconfig/secret.yaml.tmpl b/examples/gcp/secret.yaml.tmpl similarity index 100% rename from examples/providerconfig/secret.yaml.tmpl rename to examples/gcp/secret.yaml.tmpl diff --git a/examples/providerconfig/upbound.yaml b/examples/gcp/upbound.yaml similarity index 100% rename from examples/providerconfig/upbound.yaml rename to examples/gcp/upbound.yaml diff --git a/examples/providerconfig/workloadidentity.yaml b/examples/gcp/workloadidentity.yaml similarity index 100% rename from examples/providerconfig/workloadidentity.yaml rename to examples/gcp/workloadidentity.yaml diff --git a/go.mod b/go.mod index 2d7f2eaee..a28863752 100644 --- a/go.mod +++ b/go.mod @@ -141,3 +141,5 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) + +replace github.com/upbound/upjet => ../upjet diff --git a/go.sum b/go.sum index 048504913..69fe3fae6 100644 --- a/go.sum +++ b/go.sum @@ -508,8 +508,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/tmccombs/hcl2json v0.3.3 h1:+DLNYqpWE0CsOQiEZu+OZm5ZBImake3wtITYxQ8uLFQ= github.com/tmccombs/hcl2json v0.3.3/go.mod h1:Y2chtz2x9bAeRTvSibVRVgbLJhLJXKlUeIvjeVdnm4w= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/upbound/upjet v0.9.0-rc.0.0.20230418102526-1268a48eba95 h1:+4Ne/byOLvBjE49C5XCcj+5KKK3OYMsAafYrVIMfSP8= -github.com/upbound/upjet v0.9.0-rc.0.0.20230418102526-1268a48eba95/go.mod h1:IhrO+1L/Ieq7ZCORhiuZ4sShOzl/GoVGVjq0+JCMDYo= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= diff --git a/hack/embed.go b/hack/embed.go new file mode 100644 index 000000000..31633110b --- /dev/null +++ b/hack/embed.go @@ -0,0 +1,8 @@ +package hack + +import _ "embed" + +// MainTemplate is populated with provider main program template. +// +//go:embed main.go.tmpl +var MainTemplate string diff --git a/hack/main.go.tmpl b/hack/main.go.tmpl new file mode 100644 index 000000000..651bbd45a --- /dev/null +++ b/hack/main.go.tmpl @@ -0,0 +1,150 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "context" + "os" + "path/filepath" + "time" + + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" +) + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("10").Int() + pluginProcessTTL = app.Flag("provider-ttl", "TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Default("100").Int() + terraformVersion = app.Flag("terraform-version", "Terraform version.").Required().Envar("TERRAFORM_VERSION").String() + nativeProviderSource = app.Flag("terraform-provider-source", "Terraform provider source.").Required().Envar("TERRAFORM_PROVIDER_SOURCE").String() + providerVersion = app.Flag("terraform-provider-version", "Terraform provider version.").Required().Envar("TERRAFORM_PROVIDER_VERSION").String() + nativeProviderPath = app.Flag("terraform-native-provider-path", "Terraform native provider path for shared execution.").Default("").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").String() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("false").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + + zl := zap.New(zap.UseDevMode(*debug)) + log := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + log.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp", + SyncPeriod: syncInterval, + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + + // if the native Terraform provider plugin's path is not configured via + // the env. variable TERRAFORM_NATIVE_PROVIDER_PATH or + // the `--terraform-native-provider-path` command-line option, + // we do not use the shared gRPC server and default to the regular + // Terraform CLI behaviour (of forking a plugin process per invocation). + // This removes some complexity for setting up development environments. + var scheduler terraform.ProviderScheduler = terraform.NewNoOpProviderScheduler() + if len(*nativeProviderPath) != 0 { + scheduler = terraform.NewSharedProviderScheduler(log, *pluginProcessTTL, terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource)) + } + + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: log, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + }, + Provider: config.GetProvider(), + WorkspaceStore: terraform.NewWorkspaceStore(log, terraform.WithDisableInit(len(*nativeProviderPath) != 0), terraform.WithProcessReportInterval(*pollInterval)), + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), + } + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableAlphaManagementPolicies) + log.Info("Alpha feature enabled", "flag", features.EnableAlphaManagementPolicies) + } + + kingpin.FatalIfError(controller.Setup_{{ .Group }}(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/internal/controller/activedirectory/domain/zz_controller.go b/internal/controller/activedirectory/domain/zz_controller.go index 4d1f58d14..f076d5383 100755 --- a/internal/controller/activedirectory/domain/zz_controller.go +++ b/internal/controller/activedirectory/domain/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_active_directory_domain"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/apigee/envgroup/zz_controller.go b/internal/controller/apigee/envgroup/zz_controller.go index f2c38d151..3933c0a4f 100755 --- a/internal/controller/apigee/envgroup/zz_controller.go +++ b/internal/controller/apigee/envgroup/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_envgroup"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/apigee/environment/zz_controller.go b/internal/controller/apigee/environment/zz_controller.go index f130a5475..d21f0c03a 100755 --- a/internal/controller/apigee/environment/zz_controller.go +++ b/internal/controller/apigee/environment/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_environment"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/apigee/environmentiammember/zz_controller.go b/internal/controller/apigee/environmentiammember/zz_controller.go index 57c50f477..6728047d2 100755 --- a/internal/controller/apigee/environmentiammember/zz_controller.go +++ b/internal/controller/apigee/environmentiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_environment_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/apigee/instance/zz_controller.go b/internal/controller/apigee/instance/zz_controller.go index f8d8c27d9..0ffe18066 100755 --- a/internal/controller/apigee/instance/zz_controller.go +++ b/internal/controller/apigee/instance/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/apigee/nataddress/zz_controller.go b/internal/controller/apigee/nataddress/zz_controller.go index c56922d5b..413692faa 100755 --- a/internal/controller/apigee/nataddress/zz_controller.go +++ b/internal/controller/apigee/nataddress/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_nat_address"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/apigee/organization/zz_controller.go b/internal/controller/apigee/organization/zz_controller.go index 1c4c0e44a..a270b7201 100755 --- a/internal/controller/apigee/organization/zz_controller.go +++ b/internal/controller/apigee/organization/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_organization"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/appengine/application/zz_controller.go b/internal/controller/appengine/application/zz_controller.go index 9a5d17197..5ab0d4c89 100755 --- a/internal/controller/appengine/application/zz_controller.go +++ b/internal/controller/appengine/application/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_app_engine_application"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/appengine/applicationurldispatchrules/zz_controller.go b/internal/controller/appengine/applicationurldispatchrules/zz_controller.go index c1e073030..7446cd6ab 100755 --- a/internal/controller/appengine/applicationurldispatchrules/zz_controller.go +++ b/internal/controller/appengine/applicationurldispatchrules/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_app_engine_application_url_dispatch_rules"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/appengine/firewallrule/zz_controller.go b/internal/controller/appengine/firewallrule/zz_controller.go index 50be59f5b..69d7e8ce2 100755 --- a/internal/controller/appengine/firewallrule/zz_controller.go +++ b/internal/controller/appengine/firewallrule/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_app_engine_firewall_rule"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/appengine/servicenetworksettings/zz_controller.go b/internal/controller/appengine/servicenetworksettings/zz_controller.go index e563cbe8a..dbbdf826b 100755 --- a/internal/controller/appengine/servicenetworksettings/zz_controller.go +++ b/internal/controller/appengine/servicenetworksettings/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_app_engine_service_network_settings"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/appengine/standardappversion/zz_controller.go b/internal/controller/appengine/standardappversion/zz_controller.go index 655a730e6..d79491f36 100755 --- a/internal/controller/appengine/standardappversion/zz_controller.go +++ b/internal/controller/appengine/standardappversion/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_app_engine_standard_app_version"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/artifact/registryrepository/zz_controller.go b/internal/controller/artifact/registryrepository/zz_controller.go index cf777e57a..eac2a5516 100755 --- a/internal/controller/artifact/registryrepository/zz_controller.go +++ b/internal/controller/artifact/registryrepository/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_artifact_registry_repository"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/artifact/registryrepositoryiammember/zz_controller.go b/internal/controller/artifact/registryrepositoryiammember/zz_controller.go index 7c330956e..11920fcc8 100755 --- a/internal/controller/artifact/registryrepositoryiammember/zz_controller.go +++ b/internal/controller/artifact/registryrepositoryiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_artifact_registry_repository_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/beyondcorp/appconnection/zz_controller.go b/internal/controller/beyondcorp/appconnection/zz_controller.go index 677a0bfe5..15341f822 100755 --- a/internal/controller/beyondcorp/appconnection/zz_controller.go +++ b/internal/controller/beyondcorp/appconnection/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_beyondcorp_app_connection"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/beyondcorp/appconnector/zz_controller.go b/internal/controller/beyondcorp/appconnector/zz_controller.go index fed832301..4f5df1a88 100755 --- a/internal/controller/beyondcorp/appconnector/zz_controller.go +++ b/internal/controller/beyondcorp/appconnector/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_beyondcorp_app_connector"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/beyondcorp/appgateway/zz_controller.go b/internal/controller/beyondcorp/appgateway/zz_controller.go index 7efa5cdc5..96e9d6a0f 100755 --- a/internal/controller/beyondcorp/appgateway/zz_controller.go +++ b/internal/controller/beyondcorp/appgateway/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_beyondcorp_app_gateway"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/analyticshubdataexchange/zz_controller.go b/internal/controller/bigquery/analyticshubdataexchange/zz_controller.go index 347e356ae..8260b34e2 100755 --- a/internal/controller/bigquery/analyticshubdataexchange/zz_controller.go +++ b/internal/controller/bigquery/analyticshubdataexchange/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_analytics_hub_data_exchange"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/analyticshubdataexchangeiammember/zz_controller.go b/internal/controller/bigquery/analyticshubdataexchangeiammember/zz_controller.go index dbfd4872e..0150bdfb6 100755 --- a/internal/controller/bigquery/analyticshubdataexchangeiammember/zz_controller.go +++ b/internal/controller/bigquery/analyticshubdataexchangeiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_analytics_hub_data_exchange_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/analyticshublisting/zz_controller.go b/internal/controller/bigquery/analyticshublisting/zz_controller.go index 295d04591..470b782dd 100755 --- a/internal/controller/bigquery/analyticshublisting/zz_controller.go +++ b/internal/controller/bigquery/analyticshublisting/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_analytics_hub_listing"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/connection/zz_controller.go b/internal/controller/bigquery/connection/zz_controller.go index 011cac341..c3361fdd5 100755 --- a/internal/controller/bigquery/connection/zz_controller.go +++ b/internal/controller/bigquery/connection/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_connection"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/dataset/zz_controller.go b/internal/controller/bigquery/dataset/zz_controller.go index d7f43f4aa..42eb441a3 100755 --- a/internal/controller/bigquery/dataset/zz_controller.go +++ b/internal/controller/bigquery/dataset/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/datasetaccess/zz_controller.go b/internal/controller/bigquery/datasetaccess/zz_controller.go index 1ea2f9719..9c0dee254 100755 --- a/internal/controller/bigquery/datasetaccess/zz_controller.go +++ b/internal/controller/bigquery/datasetaccess/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_access"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/datasetiambinding/zz_controller.go b/internal/controller/bigquery/datasetiambinding/zz_controller.go index 4c681b315..aa1e9e8a3 100755 --- a/internal/controller/bigquery/datasetiambinding/zz_controller.go +++ b/internal/controller/bigquery/datasetiambinding/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_iam_binding"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/datasetiammember/zz_controller.go b/internal/controller/bigquery/datasetiammember/zz_controller.go index 356233c85..b3c8a9cb8 100755 --- a/internal/controller/bigquery/datasetiammember/zz_controller.go +++ b/internal/controller/bigquery/datasetiammember/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/datasetiampolicy/zz_controller.go b/internal/controller/bigquery/datasetiampolicy/zz_controller.go index 7fc61d242..de3313da7 100755 --- a/internal/controller/bigquery/datasetiampolicy/zz_controller.go +++ b/internal/controller/bigquery/datasetiampolicy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_iam_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/datatransferconfig/zz_controller.go b/internal/controller/bigquery/datatransferconfig/zz_controller.go index 6e6ef82a9..c39050dcd 100755 --- a/internal/controller/bigquery/datatransferconfig/zz_controller.go +++ b/internal/controller/bigquery/datatransferconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_data_transfer_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/job/zz_controller.go b/internal/controller/bigquery/job/zz_controller.go index fb5d56fe4..2b757985d 100755 --- a/internal/controller/bigquery/job/zz_controller.go +++ b/internal/controller/bigquery/job/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_job"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/reservation/zz_controller.go b/internal/controller/bigquery/reservation/zz_controller.go index 89ccaed9e..683df6635 100755 --- a/internal/controller/bigquery/reservation/zz_controller.go +++ b/internal/controller/bigquery/reservation/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_reservation"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/reservationassignment/zz_controller.go b/internal/controller/bigquery/reservationassignment/zz_controller.go index ab74caa48..83d5f4899 100755 --- a/internal/controller/bigquery/reservationassignment/zz_controller.go +++ b/internal/controller/bigquery/reservationassignment/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_reservation_assignment"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/routine/zz_controller.go b/internal/controller/bigquery/routine/zz_controller.go index 2fcd0a156..9d2c874c3 100755 --- a/internal/controller/bigquery/routine/zz_controller.go +++ b/internal/controller/bigquery/routine/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_routine"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/table/zz_controller.go b/internal/controller/bigquery/table/zz_controller.go index daf66a674..031668dfb 100755 --- a/internal/controller/bigquery/table/zz_controller.go +++ b/internal/controller/bigquery/table/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_table"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/tableiambinding/zz_controller.go b/internal/controller/bigquery/tableiambinding/zz_controller.go index 47581a288..ab75279a1 100755 --- a/internal/controller/bigquery/tableiambinding/zz_controller.go +++ b/internal/controller/bigquery/tableiambinding/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_table_iam_binding"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/tableiammember/zz_controller.go b/internal/controller/bigquery/tableiammember/zz_controller.go index d2fede038..08bd16887 100755 --- a/internal/controller/bigquery/tableiammember/zz_controller.go +++ b/internal/controller/bigquery/tableiammember/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_table_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigquery/tableiampolicy/zz_controller.go b/internal/controller/bigquery/tableiampolicy/zz_controller.go index 5ff1c1bb9..4aed0ef52 100755 --- a/internal/controller/bigquery/tableiampolicy/zz_controller.go +++ b/internal/controller/bigquery/tableiampolicy/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_table_iam_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigtable/appprofile/zz_controller.go b/internal/controller/bigtable/appprofile/zz_controller.go index d601b9a8c..cea26d4c7 100755 --- a/internal/controller/bigtable/appprofile/zz_controller.go +++ b/internal/controller/bigtable/appprofile/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_app_profile"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigtable/garbagecollectionpolicy/zz_controller.go b/internal/controller/bigtable/garbagecollectionpolicy/zz_controller.go index 59fa7b47a..2c755bb96 100755 --- a/internal/controller/bigtable/garbagecollectionpolicy/zz_controller.go +++ b/internal/controller/bigtable/garbagecollectionpolicy/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_gc_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigtable/instance/zz_controller.go b/internal/controller/bigtable/instance/zz_controller.go index 286b39a90..c834e6738 100755 --- a/internal/controller/bigtable/instance/zz_controller.go +++ b/internal/controller/bigtable/instance/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigtable/instanceiambinding/zz_controller.go b/internal/controller/bigtable/instanceiambinding/zz_controller.go index 47c6d43ec..e6c8c00bb 100755 --- a/internal/controller/bigtable/instanceiambinding/zz_controller.go +++ b/internal/controller/bigtable/instanceiambinding/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance_iam_binding"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigtable/instanceiammember/zz_controller.go b/internal/controller/bigtable/instanceiammember/zz_controller.go index 4d693ab3e..438cc427a 100755 --- a/internal/controller/bigtable/instanceiammember/zz_controller.go +++ b/internal/controller/bigtable/instanceiammember/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigtable/instanceiampolicy/zz_controller.go b/internal/controller/bigtable/instanceiampolicy/zz_controller.go index 26072fb57..a266ca60f 100755 --- a/internal/controller/bigtable/instanceiampolicy/zz_controller.go +++ b/internal/controller/bigtable/instanceiampolicy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance_iam_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigtable/table/zz_controller.go b/internal/controller/bigtable/table/zz_controller.go index 4c8365ba5..8962de506 100755 --- a/internal/controller/bigtable/table/zz_controller.go +++ b/internal/controller/bigtable/table/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_table"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigtable/tableiambinding/zz_controller.go b/internal/controller/bigtable/tableiambinding/zz_controller.go index 34cad1e01..958cf3e8b 100755 --- a/internal/controller/bigtable/tableiambinding/zz_controller.go +++ b/internal/controller/bigtable/tableiambinding/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_table_iam_binding"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigtable/tableiammember/zz_controller.go b/internal/controller/bigtable/tableiammember/zz_controller.go index 7fff880be..e481afc08 100755 --- a/internal/controller/bigtable/tableiammember/zz_controller.go +++ b/internal/controller/bigtable/tableiammember/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_table_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/bigtable/tableiampolicy/zz_controller.go b/internal/controller/bigtable/tableiampolicy/zz_controller.go index 93f5feda0..c95543053 100755 --- a/internal/controller/bigtable/tableiampolicy/zz_controller.go +++ b/internal/controller/bigtable/tableiampolicy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_table_iam_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/binaryauthorization/attestor/zz_controller.go b/internal/controller/binaryauthorization/attestor/zz_controller.go index 29446e54b..bdf30eff7 100755 --- a/internal/controller/binaryauthorization/attestor/zz_controller.go +++ b/internal/controller/binaryauthorization/attestor/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_binary_authorization_attestor"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/binaryauthorization/policy/zz_controller.go b/internal/controller/binaryauthorization/policy/zz_controller.go index fda988ccc..87ba3fc84 100755 --- a/internal/controller/binaryauthorization/policy/zz_controller.go +++ b/internal/controller/binaryauthorization/policy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_binary_authorization_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/certificatemanager/certificate/zz_controller.go b/internal/controller/certificatemanager/certificate/zz_controller.go index 089d332fe..6ed9d16d0 100755 --- a/internal/controller/certificatemanager/certificate/zz_controller.go +++ b/internal/controller/certificatemanager/certificate/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_certificate"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/certificatemanager/certificatemap/zz_controller.go b/internal/controller/certificatemanager/certificatemap/zz_controller.go index a01d1413c..50453e15d 100755 --- a/internal/controller/certificatemanager/certificatemap/zz_controller.go +++ b/internal/controller/certificatemanager/certificatemap/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_certificate_map"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/certificatemanager/certificatemapentry/zz_controller.go b/internal/controller/certificatemanager/certificatemapentry/zz_controller.go index 30040def7..5beb47bca 100755 --- a/internal/controller/certificatemanager/certificatemapentry/zz_controller.go +++ b/internal/controller/certificatemanager/certificatemapentry/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_certificate_map_entry"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/certificatemanager/dnsauthorization/zz_controller.go b/internal/controller/certificatemanager/dnsauthorization/zz_controller.go index f4e02977d..e01f8c5e9 100755 --- a/internal/controller/certificatemanager/dnsauthorization/zz_controller.go +++ b/internal/controller/certificatemanager/dnsauthorization/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_dns_authorization"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloud/idsendpoint/zz_controller.go b/internal/controller/cloud/idsendpoint/zz_controller.go index 567836615..3b5e0f70c 100755 --- a/internal/controller/cloud/idsendpoint/zz_controller.go +++ b/internal/controller/cloud/idsendpoint/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_ids_endpoint"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudbuild/trigger/zz_controller.go b/internal/controller/cloudbuild/trigger/zz_controller.go index d0f04818c..3d7c9bf7d 100755 --- a/internal/controller/cloudbuild/trigger/zz_controller.go +++ b/internal/controller/cloudbuild/trigger/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudbuild_trigger"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudbuild/workerpool/zz_controller.go b/internal/controller/cloudbuild/workerpool/zz_controller.go index eea9d16e3..3cd2e5bac 100755 --- a/internal/controller/cloudbuild/workerpool/zz_controller.go +++ b/internal/controller/cloudbuild/workerpool/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudbuild_worker_pool"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudfunctions/function/zz_controller.go b/internal/controller/cloudfunctions/function/zz_controller.go index 10ec7b6a0..200c41fdc 100755 --- a/internal/controller/cloudfunctions/function/zz_controller.go +++ b/internal/controller/cloudfunctions/function/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudfunctions_function"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudfunctions/functioniammember/zz_controller.go b/internal/controller/cloudfunctions/functioniammember/zz_controller.go index 74e0af927..c75370a14 100755 --- a/internal/controller/cloudfunctions/functioniammember/zz_controller.go +++ b/internal/controller/cloudfunctions/functioniammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudfunctions_function_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudfunctions2/function/zz_controller.go b/internal/controller/cloudfunctions2/function/zz_controller.go index 02ee8cff0..df315343d 100755 --- a/internal/controller/cloudfunctions2/function/zz_controller.go +++ b/internal/controller/cloudfunctions2/function/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudfunctions2_function"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudiot/device/zz_controller.go b/internal/controller/cloudiot/device/zz_controller.go index b8b85af76..4d488413d 100755 --- a/internal/controller/cloudiot/device/zz_controller.go +++ b/internal/controller/cloudiot/device/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudiot_device"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudiot/registry/zz_controller.go b/internal/controller/cloudiot/registry/zz_controller.go index 2da08e159..69fbd942e 100755 --- a/internal/controller/cloudiot/registry/zz_controller.go +++ b/internal/controller/cloudiot/registry/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudiot_registry"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/folder/zz_controller.go b/internal/controller/cloudplatform/folder/zz_controller.go index 3461425c4..aa15959c8 100755 --- a/internal/controller/cloudplatform/folder/zz_controller.go +++ b/internal/controller/cloudplatform/folder/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_folder"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/folderiammember/zz_controller.go b/internal/controller/cloudplatform/folderiammember/zz_controller.go index 43f477a71..d926808a7 100755 --- a/internal/controller/cloudplatform/folderiammember/zz_controller.go +++ b/internal/controller/cloudplatform/folderiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_folder_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/organizationiamauditconfig/zz_controller.go b/internal/controller/cloudplatform/organizationiamauditconfig/zz_controller.go index bb32a529a..e37b09383 100755 --- a/internal/controller/cloudplatform/organizationiamauditconfig/zz_controller.go +++ b/internal/controller/cloudplatform/organizationiamauditconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_organization_iam_audit_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/organizationiamcustomrole/zz_controller.go b/internal/controller/cloudplatform/organizationiamcustomrole/zz_controller.go index e361433cc..dca2a10dc 100755 --- a/internal/controller/cloudplatform/organizationiamcustomrole/zz_controller.go +++ b/internal/controller/cloudplatform/organizationiamcustomrole/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_organization_iam_custom_role"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/organizationiammember/zz_controller.go b/internal/controller/cloudplatform/organizationiammember/zz_controller.go index 447fed41e..042ce86f2 100755 --- a/internal/controller/cloudplatform/organizationiammember/zz_controller.go +++ b/internal/controller/cloudplatform/organizationiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_organization_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/project/zz_controller.go b/internal/controller/cloudplatform/project/zz_controller.go index 59286fffe..acb2d7d66 100755 --- a/internal/controller/cloudplatform/project/zz_controller.go +++ b/internal/controller/cloudplatform/project/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/projectdefaultserviceaccounts/zz_controller.go b/internal/controller/cloudplatform/projectdefaultserviceaccounts/zz_controller.go index 83fd6793c..53fba075b 100755 --- a/internal/controller/cloudplatform/projectdefaultserviceaccounts/zz_controller.go +++ b/internal/controller/cloudplatform/projectdefaultserviceaccounts/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_default_service_accounts"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/projectiamauditconfig/zz_controller.go b/internal/controller/cloudplatform/projectiamauditconfig/zz_controller.go index 7d8dc2c97..8d98054e3 100755 --- a/internal/controller/cloudplatform/projectiamauditconfig/zz_controller.go +++ b/internal/controller/cloudplatform/projectiamauditconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_iam_audit_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/projectiamcustomrole/zz_controller.go b/internal/controller/cloudplatform/projectiamcustomrole/zz_controller.go index 6f3ce8dc8..95053d924 100755 --- a/internal/controller/cloudplatform/projectiamcustomrole/zz_controller.go +++ b/internal/controller/cloudplatform/projectiamcustomrole/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_iam_custom_role"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/projectiammember/zz_controller.go b/internal/controller/cloudplatform/projectiammember/zz_controller.go index 891b5dfc0..f7a70e325 100755 --- a/internal/controller/cloudplatform/projectiammember/zz_controller.go +++ b/internal/controller/cloudplatform/projectiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/projectservice/zz_controller.go b/internal/controller/cloudplatform/projectservice/zz_controller.go index 3af6bfd7c..033700d46 100755 --- a/internal/controller/cloudplatform/projectservice/zz_controller.go +++ b/internal/controller/cloudplatform/projectservice/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_service"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/projectusageexportbucket/zz_controller.go b/internal/controller/cloudplatform/projectusageexportbucket/zz_controller.go index 6ff945a03..130117170 100755 --- a/internal/controller/cloudplatform/projectusageexportbucket/zz_controller.go +++ b/internal/controller/cloudplatform/projectusageexportbucket/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_usage_export_bucket"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/serviceaccount/zz_controller.go b/internal/controller/cloudplatform/serviceaccount/zz_controller.go index 2a3c4b8a0..40065adb4 100755 --- a/internal/controller/cloudplatform/serviceaccount/zz_controller.go +++ b/internal/controller/cloudplatform/serviceaccount/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_service_account"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/serviceaccountiammember/zz_controller.go b/internal/controller/cloudplatform/serviceaccountiammember/zz_controller.go index 91463450e..add42abc0 100755 --- a/internal/controller/cloudplatform/serviceaccountiammember/zz_controller.go +++ b/internal/controller/cloudplatform/serviceaccountiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_service_account_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/serviceaccountkey/zz_controller.go b/internal/controller/cloudplatform/serviceaccountkey/zz_controller.go index 11a41a6ed..565d3ec03 100755 --- a/internal/controller/cloudplatform/serviceaccountkey/zz_controller.go +++ b/internal/controller/cloudplatform/serviceaccountkey/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_service_account_key"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudplatform/servicenetworkingpeereddnsdomain/zz_controller.go b/internal/controller/cloudplatform/servicenetworkingpeereddnsdomain/zz_controller.go index af550677c..217462316 100755 --- a/internal/controller/cloudplatform/servicenetworkingpeereddnsdomain/zz_controller.go +++ b/internal/controller/cloudplatform/servicenetworkingpeereddnsdomain/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_service_networking_peered_dns_domain"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudrun/domainmapping/zz_controller.go b/internal/controller/cloudrun/domainmapping/zz_controller.go index f46c2cf39..2b730dfa8 100755 --- a/internal/controller/cloudrun/domainmapping/zz_controller.go +++ b/internal/controller/cloudrun/domainmapping/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_run_domain_mapping"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudrun/service/zz_controller.go b/internal/controller/cloudrun/service/zz_controller.go index cd449d31a..594164fff 100755 --- a/internal/controller/cloudrun/service/zz_controller.go +++ b/internal/controller/cloudrun/service/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_run_service"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudrun/serviceiammember/zz_controller.go b/internal/controller/cloudrun/serviceiammember/zz_controller.go index 85eeebc4f..ed813b87f 100755 --- a/internal/controller/cloudrun/serviceiammember/zz_controller.go +++ b/internal/controller/cloudrun/serviceiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_run_service_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudrun/v2job/zz_controller.go b/internal/controller/cloudrun/v2job/zz_controller.go index 83aa8653f..4121fc673 100755 --- a/internal/controller/cloudrun/v2job/zz_controller.go +++ b/internal/controller/cloudrun/v2job/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_run_v2_job"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudrun/v2service/zz_controller.go b/internal/controller/cloudrun/v2service/zz_controller.go index 0cb741275..31e536ec6 100755 --- a/internal/controller/cloudrun/v2service/zz_controller.go +++ b/internal/controller/cloudrun/v2service/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_run_v2_service"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudscheduler/job/zz_controller.go b/internal/controller/cloudscheduler/job/zz_controller.go index 6ea4994f0..3c65ea0a8 100755 --- a/internal/controller/cloudscheduler/job/zz_controller.go +++ b/internal/controller/cloudscheduler/job/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_scheduler_job"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/cloudtasks/queue/zz_controller.go b/internal/controller/cloudtasks/queue/zz_controller.go index a2bee762e..7dc2b11d2 100755 --- a/internal/controller/cloudtasks/queue/zz_controller.go +++ b/internal/controller/cloudtasks/queue/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_tasks_queue"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/composer/environment/zz_controller.go b/internal/controller/composer/environment/zz_controller.go index 85719b853..07ecfb941 100755 --- a/internal/controller/composer/environment/zz_controller.go +++ b/internal/controller/composer/environment/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_composer_environment"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/address/zz_controller.go b/internal/controller/compute/address/zz_controller.go index 2325a3eed..cfb188ef2 100755 --- a/internal/controller/compute/address/zz_controller.go +++ b/internal/controller/compute/address/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_address"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/attacheddisk/zz_controller.go b/internal/controller/compute/attacheddisk/zz_controller.go index badc1a630..d3fc955e0 100755 --- a/internal/controller/compute/attacheddisk/zz_controller.go +++ b/internal/controller/compute/attacheddisk/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_attached_disk"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/autoscaler/zz_controller.go b/internal/controller/compute/autoscaler/zz_controller.go index 8f3e8ddfe..de00a391e 100755 --- a/internal/controller/compute/autoscaler/zz_controller.go +++ b/internal/controller/compute/autoscaler/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_autoscaler"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/backendbucket/zz_controller.go b/internal/controller/compute/backendbucket/zz_controller.go index d737a5bb3..fd85f875a 100755 --- a/internal/controller/compute/backendbucket/zz_controller.go +++ b/internal/controller/compute/backendbucket/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_backend_bucket"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/backendbucketsignedurlkey/zz_controller.go b/internal/controller/compute/backendbucketsignedurlkey/zz_controller.go index b78c11935..934b8fece 100755 --- a/internal/controller/compute/backendbucketsignedurlkey/zz_controller.go +++ b/internal/controller/compute/backendbucketsignedurlkey/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_backend_bucket_signed_url_key"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/backendservice/zz_controller.go b/internal/controller/compute/backendservice/zz_controller.go index 5910f33b2..d14ebc5ce 100755 --- a/internal/controller/compute/backendservice/zz_controller.go +++ b/internal/controller/compute/backendservice/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_backend_service"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/backendservicesignedurlkey/zz_controller.go b/internal/controller/compute/backendservicesignedurlkey/zz_controller.go index f50713dbb..184d3154e 100755 --- a/internal/controller/compute/backendservicesignedurlkey/zz_controller.go +++ b/internal/controller/compute/backendservicesignedurlkey/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_backend_service_signed_url_key"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/disk/zz_controller.go b/internal/controller/compute/disk/zz_controller.go index 83db49b46..17f611e31 100755 --- a/internal/controller/compute/disk/zz_controller.go +++ b/internal/controller/compute/disk/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_disk"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/diskiammember/zz_controller.go b/internal/controller/compute/diskiammember/zz_controller.go index 27a7628ac..b8892c3f5 100755 --- a/internal/controller/compute/diskiammember/zz_controller.go +++ b/internal/controller/compute/diskiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_disk_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/diskresourcepolicyattachment/zz_controller.go b/internal/controller/compute/diskresourcepolicyattachment/zz_controller.go index b0671660c..a9092cc12 100755 --- a/internal/controller/compute/diskresourcepolicyattachment/zz_controller.go +++ b/internal/controller/compute/diskresourcepolicyattachment/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_disk_resource_policy_attachment"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/externalvpngateway/zz_controller.go b/internal/controller/compute/externalvpngateway/zz_controller.go index 8828e762b..cc7823ca6 100755 --- a/internal/controller/compute/externalvpngateway/zz_controller.go +++ b/internal/controller/compute/externalvpngateway/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_external_vpn_gateway"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/firewall/zz_controller.go b/internal/controller/compute/firewall/zz_controller.go index 3416d590c..73caa971e 100755 --- a/internal/controller/compute/firewall/zz_controller.go +++ b/internal/controller/compute/firewall/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_firewall"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/firewallpolicy/zz_controller.go b/internal/controller/compute/firewallpolicy/zz_controller.go index c09bf2938..09fc406f7 100755 --- a/internal/controller/compute/firewallpolicy/zz_controller.go +++ b/internal/controller/compute/firewallpolicy/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_firewall_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/firewallpolicyassociation/zz_controller.go b/internal/controller/compute/firewallpolicyassociation/zz_controller.go index 94992bfab..ac85d4672 100755 --- a/internal/controller/compute/firewallpolicyassociation/zz_controller.go +++ b/internal/controller/compute/firewallpolicyassociation/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_firewall_policy_association"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/firewallpolicyrule/zz_controller.go b/internal/controller/compute/firewallpolicyrule/zz_controller.go index 5691ba9b9..bccc47074 100755 --- a/internal/controller/compute/firewallpolicyrule/zz_controller.go +++ b/internal/controller/compute/firewallpolicyrule/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_firewall_policy_rule"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/forwardingrule/zz_controller.go b/internal/controller/compute/forwardingrule/zz_controller.go index 65e6e3830..331601840 100755 --- a/internal/controller/compute/forwardingrule/zz_controller.go +++ b/internal/controller/compute/forwardingrule/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_forwarding_rule"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/globaladdress/zz_controller.go b/internal/controller/compute/globaladdress/zz_controller.go index ee19b3585..f511981b9 100755 --- a/internal/controller/compute/globaladdress/zz_controller.go +++ b/internal/controller/compute/globaladdress/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_global_address"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/globalforwardingrule/zz_controller.go b/internal/controller/compute/globalforwardingrule/zz_controller.go index e53bfa8c1..7f7ae4f01 100755 --- a/internal/controller/compute/globalforwardingrule/zz_controller.go +++ b/internal/controller/compute/globalforwardingrule/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_global_forwarding_rule"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/globalnetworkendpoint/zz_controller.go b/internal/controller/compute/globalnetworkendpoint/zz_controller.go index 18127287f..e57739fe7 100755 --- a/internal/controller/compute/globalnetworkendpoint/zz_controller.go +++ b/internal/controller/compute/globalnetworkendpoint/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_global_network_endpoint"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/globalnetworkendpointgroup/zz_controller.go b/internal/controller/compute/globalnetworkendpointgroup/zz_controller.go index 373b3faf6..5629f0b06 100755 --- a/internal/controller/compute/globalnetworkendpointgroup/zz_controller.go +++ b/internal/controller/compute/globalnetworkendpointgroup/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_global_network_endpoint_group"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/havpngateway/zz_controller.go b/internal/controller/compute/havpngateway/zz_controller.go index bd69afde7..01aedffc3 100755 --- a/internal/controller/compute/havpngateway/zz_controller.go +++ b/internal/controller/compute/havpngateway/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_ha_vpn_gateway"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/healthcheck/zz_controller.go b/internal/controller/compute/healthcheck/zz_controller.go index 14982cc65..fa56b908b 100755 --- a/internal/controller/compute/healthcheck/zz_controller.go +++ b/internal/controller/compute/healthcheck/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_health_check"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/httphealthcheck/zz_controller.go b/internal/controller/compute/httphealthcheck/zz_controller.go index 5dc3b7512..6aa7eb48a 100755 --- a/internal/controller/compute/httphealthcheck/zz_controller.go +++ b/internal/controller/compute/httphealthcheck/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_http_health_check"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/httpshealthcheck/zz_controller.go b/internal/controller/compute/httpshealthcheck/zz_controller.go index f413175bf..4c7b08d28 100755 --- a/internal/controller/compute/httpshealthcheck/zz_controller.go +++ b/internal/controller/compute/httpshealthcheck/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_https_health_check"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/image/zz_controller.go b/internal/controller/compute/image/zz_controller.go index d23b00702..fe30cc6e4 100755 --- a/internal/controller/compute/image/zz_controller.go +++ b/internal/controller/compute/image/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_image"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/imageiammember/zz_controller.go b/internal/controller/compute/imageiammember/zz_controller.go index e7430ca6e..092ec801d 100755 --- a/internal/controller/compute/imageiammember/zz_controller.go +++ b/internal/controller/compute/imageiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_image_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/instance/zz_controller.go b/internal/controller/compute/instance/zz_controller.go index 4cce767ef..2967d89fb 100755 --- a/internal/controller/compute/instance/zz_controller.go +++ b/internal/controller/compute/instance/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/instancefromtemplate/zz_controller.go b/internal/controller/compute/instancefromtemplate/zz_controller.go index ead8f7038..9c7c0cdc9 100755 --- a/internal/controller/compute/instancefromtemplate/zz_controller.go +++ b/internal/controller/compute/instancefromtemplate/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_from_template"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/instancegroup/zz_controller.go b/internal/controller/compute/instancegroup/zz_controller.go index ba0faa493..39e2a8e61 100755 --- a/internal/controller/compute/instancegroup/zz_controller.go +++ b/internal/controller/compute/instancegroup/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_group"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/instancegroupmanager/zz_controller.go b/internal/controller/compute/instancegroupmanager/zz_controller.go index 5b7817b1c..690d669d1 100755 --- a/internal/controller/compute/instancegroupmanager/zz_controller.go +++ b/internal/controller/compute/instancegroupmanager/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_group_manager"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/instancegroupnamedport/zz_controller.go b/internal/controller/compute/instancegroupnamedport/zz_controller.go index e00a487a0..5885022e7 100755 --- a/internal/controller/compute/instancegroupnamedport/zz_controller.go +++ b/internal/controller/compute/instancegroupnamedport/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_group_named_port"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/instanceiammember/zz_controller.go b/internal/controller/compute/instanceiammember/zz_controller.go index dd08dee4a..8a2ee5a13 100755 --- a/internal/controller/compute/instanceiammember/zz_controller.go +++ b/internal/controller/compute/instanceiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/instancetemplate/zz_controller.go b/internal/controller/compute/instancetemplate/zz_controller.go index b682f3792..ae7e00b25 100755 --- a/internal/controller/compute/instancetemplate/zz_controller.go +++ b/internal/controller/compute/instancetemplate/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_template"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/interconnectattachment/zz_controller.go b/internal/controller/compute/interconnectattachment/zz_controller.go index e52975586..7eba701fb 100755 --- a/internal/controller/compute/interconnectattachment/zz_controller.go +++ b/internal/controller/compute/interconnectattachment/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_interconnect_attachment"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/managedsslcertificate/zz_controller.go b/internal/controller/compute/managedsslcertificate/zz_controller.go index 919438541..6586ddd8d 100755 --- a/internal/controller/compute/managedsslcertificate/zz_controller.go +++ b/internal/controller/compute/managedsslcertificate/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_managed_ssl_certificate"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/network/zz_controller.go b/internal/controller/compute/network/zz_controller.go index ab52c57f1..263008dc8 100755 --- a/internal/controller/compute/network/zz_controller.go +++ b/internal/controller/compute/network/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/networkendpoint/zz_controller.go b/internal/controller/compute/networkendpoint/zz_controller.go index 510c3e1df..dbddf6215 100755 --- a/internal/controller/compute/networkendpoint/zz_controller.go +++ b/internal/controller/compute/networkendpoint/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_endpoint"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/networkendpointgroup/zz_controller.go b/internal/controller/compute/networkendpointgroup/zz_controller.go index 3143316fb..50c435f05 100755 --- a/internal/controller/compute/networkendpointgroup/zz_controller.go +++ b/internal/controller/compute/networkendpointgroup/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_endpoint_group"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/networkfirewallpolicy/zz_controller.go b/internal/controller/compute/networkfirewallpolicy/zz_controller.go index 52d2a5030..c99bf4719 100755 --- a/internal/controller/compute/networkfirewallpolicy/zz_controller.go +++ b/internal/controller/compute/networkfirewallpolicy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_firewall_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/networkfirewallpolicyassociation/zz_controller.go b/internal/controller/compute/networkfirewallpolicyassociation/zz_controller.go index 7e860f971..bcdc66408 100755 --- a/internal/controller/compute/networkfirewallpolicyassociation/zz_controller.go +++ b/internal/controller/compute/networkfirewallpolicyassociation/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_firewall_policy_association"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/networkpeering/zz_controller.go b/internal/controller/compute/networkpeering/zz_controller.go index 8d4415572..c01ac40c5 100755 --- a/internal/controller/compute/networkpeering/zz_controller.go +++ b/internal/controller/compute/networkpeering/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_peering"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/networkpeeringroutesconfig/zz_controller.go b/internal/controller/compute/networkpeeringroutesconfig/zz_controller.go index 20dc38f3a..e70dc8a4f 100755 --- a/internal/controller/compute/networkpeeringroutesconfig/zz_controller.go +++ b/internal/controller/compute/networkpeeringroutesconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_peering_routes_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/nodegroup/zz_controller.go b/internal/controller/compute/nodegroup/zz_controller.go index 0ec8cbe07..cbfba063c 100755 --- a/internal/controller/compute/nodegroup/zz_controller.go +++ b/internal/controller/compute/nodegroup/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_node_group"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/nodetemplate/zz_controller.go b/internal/controller/compute/nodetemplate/zz_controller.go index e0337138e..ba7bf81e4 100755 --- a/internal/controller/compute/nodetemplate/zz_controller.go +++ b/internal/controller/compute/nodetemplate/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_node_template"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/packetmirroring/zz_controller.go b/internal/controller/compute/packetmirroring/zz_controller.go index 65228ec8b..88f694b05 100755 --- a/internal/controller/compute/packetmirroring/zz_controller.go +++ b/internal/controller/compute/packetmirroring/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_packet_mirroring"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/perinstanceconfig/zz_controller.go b/internal/controller/compute/perinstanceconfig/zz_controller.go index 6c61cad57..ca1bb2d51 100755 --- a/internal/controller/compute/perinstanceconfig/zz_controller.go +++ b/internal/controller/compute/perinstanceconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_per_instance_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/projectdefaultnetworktier/zz_controller.go b/internal/controller/compute/projectdefaultnetworktier/zz_controller.go index 2edb150a0..9c1be0abf 100755 --- a/internal/controller/compute/projectdefaultnetworktier/zz_controller.go +++ b/internal/controller/compute/projectdefaultnetworktier/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_project_default_network_tier"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/projectmetadata/zz_controller.go b/internal/controller/compute/projectmetadata/zz_controller.go index a33ebcb76..6916a4cdd 100755 --- a/internal/controller/compute/projectmetadata/zz_controller.go +++ b/internal/controller/compute/projectmetadata/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_project_metadata"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/projectmetadataitem/zz_controller.go b/internal/controller/compute/projectmetadataitem/zz_controller.go index 3d7dc59f5..5f3070aec 100755 --- a/internal/controller/compute/projectmetadataitem/zz_controller.go +++ b/internal/controller/compute/projectmetadataitem/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_project_metadata_item"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regionautoscaler/zz_controller.go b/internal/controller/compute/regionautoscaler/zz_controller.go index b576a5e4c..d1115c36b 100755 --- a/internal/controller/compute/regionautoscaler/zz_controller.go +++ b/internal/controller/compute/regionautoscaler/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_autoscaler"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regionbackendservice/zz_controller.go b/internal/controller/compute/regionbackendservice/zz_controller.go index ee32e98ee..e9a21fcea 100755 --- a/internal/controller/compute/regionbackendservice/zz_controller.go +++ b/internal/controller/compute/regionbackendservice/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_backend_service"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regiondisk/zz_controller.go b/internal/controller/compute/regiondisk/zz_controller.go index 9bf19d125..7311c0d32 100755 --- a/internal/controller/compute/regiondisk/zz_controller.go +++ b/internal/controller/compute/regiondisk/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_disk"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regiondiskiammember/zz_controller.go b/internal/controller/compute/regiondiskiammember/zz_controller.go index 27366ded3..94cfdfb7e 100755 --- a/internal/controller/compute/regiondiskiammember/zz_controller.go +++ b/internal/controller/compute/regiondiskiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_disk_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regiondiskresourcepolicyattachment/zz_controller.go b/internal/controller/compute/regiondiskresourcepolicyattachment/zz_controller.go index 4f7a95ddc..c36f86c81 100755 --- a/internal/controller/compute/regiondiskresourcepolicyattachment/zz_controller.go +++ b/internal/controller/compute/regiondiskresourcepolicyattachment/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_disk_resource_policy_attachment"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regionhealthcheck/zz_controller.go b/internal/controller/compute/regionhealthcheck/zz_controller.go index 6d41eba59..1ec26f09a 100755 --- a/internal/controller/compute/regionhealthcheck/zz_controller.go +++ b/internal/controller/compute/regionhealthcheck/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_health_check"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regioninstancegroupmanager/zz_controller.go b/internal/controller/compute/regioninstancegroupmanager/zz_controller.go index 15809a106..9262ee2b4 100755 --- a/internal/controller/compute/regioninstancegroupmanager/zz_controller.go +++ b/internal/controller/compute/regioninstancegroupmanager/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_instance_group_manager"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regionnetworkendpointgroup/zz_controller.go b/internal/controller/compute/regionnetworkendpointgroup/zz_controller.go index 3a5a86ffa..67ac7265b 100755 --- a/internal/controller/compute/regionnetworkendpointgroup/zz_controller.go +++ b/internal/controller/compute/regionnetworkendpointgroup/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_network_endpoint_group"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regionnetworkfirewallpolicy/zz_controller.go b/internal/controller/compute/regionnetworkfirewallpolicy/zz_controller.go index 88762af15..2038319df 100755 --- a/internal/controller/compute/regionnetworkfirewallpolicy/zz_controller.go +++ b/internal/controller/compute/regionnetworkfirewallpolicy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_network_firewall_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regionnetworkfirewallpolicyassociation/zz_controller.go b/internal/controller/compute/regionnetworkfirewallpolicyassociation/zz_controller.go index 37e0d5fe5..269dfec39 100755 --- a/internal/controller/compute/regionnetworkfirewallpolicyassociation/zz_controller.go +++ b/internal/controller/compute/regionnetworkfirewallpolicyassociation/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_network_firewall_policy_association"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regionperinstanceconfig/zz_controller.go b/internal/controller/compute/regionperinstanceconfig/zz_controller.go index 2ccd9193b..57afc1c6c 100755 --- a/internal/controller/compute/regionperinstanceconfig/zz_controller.go +++ b/internal/controller/compute/regionperinstanceconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_per_instance_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regionsslcertificate/zz_controller.go b/internal/controller/compute/regionsslcertificate/zz_controller.go index d74359e07..d9205b0fa 100755 --- a/internal/controller/compute/regionsslcertificate/zz_controller.go +++ b/internal/controller/compute/regionsslcertificate/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_ssl_certificate"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regiontargethttpproxy/zz_controller.go b/internal/controller/compute/regiontargethttpproxy/zz_controller.go index 0ba011020..805d031f3 100755 --- a/internal/controller/compute/regiontargethttpproxy/zz_controller.go +++ b/internal/controller/compute/regiontargethttpproxy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_target_http_proxy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regiontargethttpsproxy/zz_controller.go b/internal/controller/compute/regiontargethttpsproxy/zz_controller.go index 74c0f5e7f..e277ea8f4 100755 --- a/internal/controller/compute/regiontargethttpsproxy/zz_controller.go +++ b/internal/controller/compute/regiontargethttpsproxy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_target_https_proxy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/regionurlmap/zz_controller.go b/internal/controller/compute/regionurlmap/zz_controller.go index 52ed96769..a7212ec60 100755 --- a/internal/controller/compute/regionurlmap/zz_controller.go +++ b/internal/controller/compute/regionurlmap/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_url_map"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/reservation/zz_controller.go b/internal/controller/compute/reservation/zz_controller.go index 65bfc7268..705db035a 100755 --- a/internal/controller/compute/reservation/zz_controller.go +++ b/internal/controller/compute/reservation/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_reservation"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/resourcepolicy/zz_controller.go b/internal/controller/compute/resourcepolicy/zz_controller.go index 1611e2b71..3f520399e 100755 --- a/internal/controller/compute/resourcepolicy/zz_controller.go +++ b/internal/controller/compute/resourcepolicy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_resource_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/route/zz_controller.go b/internal/controller/compute/route/zz_controller.go index 693dd4a0c..fd9631cd0 100755 --- a/internal/controller/compute/route/zz_controller.go +++ b/internal/controller/compute/route/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_route"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/router/zz_controller.go b/internal/controller/compute/router/zz_controller.go index e154ecc21..982dc3e06 100755 --- a/internal/controller/compute/router/zz_controller.go +++ b/internal/controller/compute/router/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_router"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/routerinterface/zz_controller.go b/internal/controller/compute/routerinterface/zz_controller.go index 73d5c3966..1695c2bc8 100755 --- a/internal/controller/compute/routerinterface/zz_controller.go +++ b/internal/controller/compute/routerinterface/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_router_interface"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/routernat/zz_controller.go b/internal/controller/compute/routernat/zz_controller.go index 1e75e5666..d459784cb 100755 --- a/internal/controller/compute/routernat/zz_controller.go +++ b/internal/controller/compute/routernat/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_router_nat"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/securitypolicy/zz_controller.go b/internal/controller/compute/securitypolicy/zz_controller.go index 30b5cf3eb..e7e3213e7 100755 --- a/internal/controller/compute/securitypolicy/zz_controller.go +++ b/internal/controller/compute/securitypolicy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_security_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/serviceattachment/zz_controller.go b/internal/controller/compute/serviceattachment/zz_controller.go index b29131daa..f7b5ea871 100755 --- a/internal/controller/compute/serviceattachment/zz_controller.go +++ b/internal/controller/compute/serviceattachment/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_service_attachment"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/snapshot/zz_controller.go b/internal/controller/compute/snapshot/zz_controller.go index e674cc5d5..ee9957793 100755 --- a/internal/controller/compute/snapshot/zz_controller.go +++ b/internal/controller/compute/snapshot/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_snapshot"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/snapshotiammember/zz_controller.go b/internal/controller/compute/snapshotiammember/zz_controller.go index 8bda1d23a..87c3611ac 100755 --- a/internal/controller/compute/snapshotiammember/zz_controller.go +++ b/internal/controller/compute/snapshotiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_snapshot_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/sslcertificate/zz_controller.go b/internal/controller/compute/sslcertificate/zz_controller.go index 64b865ca7..dc34a444e 100755 --- a/internal/controller/compute/sslcertificate/zz_controller.go +++ b/internal/controller/compute/sslcertificate/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_ssl_certificate"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/sslpolicy/zz_controller.go b/internal/controller/compute/sslpolicy/zz_controller.go index 1ec2bee90..63c50d472 100755 --- a/internal/controller/compute/sslpolicy/zz_controller.go +++ b/internal/controller/compute/sslpolicy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_ssl_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/subnetwork/zz_controller.go b/internal/controller/compute/subnetwork/zz_controller.go index f9e40b868..7897016da 100755 --- a/internal/controller/compute/subnetwork/zz_controller.go +++ b/internal/controller/compute/subnetwork/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_subnetwork"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/subnetworkiammember/zz_controller.go b/internal/controller/compute/subnetworkiammember/zz_controller.go index 18b85f274..0f1e47b81 100755 --- a/internal/controller/compute/subnetworkiammember/zz_controller.go +++ b/internal/controller/compute/subnetworkiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_subnetwork_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/targetgrpcproxy/zz_controller.go b/internal/controller/compute/targetgrpcproxy/zz_controller.go index 8f5c70086..e579343a2 100755 --- a/internal/controller/compute/targetgrpcproxy/zz_controller.go +++ b/internal/controller/compute/targetgrpcproxy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_grpc_proxy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/targethttpproxy/zz_controller.go b/internal/controller/compute/targethttpproxy/zz_controller.go index 94327e7d0..12f7c1a09 100755 --- a/internal/controller/compute/targethttpproxy/zz_controller.go +++ b/internal/controller/compute/targethttpproxy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_http_proxy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/targethttpsproxy/zz_controller.go b/internal/controller/compute/targethttpsproxy/zz_controller.go index 0dbc873fa..8462a0c6c 100755 --- a/internal/controller/compute/targethttpsproxy/zz_controller.go +++ b/internal/controller/compute/targethttpsproxy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_https_proxy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/targetinstance/zz_controller.go b/internal/controller/compute/targetinstance/zz_controller.go index 1b1c3408c..801180727 100755 --- a/internal/controller/compute/targetinstance/zz_controller.go +++ b/internal/controller/compute/targetinstance/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/targetpool/zz_controller.go b/internal/controller/compute/targetpool/zz_controller.go index 31dea1952..237aeccc2 100755 --- a/internal/controller/compute/targetpool/zz_controller.go +++ b/internal/controller/compute/targetpool/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_pool"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/targetsslproxy/zz_controller.go b/internal/controller/compute/targetsslproxy/zz_controller.go index 040f08a23..9051f3ea4 100755 --- a/internal/controller/compute/targetsslproxy/zz_controller.go +++ b/internal/controller/compute/targetsslproxy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_ssl_proxy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/targettcpproxy/zz_controller.go b/internal/controller/compute/targettcpproxy/zz_controller.go index 7f884e4a3..947b8d7f2 100755 --- a/internal/controller/compute/targettcpproxy/zz_controller.go +++ b/internal/controller/compute/targettcpproxy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_tcp_proxy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/urlmap/zz_controller.go b/internal/controller/compute/urlmap/zz_controller.go index 42fb64220..1ae9f3bd7 100755 --- a/internal/controller/compute/urlmap/zz_controller.go +++ b/internal/controller/compute/urlmap/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_url_map"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/vpngateway/zz_controller.go b/internal/controller/compute/vpngateway/zz_controller.go index 448a7954e..4e42f95f4 100755 --- a/internal/controller/compute/vpngateway/zz_controller.go +++ b/internal/controller/compute/vpngateway/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_vpn_gateway"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/compute/vpntunnel/zz_controller.go b/internal/controller/compute/vpntunnel/zz_controller.go index d0f1ca85c..876d09356 100755 --- a/internal/controller/compute/vpntunnel/zz_controller.go +++ b/internal/controller/compute/vpntunnel/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_vpn_tunnel"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/container/cluster/zz_controller.go b/internal/controller/container/cluster/zz_controller.go index 8d50444f7..53f394341 100755 --- a/internal/controller/container/cluster/zz_controller.go +++ b/internal/controller/container/cluster/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_cluster"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/container/nodepool/zz_controller.go b/internal/controller/container/nodepool/zz_controller.go index c46f27db9..bf45022ff 100755 --- a/internal/controller/container/nodepool/zz_controller.go +++ b/internal/controller/container/nodepool/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_node_pool"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/container/registry/zz_controller.go b/internal/controller/container/registry/zz_controller.go index e3c59f16b..4b55a6871 100755 --- a/internal/controller/container/registry/zz_controller.go +++ b/internal/controller/container/registry/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_registry"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/containeranalysis/note/zz_controller.go b/internal/controller/containeranalysis/note/zz_controller.go index bc3ad8b12..e7595be33 100755 --- a/internal/controller/containeranalysis/note/zz_controller.go +++ b/internal/controller/containeranalysis/note/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_analysis_note"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/containeraws/cluster/zz_controller.go b/internal/controller/containeraws/cluster/zz_controller.go index 7d621afab..6e43a2bd0 100755 --- a/internal/controller/containeraws/cluster/zz_controller.go +++ b/internal/controller/containeraws/cluster/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_aws_cluster"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/containeraws/nodepool/zz_controller.go b/internal/controller/containeraws/nodepool/zz_controller.go index 8b3358d7f..17031e73e 100755 --- a/internal/controller/containeraws/nodepool/zz_controller.go +++ b/internal/controller/containeraws/nodepool/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_aws_node_pool"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/containerazure/client/zz_controller.go b/internal/controller/containerazure/client/zz_controller.go index 9094fc1be..65dda0ab3 100755 --- a/internal/controller/containerazure/client/zz_controller.go +++ b/internal/controller/containerazure/client/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_azure_client"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/containerazure/cluster/zz_controller.go b/internal/controller/containerazure/cluster/zz_controller.go index ff0c03a15..56bad2845 100755 --- a/internal/controller/containerazure/cluster/zz_controller.go +++ b/internal/controller/containerazure/cluster/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_azure_cluster"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/containerazure/nodepool/zz_controller.go b/internal/controller/containerazure/nodepool/zz_controller.go index de2213e49..c4839f47a 100755 --- a/internal/controller/containerazure/nodepool/zz_controller.go +++ b/internal/controller/containerazure/nodepool/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_azure_node_pool"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datacatalog/entry/zz_controller.go b/internal/controller/datacatalog/entry/zz_controller.go index 29b7ed995..b70ef13c0 100755 --- a/internal/controller/datacatalog/entry/zz_controller.go +++ b/internal/controller/datacatalog/entry/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_catalog_entry"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datacatalog/entrygroup/zz_controller.go b/internal/controller/datacatalog/entrygroup/zz_controller.go index ca7e31448..a9e770144 100755 --- a/internal/controller/datacatalog/entrygroup/zz_controller.go +++ b/internal/controller/datacatalog/entrygroup/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_catalog_entry_group"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datacatalog/tag/zz_controller.go b/internal/controller/datacatalog/tag/zz_controller.go index 223b17f27..b89701c98 100755 --- a/internal/controller/datacatalog/tag/zz_controller.go +++ b/internal/controller/datacatalog/tag/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_catalog_tag"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datacatalog/tagtemplate/zz_controller.go b/internal/controller/datacatalog/tagtemplate/zz_controller.go index 209018399..cccfe414a 100755 --- a/internal/controller/datacatalog/tagtemplate/zz_controller.go +++ b/internal/controller/datacatalog/tagtemplate/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_catalog_tag_template"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dataflow/job/zz_controller.go b/internal/controller/dataflow/job/zz_controller.go index 51b759640..0091e3d12 100755 --- a/internal/controller/dataflow/job/zz_controller.go +++ b/internal/controller/dataflow/job/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataflow_job"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datafusion/instance/zz_controller.go b/internal/controller/datafusion/instance/zz_controller.go index a6ba832f1..9f761791c 100755 --- a/internal/controller/datafusion/instance/zz_controller.go +++ b/internal/controller/datafusion/instance/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_fusion_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datalossprevention/deidentifytemplate/zz_controller.go b/internal/controller/datalossprevention/deidentifytemplate/zz_controller.go index d9957dcac..26ae785ee 100755 --- a/internal/controller/datalossprevention/deidentifytemplate/zz_controller.go +++ b/internal/controller/datalossprevention/deidentifytemplate/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_deidentify_template"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datalossprevention/inspecttemplate/zz_controller.go b/internal/controller/datalossprevention/inspecttemplate/zz_controller.go index 0b1d23eb0..3681ddcee 100755 --- a/internal/controller/datalossprevention/inspecttemplate/zz_controller.go +++ b/internal/controller/datalossprevention/inspecttemplate/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_inspect_template"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datalossprevention/jobtrigger/zz_controller.go b/internal/controller/datalossprevention/jobtrigger/zz_controller.go index 3a399d7b2..03a9d18d7 100755 --- a/internal/controller/datalossprevention/jobtrigger/zz_controller.go +++ b/internal/controller/datalossprevention/jobtrigger/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_job_trigger"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datalossprevention/storedinfotype/zz_controller.go b/internal/controller/datalossprevention/storedinfotype/zz_controller.go index 3cf35f2f0..2a1943bbb 100755 --- a/internal/controller/datalossprevention/storedinfotype/zz_controller.go +++ b/internal/controller/datalossprevention/storedinfotype/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_stored_info_type"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dataplex/asset/zz_controller.go b/internal/controller/dataplex/asset/zz_controller.go index 06feb7c22..fcbac4e83 100755 --- a/internal/controller/dataplex/asset/zz_controller.go +++ b/internal/controller/dataplex/asset/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataplex_asset"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dataplex/lake/zz_controller.go b/internal/controller/dataplex/lake/zz_controller.go index d9ab5b198..336d8eab5 100755 --- a/internal/controller/dataplex/lake/zz_controller.go +++ b/internal/controller/dataplex/lake/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataplex_lake"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dataplex/zone/zz_controller.go b/internal/controller/dataplex/zone/zz_controller.go index f52394ede..5935055c4 100755 --- a/internal/controller/dataplex/zone/zz_controller.go +++ b/internal/controller/dataplex/zone/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataplex_zone"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dataproc/autoscalingpolicy/zz_controller.go b/internal/controller/dataproc/autoscalingpolicy/zz_controller.go index f3d1afe8b..52e6e4970 100755 --- a/internal/controller/dataproc/autoscalingpolicy/zz_controller.go +++ b/internal/controller/dataproc/autoscalingpolicy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataproc_autoscaling_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dataproc/cluster/zz_controller.go b/internal/controller/dataproc/cluster/zz_controller.go index cbee6a73f..c1521e453 100755 --- a/internal/controller/dataproc/cluster/zz_controller.go +++ b/internal/controller/dataproc/cluster/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataproc_cluster"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dataproc/job/zz_controller.go b/internal/controller/dataproc/job/zz_controller.go index adda10919..ddb6b4c5a 100755 --- a/internal/controller/dataproc/job/zz_controller.go +++ b/internal/controller/dataproc/job/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataproc_job"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dataproc/metastoreservice/zz_controller.go b/internal/controller/dataproc/metastoreservice/zz_controller.go index d1d25a9a3..beb93cbb5 100755 --- a/internal/controller/dataproc/metastoreservice/zz_controller.go +++ b/internal/controller/dataproc/metastoreservice/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataproc_metastore_service"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dataproc/workflowtemplate/zz_controller.go b/internal/controller/dataproc/workflowtemplate/zz_controller.go index fa70408ff..eb225a4c1 100755 --- a/internal/controller/dataproc/workflowtemplate/zz_controller.go +++ b/internal/controller/dataproc/workflowtemplate/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataproc_workflow_template"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datastore/index/zz_controller.go b/internal/controller/datastore/index/zz_controller.go index 3597a5db2..1231cd8bb 100755 --- a/internal/controller/datastore/index/zz_controller.go +++ b/internal/controller/datastore/index/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_datastore_index"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datastream/connectionprofile/zz_controller.go b/internal/controller/datastream/connectionprofile/zz_controller.go index 6c4912053..1a3326ede 100755 --- a/internal/controller/datastream/connectionprofile/zz_controller.go +++ b/internal/controller/datastream/connectionprofile/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_datastream_connection_profile"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/datastream/privateconnection/zz_controller.go b/internal/controller/datastream/privateconnection/zz_controller.go index 1dab49fe3..2fa69d45e 100755 --- a/internal/controller/datastream/privateconnection/zz_controller.go +++ b/internal/controller/datastream/privateconnection/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_datastream_private_connection"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dialogflowcx/agent/zz_controller.go b/internal/controller/dialogflowcx/agent/zz_controller.go index 1a179a182..a468493fb 100755 --- a/internal/controller/dialogflowcx/agent/zz_controller.go +++ b/internal/controller/dialogflowcx/agent/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_agent"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dialogflowcx/entitytype/zz_controller.go b/internal/controller/dialogflowcx/entitytype/zz_controller.go index 34fd8599f..bee4d3073 100755 --- a/internal/controller/dialogflowcx/entitytype/zz_controller.go +++ b/internal/controller/dialogflowcx/entitytype/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_entity_type"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dialogflowcx/environment/zz_controller.go b/internal/controller/dialogflowcx/environment/zz_controller.go index a5025a776..e490d48f9 100755 --- a/internal/controller/dialogflowcx/environment/zz_controller.go +++ b/internal/controller/dialogflowcx/environment/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_environment"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dialogflowcx/flow/zz_controller.go b/internal/controller/dialogflowcx/flow/zz_controller.go index c9a218078..8be6322d1 100755 --- a/internal/controller/dialogflowcx/flow/zz_controller.go +++ b/internal/controller/dialogflowcx/flow/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_flow"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dialogflowcx/intent/zz_controller.go b/internal/controller/dialogflowcx/intent/zz_controller.go index 17a2ae4ea..a08f4e87d 100755 --- a/internal/controller/dialogflowcx/intent/zz_controller.go +++ b/internal/controller/dialogflowcx/intent/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_intent"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dialogflowcx/page/zz_controller.go b/internal/controller/dialogflowcx/page/zz_controller.go index cd012fcfa..5deeab88c 100755 --- a/internal/controller/dialogflowcx/page/zz_controller.go +++ b/internal/controller/dialogflowcx/page/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_page"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dialogflowcx/version/zz_controller.go b/internal/controller/dialogflowcx/version/zz_controller.go index 01f0dac9e..b462c5fed 100755 --- a/internal/controller/dialogflowcx/version/zz_controller.go +++ b/internal/controller/dialogflowcx/version/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_version"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dialogflowcx/webhook/zz_controller.go b/internal/controller/dialogflowcx/webhook/zz_controller.go index 9eff400c3..e52194aa1 100755 --- a/internal/controller/dialogflowcx/webhook/zz_controller.go +++ b/internal/controller/dialogflowcx/webhook/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_webhook"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dns/managedzone/zz_controller.go b/internal/controller/dns/managedzone/zz_controller.go index a24f0b1da..a0c16f289 100755 --- a/internal/controller/dns/managedzone/zz_controller.go +++ b/internal/controller/dns/managedzone/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dns_managed_zone"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dns/managedzoneiammember/zz_controller.go b/internal/controller/dns/managedzoneiammember/zz_controller.go index 99b55e489..d64ecd504 100755 --- a/internal/controller/dns/managedzoneiammember/zz_controller.go +++ b/internal/controller/dns/managedzoneiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dns_managed_zone_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dns/policy/zz_controller.go b/internal/controller/dns/policy/zz_controller.go index 2ee70bb55..c065f599b 100755 --- a/internal/controller/dns/policy/zz_controller.go +++ b/internal/controller/dns/policy/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dns_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/dns/recordset/zz_controller.go b/internal/controller/dns/recordset/zz_controller.go index 4d56e17d7..043fcbd92 100755 --- a/internal/controller/dns/recordset/zz_controller.go +++ b/internal/controller/dns/recordset/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dns_record_set"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/documentai/processor/zz_controller.go b/internal/controller/documentai/processor/zz_controller.go index 7005840b9..377e4adb8 100755 --- a/internal/controller/documentai/processor/zz_controller.go +++ b/internal/controller/documentai/processor/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_document_ai_processor"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/essentialcontacts/contact/zz_controller.go b/internal/controller/essentialcontacts/contact/zz_controller.go index 469927206..85ab06f93 100755 --- a/internal/controller/essentialcontacts/contact/zz_controller.go +++ b/internal/controller/essentialcontacts/contact/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_essential_contacts_contact"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/eventarc/channel/zz_controller.go b/internal/controller/eventarc/channel/zz_controller.go index c6bc80a93..236802c90 100755 --- a/internal/controller/eventarc/channel/zz_controller.go +++ b/internal/controller/eventarc/channel/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_eventarc_channel"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/eventarc/googlechannelconfig/zz_controller.go b/internal/controller/eventarc/googlechannelconfig/zz_controller.go index 4f44a3500..6bc83c7d7 100755 --- a/internal/controller/eventarc/googlechannelconfig/zz_controller.go +++ b/internal/controller/eventarc/googlechannelconfig/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_eventarc_google_channel_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/eventarc/trigger/zz_controller.go b/internal/controller/eventarc/trigger/zz_controller.go index 37d0c7d22..b0fe4a265 100755 --- a/internal/controller/eventarc/trigger/zz_controller.go +++ b/internal/controller/eventarc/trigger/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_eventarc_trigger"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/filestore/backup/zz_controller.go b/internal/controller/filestore/backup/zz_controller.go index 6746ea9e8..ae591e4a8 100755 --- a/internal/controller/filestore/backup/zz_controller.go +++ b/internal/controller/filestore/backup/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_filestore_backup"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/filestore/instance/zz_controller.go b/internal/controller/filestore/instance/zz_controller.go index 169992da3..44767afbf 100755 --- a/internal/controller/filestore/instance/zz_controller.go +++ b/internal/controller/filestore/instance/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_filestore_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/filestore/snapshot/zz_controller.go b/internal/controller/filestore/snapshot/zz_controller.go index b7c9f97b7..be761e12f 100755 --- a/internal/controller/filestore/snapshot/zz_controller.go +++ b/internal/controller/filestore/snapshot/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_filestore_snapshot"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/firebaserules/release/zz_controller.go b/internal/controller/firebaserules/release/zz_controller.go index 8573ec069..fa93a36e3 100755 --- a/internal/controller/firebaserules/release/zz_controller.go +++ b/internal/controller/firebaserules/release/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_firebaserules_release"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/firebaserules/ruleset/zz_controller.go b/internal/controller/firebaserules/ruleset/zz_controller.go index e32810599..73aff7053 100755 --- a/internal/controller/firebaserules/ruleset/zz_controller.go +++ b/internal/controller/firebaserules/ruleset/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_firebaserules_ruleset"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/gke/backupbackupplan/zz_controller.go b/internal/controller/gke/backupbackupplan/zz_controller.go index 3d8097fca..a45b8f922 100755 --- a/internal/controller/gke/backupbackupplan/zz_controller.go +++ b/internal/controller/gke/backupbackupplan/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_gke_backup_backup_plan"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/gkehub/membership/zz_controller.go b/internal/controller/gkehub/membership/zz_controller.go index d8c252abc..2bc1429ba 100755 --- a/internal/controller/gkehub/membership/zz_controller.go +++ b/internal/controller/gkehub/membership/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_gke_hub_membership"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/gkehub/membershipiammember/zz_controller.go b/internal/controller/gkehub/membershipiammember/zz_controller.go index 5fddf0eee..5966c8457 100755 --- a/internal/controller/gkehub/membershipiammember/zz_controller.go +++ b/internal/controller/gkehub/membershipiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_gke_hub_membership_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/healthcare/consentstore/zz_controller.go b/internal/controller/healthcare/consentstore/zz_controller.go index 6d23607fd..c6e8de35f 100755 --- a/internal/controller/healthcare/consentstore/zz_controller.go +++ b/internal/controller/healthcare/consentstore/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_healthcare_consent_store"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/healthcare/dataset/zz_controller.go b/internal/controller/healthcare/dataset/zz_controller.go index 6a9e5c5f9..ed569b186 100755 --- a/internal/controller/healthcare/dataset/zz_controller.go +++ b/internal/controller/healthcare/dataset/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_healthcare_dataset"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/healthcare/datasetiammember/zz_controller.go b/internal/controller/healthcare/datasetiammember/zz_controller.go index 4c352b12b..074b0e693 100755 --- a/internal/controller/healthcare/datasetiammember/zz_controller.go +++ b/internal/controller/healthcare/datasetiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_healthcare_dataset_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/iam/workloadidentitypool/zz_controller.go b/internal/controller/iam/workloadidentitypool/zz_controller.go index d6943f7fc..c00158b70 100755 --- a/internal/controller/iam/workloadidentitypool/zz_controller.go +++ b/internal/controller/iam/workloadidentitypool/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iam_workload_identity_pool"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/iam/workloadidentitypoolprovider/zz_controller.go b/internal/controller/iam/workloadidentitypoolprovider/zz_controller.go index cf6463a9b..9bfd9badc 100755 --- a/internal/controller/iam/workloadidentitypoolprovider/zz_controller.go +++ b/internal/controller/iam/workloadidentitypoolprovider/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iam_workload_identity_pool_provider"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/iap/appengineserviceiammember/zz_controller.go b/internal/controller/iap/appengineserviceiammember/zz_controller.go index 17379eef8..9da370d83 100755 --- a/internal/controller/iap/appengineserviceiammember/zz_controller.go +++ b/internal/controller/iap/appengineserviceiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_app_engine_service_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/iap/appengineversioniammember/zz_controller.go b/internal/controller/iap/appengineversioniammember/zz_controller.go index 20662796f..1adf38483 100755 --- a/internal/controller/iap/appengineversioniammember/zz_controller.go +++ b/internal/controller/iap/appengineversioniammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_app_engine_version_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/iap/tunneliammember/zz_controller.go b/internal/controller/iap/tunneliammember/zz_controller.go index 2eae3ae03..4df6ad339 100755 --- a/internal/controller/iap/tunneliammember/zz_controller.go +++ b/internal/controller/iap/tunneliammember/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_tunnel_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/iap/webbackendserviceiammember/zz_controller.go b/internal/controller/iap/webbackendserviceiammember/zz_controller.go index 98543d2c5..e08c1f9af 100755 --- a/internal/controller/iap/webbackendserviceiammember/zz_controller.go +++ b/internal/controller/iap/webbackendserviceiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_web_backend_service_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/iap/webiammember/zz_controller.go b/internal/controller/iap/webiammember/zz_controller.go index 0f4e1d3d9..09374a1b5 100755 --- a/internal/controller/iap/webiammember/zz_controller.go +++ b/internal/controller/iap/webiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_web_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/iap/webtypeappengineiammember/zz_controller.go b/internal/controller/iap/webtypeappengineiammember/zz_controller.go index eb07204bf..04187dd87 100755 --- a/internal/controller/iap/webtypeappengineiammember/zz_controller.go +++ b/internal/controller/iap/webtypeappengineiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_web_type_app_engine_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/iap/webtypecomputeiammember/zz_controller.go b/internal/controller/iap/webtypecomputeiammember/zz_controller.go index 556fdf871..f56ae9c0f 100755 --- a/internal/controller/iap/webtypecomputeiammember/zz_controller.go +++ b/internal/controller/iap/webtypecomputeiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_web_type_compute_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/identityplatform/defaultsupportedidpconfig/zz_controller.go b/internal/controller/identityplatform/defaultsupportedidpconfig/zz_controller.go index 5a4b0d0a3..28549863c 100755 --- a/internal/controller/identityplatform/defaultsupportedidpconfig/zz_controller.go +++ b/internal/controller/identityplatform/defaultsupportedidpconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_default_supported_idp_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/identityplatform/inboundsamlconfig/zz_controller.go b/internal/controller/identityplatform/inboundsamlconfig/zz_controller.go index a10f19dee..8645fbdb5 100755 --- a/internal/controller/identityplatform/inboundsamlconfig/zz_controller.go +++ b/internal/controller/identityplatform/inboundsamlconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_inbound_saml_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/identityplatform/oauthidpconfig/zz_controller.go b/internal/controller/identityplatform/oauthidpconfig/zz_controller.go index 4d259125e..b8088e0fc 100755 --- a/internal/controller/identityplatform/oauthidpconfig/zz_controller.go +++ b/internal/controller/identityplatform/oauthidpconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_oauth_idp_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/identityplatform/projectdefaultconfig/zz_controller.go b/internal/controller/identityplatform/projectdefaultconfig/zz_controller.go index c50571c1a..a961e25c0 100755 --- a/internal/controller/identityplatform/projectdefaultconfig/zz_controller.go +++ b/internal/controller/identityplatform/projectdefaultconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_project_default_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/identityplatform/tenant/zz_controller.go b/internal/controller/identityplatform/tenant/zz_controller.go index e56680bff..375ecfa32 100755 --- a/internal/controller/identityplatform/tenant/zz_controller.go +++ b/internal/controller/identityplatform/tenant/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/identityplatform/tenantdefaultsupportedidpconfig/zz_controller.go b/internal/controller/identityplatform/tenantdefaultsupportedidpconfig/zz_controller.go index 48d26a02f..4bc90cdee 100755 --- a/internal/controller/identityplatform/tenantdefaultsupportedidpconfig/zz_controller.go +++ b/internal/controller/identityplatform/tenantdefaultsupportedidpconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant_default_supported_idp_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/identityplatform/tenantinboundsamlconfig/zz_controller.go b/internal/controller/identityplatform/tenantinboundsamlconfig/zz_controller.go index 8ae31dcf7..4b79f84b2 100755 --- a/internal/controller/identityplatform/tenantinboundsamlconfig/zz_controller.go +++ b/internal/controller/identityplatform/tenantinboundsamlconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant_inbound_saml_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/identityplatform/tenantoauthidpconfig/zz_controller.go b/internal/controller/identityplatform/tenantoauthidpconfig/zz_controller.go index a76987fa3..e8e7bedf3 100755 --- a/internal/controller/identityplatform/tenantoauthidpconfig/zz_controller.go +++ b/internal/controller/identityplatform/tenantoauthidpconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant_oauth_idp_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/kms/cryptokey/zz_controller.go b/internal/controller/kms/cryptokey/zz_controller.go index c7704e8c2..ae57bf1fd 100755 --- a/internal/controller/kms/cryptokey/zz_controller.go +++ b/internal/controller/kms/cryptokey/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_crypto_key"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/kms/cryptokeyiammember/zz_controller.go b/internal/controller/kms/cryptokeyiammember/zz_controller.go index f4ca9d927..191b478aa 100755 --- a/internal/controller/kms/cryptokeyiammember/zz_controller.go +++ b/internal/controller/kms/cryptokeyiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_crypto_key_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/kms/cryptokeyversion/zz_controller.go b/internal/controller/kms/cryptokeyversion/zz_controller.go index af8c34c65..a3d22e6d7 100755 --- a/internal/controller/kms/cryptokeyversion/zz_controller.go +++ b/internal/controller/kms/cryptokeyversion/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_crypto_key_version"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/kms/keyring/zz_controller.go b/internal/controller/kms/keyring/zz_controller.go index 3aa52f691..a5a0299bd 100755 --- a/internal/controller/kms/keyring/zz_controller.go +++ b/internal/controller/kms/keyring/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_key_ring"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/kms/keyringiammember/zz_controller.go b/internal/controller/kms/keyringiammember/zz_controller.go index bccffa67c..5169169fb 100755 --- a/internal/controller/kms/keyringiammember/zz_controller.go +++ b/internal/controller/kms/keyringiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_key_ring_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/kms/keyringimportjob/zz_controller.go b/internal/controller/kms/keyringimportjob/zz_controller.go index 15936a8e5..e09b5e308 100755 --- a/internal/controller/kms/keyringimportjob/zz_controller.go +++ b/internal/controller/kms/keyringimportjob/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_key_ring_import_job"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/kms/secretciphertext/zz_controller.go b/internal/controller/kms/secretciphertext/zz_controller.go index 1d20e3af6..c5e9b7ff3 100755 --- a/internal/controller/kms/secretciphertext/zz_controller.go +++ b/internal/controller/kms/secretciphertext/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_secret_ciphertext"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/logging/logview/zz_controller.go b/internal/controller/logging/logview/zz_controller.go index 9fe058f7b..1e76cb71f 100755 --- a/internal/controller/logging/logview/zz_controller.go +++ b/internal/controller/logging/logview/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_logging_log_view"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/logging/metric/zz_controller.go b/internal/controller/logging/metric/zz_controller.go index 6f895c4bb..27376189f 100755 --- a/internal/controller/logging/metric/zz_controller.go +++ b/internal/controller/logging/metric/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_logging_metric"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/logging/projectbucketconfig/zz_controller.go b/internal/controller/logging/projectbucketconfig/zz_controller.go index 2f2c287b6..e7fb2900d 100755 --- a/internal/controller/logging/projectbucketconfig/zz_controller.go +++ b/internal/controller/logging/projectbucketconfig/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_logging_project_bucket_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/logging/projectexclusion/zz_controller.go b/internal/controller/logging/projectexclusion/zz_controller.go index 8d4d468f6..480e4371f 100755 --- a/internal/controller/logging/projectexclusion/zz_controller.go +++ b/internal/controller/logging/projectexclusion/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_logging_project_exclusion"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/logging/projectsink/zz_controller.go b/internal/controller/logging/projectsink/zz_controller.go index 1522687cf..641837d35 100755 --- a/internal/controller/logging/projectsink/zz_controller.go +++ b/internal/controller/logging/projectsink/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_logging_project_sink"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/memcache/instance/zz_controller.go b/internal/controller/memcache/instance/zz_controller.go index 7c469fe28..da3719981 100755 --- a/internal/controller/memcache/instance/zz_controller.go +++ b/internal/controller/memcache/instance/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_memcache_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/mlengine/model/zz_controller.go b/internal/controller/mlengine/model/zz_controller.go index de987ac08..32a6c4246 100755 --- a/internal/controller/mlengine/model/zz_controller.go +++ b/internal/controller/mlengine/model/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_ml_engine_model"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/monitoring/alertpolicy/zz_controller.go b/internal/controller/monitoring/alertpolicy/zz_controller.go index 12b558591..57838e54d 100755 --- a/internal/controller/monitoring/alertpolicy/zz_controller.go +++ b/internal/controller/monitoring/alertpolicy/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_alert_policy"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/monitoring/customservice/zz_controller.go b/internal/controller/monitoring/customservice/zz_controller.go index 167631156..00deef4ee 100755 --- a/internal/controller/monitoring/customservice/zz_controller.go +++ b/internal/controller/monitoring/customservice/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_custom_service"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/monitoring/dashboard/zz_controller.go b/internal/controller/monitoring/dashboard/zz_controller.go index 1859a4049..379f59b18 100755 --- a/internal/controller/monitoring/dashboard/zz_controller.go +++ b/internal/controller/monitoring/dashboard/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_dashboard"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/monitoring/group/zz_controller.go b/internal/controller/monitoring/group/zz_controller.go index 89665021f..ff1de8563 100755 --- a/internal/controller/monitoring/group/zz_controller.go +++ b/internal/controller/monitoring/group/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_group"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/monitoring/metricdescriptor/zz_controller.go b/internal/controller/monitoring/metricdescriptor/zz_controller.go index 0a3c47dc5..d1265c4e9 100755 --- a/internal/controller/monitoring/metricdescriptor/zz_controller.go +++ b/internal/controller/monitoring/metricdescriptor/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_metric_descriptor"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/monitoring/notificationchannel/zz_controller.go b/internal/controller/monitoring/notificationchannel/zz_controller.go index 887ec686e..522cf2b41 100755 --- a/internal/controller/monitoring/notificationchannel/zz_controller.go +++ b/internal/controller/monitoring/notificationchannel/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_notification_channel"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/monitoring/service/zz_controller.go b/internal/controller/monitoring/service/zz_controller.go index 2c82ed24f..4d8f40b89 100755 --- a/internal/controller/monitoring/service/zz_controller.go +++ b/internal/controller/monitoring/service/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_service"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/monitoring/slo/zz_controller.go b/internal/controller/monitoring/slo/zz_controller.go index e7b6a0041..8df7b55b5 100755 --- a/internal/controller/monitoring/slo/zz_controller.go +++ b/internal/controller/monitoring/slo/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_slo"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/monitoring/uptimecheckconfig/zz_controller.go b/internal/controller/monitoring/uptimecheckconfig/zz_controller.go index 9268666b1..c24a19cda 100755 --- a/internal/controller/monitoring/uptimecheckconfig/zz_controller.go +++ b/internal/controller/monitoring/uptimecheckconfig/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_uptime_check_config"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/networkconnectivity/hub/zz_controller.go b/internal/controller/networkconnectivity/hub/zz_controller.go index 02b890179..036c0cbc6 100755 --- a/internal/controller/networkconnectivity/hub/zz_controller.go +++ b/internal/controller/networkconnectivity/hub/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_network_connectivity_hub"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/networkconnectivity/spoke/zz_controller.go b/internal/controller/networkconnectivity/spoke/zz_controller.go index be7b7dc8e..d1bde6342 100755 --- a/internal/controller/networkconnectivity/spoke/zz_controller.go +++ b/internal/controller/networkconnectivity/spoke/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_network_connectivity_spoke"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/networkmanagement/connectivitytest/zz_controller.go b/internal/controller/networkmanagement/connectivitytest/zz_controller.go index 823cb142e..0c03b1e64 100755 --- a/internal/controller/networkmanagement/connectivitytest/zz_controller.go +++ b/internal/controller/networkmanagement/connectivitytest/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_network_management_connectivity_test"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/notebooks/environment/zz_controller.go b/internal/controller/notebooks/environment/zz_controller.go index bf933eca7..4536cdf45 100755 --- a/internal/controller/notebooks/environment/zz_controller.go +++ b/internal/controller/notebooks/environment/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_notebooks_environment"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/notebooks/instance/zz_controller.go b/internal/controller/notebooks/instance/zz_controller.go index 9d1ade8b2..28aae5181 100755 --- a/internal/controller/notebooks/instance/zz_controller.go +++ b/internal/controller/notebooks/instance/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_notebooks_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/notebooks/instanceiammember/zz_controller.go b/internal/controller/notebooks/instanceiammember/zz_controller.go index e82a99fd8..b4ac77db1 100755 --- a/internal/controller/notebooks/instanceiammember/zz_controller.go +++ b/internal/controller/notebooks/instanceiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_notebooks_instance_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/notebooks/runtime/zz_controller.go b/internal/controller/notebooks/runtime/zz_controller.go index 44d99ceb1..728dfdfcf 100755 --- a/internal/controller/notebooks/runtime/zz_controller.go +++ b/internal/controller/notebooks/runtime/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_notebooks_runtime"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/notebooks/runtimeiammember/zz_controller.go b/internal/controller/notebooks/runtimeiammember/zz_controller.go index 51fc0a659..4831c23f6 100755 --- a/internal/controller/notebooks/runtimeiammember/zz_controller.go +++ b/internal/controller/notebooks/runtimeiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_notebooks_runtime_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/osconfig/ospolicyassignment/zz_controller.go b/internal/controller/osconfig/ospolicyassignment/zz_controller.go index c87a09fb4..22d080199 100755 --- a/internal/controller/osconfig/ospolicyassignment/zz_controller.go +++ b/internal/controller/osconfig/ospolicyassignment/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_os_config_os_policy_assignment"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/osconfig/patchdeployment/zz_controller.go b/internal/controller/osconfig/patchdeployment/zz_controller.go index a6e1370b9..1a622e52a 100755 --- a/internal/controller/osconfig/patchdeployment/zz_controller.go +++ b/internal/controller/osconfig/patchdeployment/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_os_config_patch_deployment"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/oslogin/sshpublickey/zz_controller.go b/internal/controller/oslogin/sshpublickey/zz_controller.go index 7af5eb3d0..64a682369 100755 --- a/internal/controller/oslogin/sshpublickey/zz_controller.go +++ b/internal/controller/oslogin/sshpublickey/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_os_login_ssh_public_key"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/privateca/capool/zz_controller.go b/internal/controller/privateca/capool/zz_controller.go index 1c1c9de46..1567d03fa 100755 --- a/internal/controller/privateca/capool/zz_controller.go +++ b/internal/controller/privateca/capool/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_ca_pool"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/privateca/capooliammember/zz_controller.go b/internal/controller/privateca/capooliammember/zz_controller.go index 2ee9a1f3a..3a7349eed 100755 --- a/internal/controller/privateca/capooliammember/zz_controller.go +++ b/internal/controller/privateca/capooliammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_ca_pool_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/privateca/certificate/zz_controller.go b/internal/controller/privateca/certificate/zz_controller.go index 0c9601f08..e37bdeff0 100755 --- a/internal/controller/privateca/certificate/zz_controller.go +++ b/internal/controller/privateca/certificate/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/privateca/certificateauthority/zz_controller.go b/internal/controller/privateca/certificateauthority/zz_controller.go index 29b9266c0..dded98707 100755 --- a/internal/controller/privateca/certificateauthority/zz_controller.go +++ b/internal/controller/privateca/certificateauthority/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate_authority"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/privateca/certificatetemplate/zz_controller.go b/internal/controller/privateca/certificatetemplate/zz_controller.go index dfbd1e1b0..0f5407608 100755 --- a/internal/controller/privateca/certificatetemplate/zz_controller.go +++ b/internal/controller/privateca/certificatetemplate/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate_template"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/privateca/certificatetemplateiammember/zz_controller.go b/internal/controller/privateca/certificatetemplateiammember/zz_controller.go index 18c5a7a5f..b3b975b8a 100755 --- a/internal/controller/privateca/certificatetemplateiammember/zz_controller.go +++ b/internal/controller/privateca/certificatetemplateiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate_template_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/pubsub/litereservation/zz_controller.go b/internal/controller/pubsub/litereservation/zz_controller.go index 03ecf702a..bc6db4497 100755 --- a/internal/controller/pubsub/litereservation/zz_controller.go +++ b/internal/controller/pubsub/litereservation/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_lite_reservation"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/pubsub/litesubscription/zz_controller.go b/internal/controller/pubsub/litesubscription/zz_controller.go index f61f3f53c..8a4479db7 100755 --- a/internal/controller/pubsub/litesubscription/zz_controller.go +++ b/internal/controller/pubsub/litesubscription/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_lite_subscription"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/pubsub/litetopic/zz_controller.go b/internal/controller/pubsub/litetopic/zz_controller.go index 3ea332f7d..089520c9d 100755 --- a/internal/controller/pubsub/litetopic/zz_controller.go +++ b/internal/controller/pubsub/litetopic/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_lite_topic"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/pubsub/schema/zz_controller.go b/internal/controller/pubsub/schema/zz_controller.go index babf9c7b4..ffd3fc971 100755 --- a/internal/controller/pubsub/schema/zz_controller.go +++ b/internal/controller/pubsub/schema/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_schema"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/pubsub/subscription/zz_controller.go b/internal/controller/pubsub/subscription/zz_controller.go index 6f1676a37..a112ac2a9 100755 --- a/internal/controller/pubsub/subscription/zz_controller.go +++ b/internal/controller/pubsub/subscription/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_subscription"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/pubsub/subscriptioniammember/zz_controller.go b/internal/controller/pubsub/subscriptioniammember/zz_controller.go index d5eaa911a..ec0deb78a 100755 --- a/internal/controller/pubsub/subscriptioniammember/zz_controller.go +++ b/internal/controller/pubsub/subscriptioniammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_subscription_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/pubsub/topic/zz_controller.go b/internal/controller/pubsub/topic/zz_controller.go index be1789242..2a76e9c92 100755 --- a/internal/controller/pubsub/topic/zz_controller.go +++ b/internal/controller/pubsub/topic/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_topic"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/pubsub/topiciammember/zz_controller.go b/internal/controller/pubsub/topiciammember/zz_controller.go index f6e51503d..685a31f62 100755 --- a/internal/controller/pubsub/topiciammember/zz_controller.go +++ b/internal/controller/pubsub/topiciammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_topic_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/redis/instance/zz_controller.go b/internal/controller/redis/instance/zz_controller.go index 2101a81dc..97b90a20f 100755 --- a/internal/controller/redis/instance/zz_controller.go +++ b/internal/controller/redis/instance/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_redis_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/secretmanager/secret/zz_controller.go b/internal/controller/secretmanager/secret/zz_controller.go index 535d5af0f..f46e6463e 100755 --- a/internal/controller/secretmanager/secret/zz_controller.go +++ b/internal/controller/secretmanager/secret/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_secret_manager_secret"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/secretmanager/secretiammember/zz_controller.go b/internal/controller/secretmanager/secretiammember/zz_controller.go index e8de26a43..c1e9e7774 100755 --- a/internal/controller/secretmanager/secretiammember/zz_controller.go +++ b/internal/controller/secretmanager/secretiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_secret_manager_secret_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/secretmanager/secretversion/zz_controller.go b/internal/controller/secretmanager/secretversion/zz_controller.go index 373ea29c3..59bd683c7 100755 --- a/internal/controller/secretmanager/secretversion/zz_controller.go +++ b/internal/controller/secretmanager/secretversion/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_secret_manager_secret_version"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/servicenetworking/connection/zz_controller.go b/internal/controller/servicenetworking/connection/zz_controller.go index 86ea1eb26..220397592 100755 --- a/internal/controller/servicenetworking/connection/zz_controller.go +++ b/internal/controller/servicenetworking/connection/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_service_networking_connection"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/sourcerepo/repository/zz_controller.go b/internal/controller/sourcerepo/repository/zz_controller.go index 65b02d6de..70966828a 100755 --- a/internal/controller/sourcerepo/repository/zz_controller.go +++ b/internal/controller/sourcerepo/repository/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sourcerepo_repository"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/sourcerepo/repositoryiammember/zz_controller.go b/internal/controller/sourcerepo/repositoryiammember/zz_controller.go index 9fadca218..78a70c826 100755 --- a/internal/controller/sourcerepo/repositoryiammember/zz_controller.go +++ b/internal/controller/sourcerepo/repositoryiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sourcerepo_repository_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/spanner/database/zz_controller.go b/internal/controller/spanner/database/zz_controller.go index 99115c561..14eed8405 100755 --- a/internal/controller/spanner/database/zz_controller.go +++ b/internal/controller/spanner/database/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_spanner_database"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/spanner/databaseiammember/zz_controller.go b/internal/controller/spanner/databaseiammember/zz_controller.go index a4762fcef..ffed65f1e 100755 --- a/internal/controller/spanner/databaseiammember/zz_controller.go +++ b/internal/controller/spanner/databaseiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_spanner_database_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/spanner/instance/zz_controller.go b/internal/controller/spanner/instance/zz_controller.go index e31026e09..09e07e17b 100755 --- a/internal/controller/spanner/instance/zz_controller.go +++ b/internal/controller/spanner/instance/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_spanner_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/spanner/instanceiammember/zz_controller.go b/internal/controller/spanner/instanceiammember/zz_controller.go index abfe04d09..fa9b3661f 100755 --- a/internal/controller/spanner/instanceiammember/zz_controller.go +++ b/internal/controller/spanner/instanceiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_spanner_instance_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/sql/database/zz_controller.go b/internal/controller/sql/database/zz_controller.go index 89aa187da..e16b9bdba 100755 --- a/internal/controller/sql/database/zz_controller.go +++ b/internal/controller/sql/database/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sql_database"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/sql/databaseinstance/zz_controller.go b/internal/controller/sql/databaseinstance/zz_controller.go index 92f75a6cd..05be683bd 100755 --- a/internal/controller/sql/databaseinstance/zz_controller.go +++ b/internal/controller/sql/databaseinstance/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sql_database_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/sql/sourcerepresentationinstance/zz_controller.go b/internal/controller/sql/sourcerepresentationinstance/zz_controller.go index 7a037e269..144f69e9d 100755 --- a/internal/controller/sql/sourcerepresentationinstance/zz_controller.go +++ b/internal/controller/sql/sourcerepresentationinstance/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sql_source_representation_instance"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/sql/sslcert/zz_controller.go b/internal/controller/sql/sslcert/zz_controller.go index 4851b93e3..ca79da49c 100755 --- a/internal/controller/sql/sslcert/zz_controller.go +++ b/internal/controller/sql/sslcert/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sql_ssl_cert"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/sql/user/zz_controller.go b/internal/controller/sql/user/zz_controller.go index a69a673c1..f361295e5 100755 --- a/internal/controller/sql/user/zz_controller.go +++ b/internal/controller/sql/user/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sql_user"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/storage/bucket/zz_controller.go b/internal/controller/storage/bucket/zz_controller.go index 0f4481ac7..b8e3b45b3 100755 --- a/internal/controller/storage/bucket/zz_controller.go +++ b/internal/controller/storage/bucket/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_bucket"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/storage/bucketaccesscontrol/zz_controller.go b/internal/controller/storage/bucketaccesscontrol/zz_controller.go index 7488ada8d..4606a135c 100755 --- a/internal/controller/storage/bucketaccesscontrol/zz_controller.go +++ b/internal/controller/storage/bucketaccesscontrol/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_access_control"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/storage/bucketacl/zz_controller.go b/internal/controller/storage/bucketacl/zz_controller.go index 565e6b8f2..b83cc261b 100755 --- a/internal/controller/storage/bucketacl/zz_controller.go +++ b/internal/controller/storage/bucketacl/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_acl"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/storage/bucketiammember/zz_controller.go b/internal/controller/storage/bucketiammember/zz_controller.go index b963f3c2f..e96b01d31 100755 --- a/internal/controller/storage/bucketiammember/zz_controller.go +++ b/internal/controller/storage/bucketiammember/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_iam_member"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/storage/bucketobject/zz_controller.go b/internal/controller/storage/bucketobject/zz_controller.go index b909f83ca..a917743ce 100755 --- a/internal/controller/storage/bucketobject/zz_controller.go +++ b/internal/controller/storage/bucketobject/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_object"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/storage/defaultobjectaccesscontrol/zz_controller.go b/internal/controller/storage/defaultobjectaccesscontrol/zz_controller.go index e48b0d407..202056d1b 100755 --- a/internal/controller/storage/defaultobjectaccesscontrol/zz_controller.go +++ b/internal/controller/storage/defaultobjectaccesscontrol/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_default_object_access_control"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/storage/defaultobjectacl/zz_controller.go b/internal/controller/storage/defaultobjectacl/zz_controller.go index 9e6a39562..4e7c1d9c1 100755 --- a/internal/controller/storage/defaultobjectacl/zz_controller.go +++ b/internal/controller/storage/defaultobjectacl/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_default_object_acl"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/storage/notification/zz_controller.go b/internal/controller/storage/notification/zz_controller.go index 827517298..4bf9eab9a 100755 --- a/internal/controller/storage/notification/zz_controller.go +++ b/internal/controller/storage/notification/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_notification"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/storage/objectaccesscontrol/zz_controller.go b/internal/controller/storage/objectaccesscontrol/zz_controller.go index a5ab24e3b..27c52d671 100755 --- a/internal/controller/storage/objectaccesscontrol/zz_controller.go +++ b/internal/controller/storage/objectaccesscontrol/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_object_access_control"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/storage/objectacl/zz_controller.go b/internal/controller/storage/objectacl/zz_controller.go index f289d267b..1c271424d 100755 --- a/internal/controller/storage/objectacl/zz_controller.go +++ b/internal/controller/storage/objectacl/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_object_acl"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/storagetransfer/agentpool/zz_controller.go b/internal/controller/storagetransfer/agentpool/zz_controller.go index a56fcd0b0..0abea206d 100755 --- a/internal/controller/storagetransfer/agentpool/zz_controller.go +++ b/internal/controller/storagetransfer/agentpool/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_transfer_agent_pool"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/tpu/node/zz_controller.go b/internal/controller/tpu/node/zz_controller.go index f29bdcb33..05c9ef6b1 100755 --- a/internal/controller/tpu/node/zz_controller.go +++ b/internal/controller/tpu/node/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_tpu_node"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/vertexai/dataset/zz_controller.go b/internal/controller/vertexai/dataset/zz_controller.go index e68fd1c60..2c274dd30 100755 --- a/internal/controller/vertexai/dataset/zz_controller.go +++ b/internal/controller/vertexai/dataset/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_dataset"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/vertexai/featurestore/zz_controller.go b/internal/controller/vertexai/featurestore/zz_controller.go index 0c8c86a9b..0061530dc 100755 --- a/internal/controller/vertexai/featurestore/zz_controller.go +++ b/internal/controller/vertexai/featurestore/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_featurestore"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/vertexai/featurestoreentitytype/zz_controller.go b/internal/controller/vertexai/featurestoreentitytype/zz_controller.go index 0421d5b14..5bb052237 100755 --- a/internal/controller/vertexai/featurestoreentitytype/zz_controller.go +++ b/internal/controller/vertexai/featurestoreentitytype/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_featurestore_entitytype"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/vertexai/tensorboard/zz_controller.go b/internal/controller/vertexai/tensorboard/zz_controller.go index 7694b06b8..70ce7f507 100755 --- a/internal/controller/vertexai/tensorboard/zz_controller.go +++ b/internal/controller/vertexai/tensorboard/zz_controller.go @@ -41,7 +41,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_tensorboard"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/workflows/workflow/zz_controller.go b/internal/controller/workflows/workflow/zz_controller.go index 0d970fa39..4227dcec2 100755 --- a/internal/controller/workflows/workflow/zz_controller.go +++ b/internal/controller/workflows/workflow/zz_controller.go @@ -40,7 +40,7 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { var initializers managed.InitializerChain cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { - cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } opts := []managed.ReconcilerOption{ managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_workflows_workflow"], tjcontroller.WithLogger(o.Logger), diff --git a/internal/controller/zz_activedirectory_setup.go b/internal/controller/zz_activedirectory_setup.go new file mode 100755 index 000000000..203e8c640 --- /dev/null +++ b/internal/controller/zz_activedirectory_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + domain "github.com/upbound/provider-gcp/internal/controller/activedirectory/domain" +) + +// Setup_activedirectory creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_activedirectory(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + domain.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_apigee_setup.go b/internal/controller/zz_apigee_setup.go new file mode 100755 index 000000000..7e24668a5 --- /dev/null +++ b/internal/controller/zz_apigee_setup.go @@ -0,0 +1,36 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + envgroup "github.com/upbound/provider-gcp/internal/controller/apigee/envgroup" + environment "github.com/upbound/provider-gcp/internal/controller/apigee/environment" + environmentiammember "github.com/upbound/provider-gcp/internal/controller/apigee/environmentiammember" + instance "github.com/upbound/provider-gcp/internal/controller/apigee/instance" + nataddress "github.com/upbound/provider-gcp/internal/controller/apigee/nataddress" + organization "github.com/upbound/provider-gcp/internal/controller/apigee/organization" +) + +// Setup_apigee creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_apigee(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + envgroup.Setup, + environment.Setup, + environmentiammember.Setup, + instance.Setup, + nataddress.Setup, + organization.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_appengine_setup.go b/internal/controller/zz_appengine_setup.go new file mode 100755 index 000000000..7bbdddca6 --- /dev/null +++ b/internal/controller/zz_appengine_setup.go @@ -0,0 +1,34 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + application "github.com/upbound/provider-gcp/internal/controller/appengine/application" + applicationurldispatchrules "github.com/upbound/provider-gcp/internal/controller/appengine/applicationurldispatchrules" + firewallrule "github.com/upbound/provider-gcp/internal/controller/appengine/firewallrule" + servicenetworksettings "github.com/upbound/provider-gcp/internal/controller/appengine/servicenetworksettings" + standardappversion "github.com/upbound/provider-gcp/internal/controller/appengine/standardappversion" +) + +// Setup_appengine creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_appengine(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + application.Setup, + applicationurldispatchrules.Setup, + firewallrule.Setup, + servicenetworksettings.Setup, + standardappversion.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_artifact_setup.go b/internal/controller/zz_artifact_setup.go new file mode 100755 index 000000000..ace6e0ef5 --- /dev/null +++ b/internal/controller/zz_artifact_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + registryrepository "github.com/upbound/provider-gcp/internal/controller/artifact/registryrepository" + registryrepositoryiammember "github.com/upbound/provider-gcp/internal/controller/artifact/registryrepositoryiammember" +) + +// Setup_artifact creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_artifact(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + registryrepository.Setup, + registryrepositoryiammember.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_beyondcorp_setup.go b/internal/controller/zz_beyondcorp_setup.go new file mode 100755 index 000000000..5d4d86dac --- /dev/null +++ b/internal/controller/zz_beyondcorp_setup.go @@ -0,0 +1,30 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + appconnection "github.com/upbound/provider-gcp/internal/controller/beyondcorp/appconnection" + appconnector "github.com/upbound/provider-gcp/internal/controller/beyondcorp/appconnector" + appgateway "github.com/upbound/provider-gcp/internal/controller/beyondcorp/appgateway" +) + +// Setup_beyondcorp creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_beyondcorp(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + appconnection.Setup, + appconnector.Setup, + appgateway.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_bigquery_setup.go b/internal/controller/zz_bigquery_setup.go new file mode 100755 index 000000000..ab3472cd5 --- /dev/null +++ b/internal/controller/zz_bigquery_setup.go @@ -0,0 +1,60 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + analyticshubdataexchange "github.com/upbound/provider-gcp/internal/controller/bigquery/analyticshubdataexchange" + analyticshubdataexchangeiammember "github.com/upbound/provider-gcp/internal/controller/bigquery/analyticshubdataexchangeiammember" + analyticshublisting "github.com/upbound/provider-gcp/internal/controller/bigquery/analyticshublisting" + connection "github.com/upbound/provider-gcp/internal/controller/bigquery/connection" + dataset "github.com/upbound/provider-gcp/internal/controller/bigquery/dataset" + datasetaccess "github.com/upbound/provider-gcp/internal/controller/bigquery/datasetaccess" + datasetiambinding "github.com/upbound/provider-gcp/internal/controller/bigquery/datasetiambinding" + datasetiammember "github.com/upbound/provider-gcp/internal/controller/bigquery/datasetiammember" + datasetiampolicy "github.com/upbound/provider-gcp/internal/controller/bigquery/datasetiampolicy" + datatransferconfig "github.com/upbound/provider-gcp/internal/controller/bigquery/datatransferconfig" + job "github.com/upbound/provider-gcp/internal/controller/bigquery/job" + reservation "github.com/upbound/provider-gcp/internal/controller/bigquery/reservation" + reservationassignment "github.com/upbound/provider-gcp/internal/controller/bigquery/reservationassignment" + routine "github.com/upbound/provider-gcp/internal/controller/bigquery/routine" + table "github.com/upbound/provider-gcp/internal/controller/bigquery/table" + tableiambinding "github.com/upbound/provider-gcp/internal/controller/bigquery/tableiambinding" + tableiammember "github.com/upbound/provider-gcp/internal/controller/bigquery/tableiammember" + tableiampolicy "github.com/upbound/provider-gcp/internal/controller/bigquery/tableiampolicy" +) + +// Setup_bigquery creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_bigquery(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + analyticshubdataexchange.Setup, + analyticshubdataexchangeiammember.Setup, + analyticshublisting.Setup, + connection.Setup, + dataset.Setup, + datasetaccess.Setup, + datasetiambinding.Setup, + datasetiammember.Setup, + datasetiampolicy.Setup, + datatransferconfig.Setup, + job.Setup, + reservation.Setup, + reservationassignment.Setup, + routine.Setup, + table.Setup, + tableiambinding.Setup, + tableiammember.Setup, + tableiampolicy.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_bigtable_setup.go b/internal/controller/zz_bigtable_setup.go new file mode 100755 index 000000000..e71180c01 --- /dev/null +++ b/internal/controller/zz_bigtable_setup.go @@ -0,0 +1,44 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + appprofile "github.com/upbound/provider-gcp/internal/controller/bigtable/appprofile" + garbagecollectionpolicy "github.com/upbound/provider-gcp/internal/controller/bigtable/garbagecollectionpolicy" + instance "github.com/upbound/provider-gcp/internal/controller/bigtable/instance" + instanceiambinding "github.com/upbound/provider-gcp/internal/controller/bigtable/instanceiambinding" + instanceiammember "github.com/upbound/provider-gcp/internal/controller/bigtable/instanceiammember" + instanceiampolicy "github.com/upbound/provider-gcp/internal/controller/bigtable/instanceiampolicy" + table "github.com/upbound/provider-gcp/internal/controller/bigtable/table" + tableiambinding "github.com/upbound/provider-gcp/internal/controller/bigtable/tableiambinding" + tableiammember "github.com/upbound/provider-gcp/internal/controller/bigtable/tableiammember" + tableiampolicy "github.com/upbound/provider-gcp/internal/controller/bigtable/tableiampolicy" +) + +// Setup_bigtable creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_bigtable(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + appprofile.Setup, + garbagecollectionpolicy.Setup, + instance.Setup, + instanceiambinding.Setup, + instanceiammember.Setup, + instanceiampolicy.Setup, + table.Setup, + tableiambinding.Setup, + tableiammember.Setup, + tableiampolicy.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_binaryauthorization_setup.go b/internal/controller/zz_binaryauthorization_setup.go new file mode 100755 index 000000000..b8ed9d2dd --- /dev/null +++ b/internal/controller/zz_binaryauthorization_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + attestor "github.com/upbound/provider-gcp/internal/controller/binaryauthorization/attestor" + policy "github.com/upbound/provider-gcp/internal/controller/binaryauthorization/policy" +) + +// Setup_binaryauthorization creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_binaryauthorization(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + attestor.Setup, + policy.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_certificatemanager_setup.go b/internal/controller/zz_certificatemanager_setup.go new file mode 100755 index 000000000..837664884 --- /dev/null +++ b/internal/controller/zz_certificatemanager_setup.go @@ -0,0 +1,32 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + certificate "github.com/upbound/provider-gcp/internal/controller/certificatemanager/certificate" + certificatemap "github.com/upbound/provider-gcp/internal/controller/certificatemanager/certificatemap" + certificatemapentry "github.com/upbound/provider-gcp/internal/controller/certificatemanager/certificatemapentry" + dnsauthorization "github.com/upbound/provider-gcp/internal/controller/certificatemanager/dnsauthorization" +) + +// Setup_certificatemanager creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_certificatemanager(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + certificate.Setup, + certificatemap.Setup, + certificatemapentry.Setup, + dnsauthorization.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_cloud_setup.go b/internal/controller/zz_cloud_setup.go new file mode 100755 index 000000000..f0d3d54cb --- /dev/null +++ b/internal/controller/zz_cloud_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + idsendpoint "github.com/upbound/provider-gcp/internal/controller/cloud/idsendpoint" +) + +// Setup_cloud creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_cloud(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + idsendpoint.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_cloudbuild_setup.go b/internal/controller/zz_cloudbuild_setup.go new file mode 100755 index 000000000..6d5450edc --- /dev/null +++ b/internal/controller/zz_cloudbuild_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + trigger "github.com/upbound/provider-gcp/internal/controller/cloudbuild/trigger" + workerpool "github.com/upbound/provider-gcp/internal/controller/cloudbuild/workerpool" +) + +// Setup_cloudbuild creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_cloudbuild(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + trigger.Setup, + workerpool.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_cloudfunctions2_setup.go b/internal/controller/zz_cloudfunctions2_setup.go new file mode 100755 index 000000000..59aa8d824 --- /dev/null +++ b/internal/controller/zz_cloudfunctions2_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + function "github.com/upbound/provider-gcp/internal/controller/cloudfunctions2/function" +) + +// Setup_cloudfunctions2 creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_cloudfunctions2(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + function.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_cloudfunctions_setup.go b/internal/controller/zz_cloudfunctions_setup.go new file mode 100755 index 000000000..75ffec7cf --- /dev/null +++ b/internal/controller/zz_cloudfunctions_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + function "github.com/upbound/provider-gcp/internal/controller/cloudfunctions/function" + functioniammember "github.com/upbound/provider-gcp/internal/controller/cloudfunctions/functioniammember" +) + +// Setup_cloudfunctions creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_cloudfunctions(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + function.Setup, + functioniammember.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_cloudiot_setup.go b/internal/controller/zz_cloudiot_setup.go new file mode 100755 index 000000000..44b515e27 --- /dev/null +++ b/internal/controller/zz_cloudiot_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + device "github.com/upbound/provider-gcp/internal/controller/cloudiot/device" + registry "github.com/upbound/provider-gcp/internal/controller/cloudiot/registry" +) + +// Setup_cloudiot creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_cloudiot(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + device.Setup, + registry.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_cloudplatform_setup.go b/internal/controller/zz_cloudplatform_setup.go new file mode 100755 index 000000000..ac19d01f2 --- /dev/null +++ b/internal/controller/zz_cloudplatform_setup.go @@ -0,0 +1,56 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + folder "github.com/upbound/provider-gcp/internal/controller/cloudplatform/folder" + folderiammember "github.com/upbound/provider-gcp/internal/controller/cloudplatform/folderiammember" + organizationiamauditconfig "github.com/upbound/provider-gcp/internal/controller/cloudplatform/organizationiamauditconfig" + organizationiamcustomrole "github.com/upbound/provider-gcp/internal/controller/cloudplatform/organizationiamcustomrole" + organizationiammember "github.com/upbound/provider-gcp/internal/controller/cloudplatform/organizationiammember" + project "github.com/upbound/provider-gcp/internal/controller/cloudplatform/project" + projectdefaultserviceaccounts "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectdefaultserviceaccounts" + projectiamauditconfig "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectiamauditconfig" + projectiamcustomrole "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectiamcustomrole" + projectiammember "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectiammember" + projectservice "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectservice" + projectusageexportbucket "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectusageexportbucket" + serviceaccount "github.com/upbound/provider-gcp/internal/controller/cloudplatform/serviceaccount" + serviceaccountiammember "github.com/upbound/provider-gcp/internal/controller/cloudplatform/serviceaccountiammember" + serviceaccountkey "github.com/upbound/provider-gcp/internal/controller/cloudplatform/serviceaccountkey" + servicenetworkingpeereddnsdomain "github.com/upbound/provider-gcp/internal/controller/cloudplatform/servicenetworkingpeereddnsdomain" +) + +// Setup_cloudplatform creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_cloudplatform(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + folder.Setup, + folderiammember.Setup, + organizationiamauditconfig.Setup, + organizationiamcustomrole.Setup, + organizationiammember.Setup, + project.Setup, + projectdefaultserviceaccounts.Setup, + projectiamauditconfig.Setup, + projectiamcustomrole.Setup, + projectiammember.Setup, + projectservice.Setup, + projectusageexportbucket.Setup, + serviceaccount.Setup, + serviceaccountiammember.Setup, + serviceaccountkey.Setup, + servicenetworkingpeereddnsdomain.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_cloudrun_setup.go b/internal/controller/zz_cloudrun_setup.go new file mode 100755 index 000000000..37a384085 --- /dev/null +++ b/internal/controller/zz_cloudrun_setup.go @@ -0,0 +1,34 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + domainmapping "github.com/upbound/provider-gcp/internal/controller/cloudrun/domainmapping" + service "github.com/upbound/provider-gcp/internal/controller/cloudrun/service" + serviceiammember "github.com/upbound/provider-gcp/internal/controller/cloudrun/serviceiammember" + v2job "github.com/upbound/provider-gcp/internal/controller/cloudrun/v2job" + v2service "github.com/upbound/provider-gcp/internal/controller/cloudrun/v2service" +) + +// Setup_cloudrun creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_cloudrun(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + domainmapping.Setup, + service.Setup, + serviceiammember.Setup, + v2job.Setup, + v2service.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_cloudscheduler_setup.go b/internal/controller/zz_cloudscheduler_setup.go new file mode 100755 index 000000000..3efc0b278 --- /dev/null +++ b/internal/controller/zz_cloudscheduler_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + job "github.com/upbound/provider-gcp/internal/controller/cloudscheduler/job" +) + +// Setup_cloudscheduler creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_cloudscheduler(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + job.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_cloudtasks_setup.go b/internal/controller/zz_cloudtasks_setup.go new file mode 100755 index 000000000..334a0cb62 --- /dev/null +++ b/internal/controller/zz_cloudtasks_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + queue "github.com/upbound/provider-gcp/internal/controller/cloudtasks/queue" +) + +// Setup_cloudtasks creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_cloudtasks(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + queue.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_composer_setup.go b/internal/controller/zz_composer_setup.go new file mode 100755 index 000000000..e7f2568b4 --- /dev/null +++ b/internal/controller/zz_composer_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + environment "github.com/upbound/provider-gcp/internal/controller/composer/environment" +) + +// Setup_composer creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_composer(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + environment.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_compute_setup.go b/internal/controller/zz_compute_setup.go new file mode 100755 index 000000000..66445608d --- /dev/null +++ b/internal/controller/zz_compute_setup.go @@ -0,0 +1,200 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + address "github.com/upbound/provider-gcp/internal/controller/compute/address" + attacheddisk "github.com/upbound/provider-gcp/internal/controller/compute/attacheddisk" + autoscaler "github.com/upbound/provider-gcp/internal/controller/compute/autoscaler" + backendbucket "github.com/upbound/provider-gcp/internal/controller/compute/backendbucket" + backendbucketsignedurlkey "github.com/upbound/provider-gcp/internal/controller/compute/backendbucketsignedurlkey" + backendservice "github.com/upbound/provider-gcp/internal/controller/compute/backendservice" + backendservicesignedurlkey "github.com/upbound/provider-gcp/internal/controller/compute/backendservicesignedurlkey" + disk "github.com/upbound/provider-gcp/internal/controller/compute/disk" + diskiammember "github.com/upbound/provider-gcp/internal/controller/compute/diskiammember" + diskresourcepolicyattachment "github.com/upbound/provider-gcp/internal/controller/compute/diskresourcepolicyattachment" + externalvpngateway "github.com/upbound/provider-gcp/internal/controller/compute/externalvpngateway" + firewall "github.com/upbound/provider-gcp/internal/controller/compute/firewall" + firewallpolicy "github.com/upbound/provider-gcp/internal/controller/compute/firewallpolicy" + firewallpolicyassociation "github.com/upbound/provider-gcp/internal/controller/compute/firewallpolicyassociation" + firewallpolicyrule "github.com/upbound/provider-gcp/internal/controller/compute/firewallpolicyrule" + forwardingrule "github.com/upbound/provider-gcp/internal/controller/compute/forwardingrule" + globaladdress "github.com/upbound/provider-gcp/internal/controller/compute/globaladdress" + globalforwardingrule "github.com/upbound/provider-gcp/internal/controller/compute/globalforwardingrule" + globalnetworkendpoint "github.com/upbound/provider-gcp/internal/controller/compute/globalnetworkendpoint" + globalnetworkendpointgroup "github.com/upbound/provider-gcp/internal/controller/compute/globalnetworkendpointgroup" + havpngateway "github.com/upbound/provider-gcp/internal/controller/compute/havpngateway" + healthcheck "github.com/upbound/provider-gcp/internal/controller/compute/healthcheck" + httphealthcheck "github.com/upbound/provider-gcp/internal/controller/compute/httphealthcheck" + httpshealthcheck "github.com/upbound/provider-gcp/internal/controller/compute/httpshealthcheck" + image "github.com/upbound/provider-gcp/internal/controller/compute/image" + imageiammember "github.com/upbound/provider-gcp/internal/controller/compute/imageiammember" + instance "github.com/upbound/provider-gcp/internal/controller/compute/instance" + instancefromtemplate "github.com/upbound/provider-gcp/internal/controller/compute/instancefromtemplate" + instancegroup "github.com/upbound/provider-gcp/internal/controller/compute/instancegroup" + instancegroupmanager "github.com/upbound/provider-gcp/internal/controller/compute/instancegroupmanager" + instancegroupnamedport "github.com/upbound/provider-gcp/internal/controller/compute/instancegroupnamedport" + instanceiammember "github.com/upbound/provider-gcp/internal/controller/compute/instanceiammember" + instancetemplate "github.com/upbound/provider-gcp/internal/controller/compute/instancetemplate" + interconnectattachment "github.com/upbound/provider-gcp/internal/controller/compute/interconnectattachment" + managedsslcertificate "github.com/upbound/provider-gcp/internal/controller/compute/managedsslcertificate" + network "github.com/upbound/provider-gcp/internal/controller/compute/network" + networkendpoint "github.com/upbound/provider-gcp/internal/controller/compute/networkendpoint" + networkendpointgroup "github.com/upbound/provider-gcp/internal/controller/compute/networkendpointgroup" + networkfirewallpolicy "github.com/upbound/provider-gcp/internal/controller/compute/networkfirewallpolicy" + networkfirewallpolicyassociation "github.com/upbound/provider-gcp/internal/controller/compute/networkfirewallpolicyassociation" + networkpeering "github.com/upbound/provider-gcp/internal/controller/compute/networkpeering" + networkpeeringroutesconfig "github.com/upbound/provider-gcp/internal/controller/compute/networkpeeringroutesconfig" + nodegroup "github.com/upbound/provider-gcp/internal/controller/compute/nodegroup" + nodetemplate "github.com/upbound/provider-gcp/internal/controller/compute/nodetemplate" + packetmirroring "github.com/upbound/provider-gcp/internal/controller/compute/packetmirroring" + perinstanceconfig "github.com/upbound/provider-gcp/internal/controller/compute/perinstanceconfig" + projectdefaultnetworktier "github.com/upbound/provider-gcp/internal/controller/compute/projectdefaultnetworktier" + projectmetadata "github.com/upbound/provider-gcp/internal/controller/compute/projectmetadata" + projectmetadataitem "github.com/upbound/provider-gcp/internal/controller/compute/projectmetadataitem" + regionautoscaler "github.com/upbound/provider-gcp/internal/controller/compute/regionautoscaler" + regionbackendservice "github.com/upbound/provider-gcp/internal/controller/compute/regionbackendservice" + regiondisk "github.com/upbound/provider-gcp/internal/controller/compute/regiondisk" + regiondiskiammember "github.com/upbound/provider-gcp/internal/controller/compute/regiondiskiammember" + regiondiskresourcepolicyattachment "github.com/upbound/provider-gcp/internal/controller/compute/regiondiskresourcepolicyattachment" + regionhealthcheck "github.com/upbound/provider-gcp/internal/controller/compute/regionhealthcheck" + regioninstancegroupmanager "github.com/upbound/provider-gcp/internal/controller/compute/regioninstancegroupmanager" + regionnetworkendpointgroup "github.com/upbound/provider-gcp/internal/controller/compute/regionnetworkendpointgroup" + regionnetworkfirewallpolicy "github.com/upbound/provider-gcp/internal/controller/compute/regionnetworkfirewallpolicy" + regionnetworkfirewallpolicyassociation "github.com/upbound/provider-gcp/internal/controller/compute/regionnetworkfirewallpolicyassociation" + regionperinstanceconfig "github.com/upbound/provider-gcp/internal/controller/compute/regionperinstanceconfig" + regionsslcertificate "github.com/upbound/provider-gcp/internal/controller/compute/regionsslcertificate" + regiontargethttpproxy "github.com/upbound/provider-gcp/internal/controller/compute/regiontargethttpproxy" + regiontargethttpsproxy "github.com/upbound/provider-gcp/internal/controller/compute/regiontargethttpsproxy" + regionurlmap "github.com/upbound/provider-gcp/internal/controller/compute/regionurlmap" + reservation "github.com/upbound/provider-gcp/internal/controller/compute/reservation" + resourcepolicy "github.com/upbound/provider-gcp/internal/controller/compute/resourcepolicy" + route "github.com/upbound/provider-gcp/internal/controller/compute/route" + router "github.com/upbound/provider-gcp/internal/controller/compute/router" + routerinterface "github.com/upbound/provider-gcp/internal/controller/compute/routerinterface" + routernat "github.com/upbound/provider-gcp/internal/controller/compute/routernat" + securitypolicy "github.com/upbound/provider-gcp/internal/controller/compute/securitypolicy" + serviceattachment "github.com/upbound/provider-gcp/internal/controller/compute/serviceattachment" + snapshot "github.com/upbound/provider-gcp/internal/controller/compute/snapshot" + snapshotiammember "github.com/upbound/provider-gcp/internal/controller/compute/snapshotiammember" + sslcertificate "github.com/upbound/provider-gcp/internal/controller/compute/sslcertificate" + sslpolicy "github.com/upbound/provider-gcp/internal/controller/compute/sslpolicy" + subnetwork "github.com/upbound/provider-gcp/internal/controller/compute/subnetwork" + subnetworkiammember "github.com/upbound/provider-gcp/internal/controller/compute/subnetworkiammember" + targetgrpcproxy "github.com/upbound/provider-gcp/internal/controller/compute/targetgrpcproxy" + targethttpproxy "github.com/upbound/provider-gcp/internal/controller/compute/targethttpproxy" + targethttpsproxy "github.com/upbound/provider-gcp/internal/controller/compute/targethttpsproxy" + targetinstance "github.com/upbound/provider-gcp/internal/controller/compute/targetinstance" + targetpool "github.com/upbound/provider-gcp/internal/controller/compute/targetpool" + targetsslproxy "github.com/upbound/provider-gcp/internal/controller/compute/targetsslproxy" + targettcpproxy "github.com/upbound/provider-gcp/internal/controller/compute/targettcpproxy" + urlmap "github.com/upbound/provider-gcp/internal/controller/compute/urlmap" + vpngateway "github.com/upbound/provider-gcp/internal/controller/compute/vpngateway" + vpntunnel "github.com/upbound/provider-gcp/internal/controller/compute/vpntunnel" +) + +// Setup_compute creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_compute(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + address.Setup, + attacheddisk.Setup, + autoscaler.Setup, + backendbucket.Setup, + backendbucketsignedurlkey.Setup, + backendservice.Setup, + backendservicesignedurlkey.Setup, + disk.Setup, + diskiammember.Setup, + diskresourcepolicyattachment.Setup, + externalvpngateway.Setup, + firewall.Setup, + firewallpolicy.Setup, + firewallpolicyassociation.Setup, + firewallpolicyrule.Setup, + forwardingrule.Setup, + globaladdress.Setup, + globalforwardingrule.Setup, + globalnetworkendpoint.Setup, + globalnetworkendpointgroup.Setup, + havpngateway.Setup, + healthcheck.Setup, + httphealthcheck.Setup, + httpshealthcheck.Setup, + image.Setup, + imageiammember.Setup, + instance.Setup, + instancefromtemplate.Setup, + instancegroup.Setup, + instancegroupmanager.Setup, + instancegroupnamedport.Setup, + instanceiammember.Setup, + instancetemplate.Setup, + interconnectattachment.Setup, + managedsslcertificate.Setup, + network.Setup, + networkendpoint.Setup, + networkendpointgroup.Setup, + networkfirewallpolicy.Setup, + networkfirewallpolicyassociation.Setup, + networkpeering.Setup, + networkpeeringroutesconfig.Setup, + nodegroup.Setup, + nodetemplate.Setup, + packetmirroring.Setup, + perinstanceconfig.Setup, + projectdefaultnetworktier.Setup, + projectmetadata.Setup, + projectmetadataitem.Setup, + regionautoscaler.Setup, + regionbackendservice.Setup, + regiondisk.Setup, + regiondiskiammember.Setup, + regiondiskresourcepolicyattachment.Setup, + regionhealthcheck.Setup, + regioninstancegroupmanager.Setup, + regionnetworkendpointgroup.Setup, + regionnetworkfirewallpolicy.Setup, + regionnetworkfirewallpolicyassociation.Setup, + regionperinstanceconfig.Setup, + regionsslcertificate.Setup, + regiontargethttpproxy.Setup, + regiontargethttpsproxy.Setup, + regionurlmap.Setup, + reservation.Setup, + resourcepolicy.Setup, + route.Setup, + router.Setup, + routerinterface.Setup, + routernat.Setup, + securitypolicy.Setup, + serviceattachment.Setup, + snapshot.Setup, + snapshotiammember.Setup, + sslcertificate.Setup, + sslpolicy.Setup, + subnetwork.Setup, + subnetworkiammember.Setup, + targetgrpcproxy.Setup, + targethttpproxy.Setup, + targethttpsproxy.Setup, + targetinstance.Setup, + targetpool.Setup, + targetsslproxy.Setup, + targettcpproxy.Setup, + urlmap.Setup, + vpngateway.Setup, + vpntunnel.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_config_setup.go b/internal/controller/zz_config_setup.go new file mode 100755 index 000000000..3cd3db8b3 --- /dev/null +++ b/internal/controller/zz_config_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + providerconfig "github.com/upbound/provider-gcp/internal/controller/providerconfig" +) + +// Setup_config creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_config(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + providerconfig.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_container_setup.go b/internal/controller/zz_container_setup.go new file mode 100755 index 000000000..a9e61693d --- /dev/null +++ b/internal/controller/zz_container_setup.go @@ -0,0 +1,30 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + cluster "github.com/upbound/provider-gcp/internal/controller/container/cluster" + nodepool "github.com/upbound/provider-gcp/internal/controller/container/nodepool" + registry "github.com/upbound/provider-gcp/internal/controller/container/registry" +) + +// Setup_container creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_container(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + cluster.Setup, + nodepool.Setup, + registry.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_containeranalysis_setup.go b/internal/controller/zz_containeranalysis_setup.go new file mode 100755 index 000000000..d0cd3471a --- /dev/null +++ b/internal/controller/zz_containeranalysis_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + note "github.com/upbound/provider-gcp/internal/controller/containeranalysis/note" +) + +// Setup_containeranalysis creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_containeranalysis(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + note.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_containeraws_setup.go b/internal/controller/zz_containeraws_setup.go new file mode 100755 index 000000000..5839e0d7f --- /dev/null +++ b/internal/controller/zz_containeraws_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + cluster "github.com/upbound/provider-gcp/internal/controller/containeraws/cluster" + nodepool "github.com/upbound/provider-gcp/internal/controller/containeraws/nodepool" +) + +// Setup_containeraws creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_containeraws(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + cluster.Setup, + nodepool.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_containerazure_setup.go b/internal/controller/zz_containerazure_setup.go new file mode 100755 index 000000000..81ed42dc0 --- /dev/null +++ b/internal/controller/zz_containerazure_setup.go @@ -0,0 +1,30 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + client "github.com/upbound/provider-gcp/internal/controller/containerazure/client" + cluster "github.com/upbound/provider-gcp/internal/controller/containerazure/cluster" + nodepool "github.com/upbound/provider-gcp/internal/controller/containerazure/nodepool" +) + +// Setup_containerazure creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_containerazure(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + client.Setup, + cluster.Setup, + nodepool.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_datacatalog_setup.go b/internal/controller/zz_datacatalog_setup.go new file mode 100755 index 000000000..0e9e6119a --- /dev/null +++ b/internal/controller/zz_datacatalog_setup.go @@ -0,0 +1,32 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + entry "github.com/upbound/provider-gcp/internal/controller/datacatalog/entry" + entrygroup "github.com/upbound/provider-gcp/internal/controller/datacatalog/entrygroup" + tag "github.com/upbound/provider-gcp/internal/controller/datacatalog/tag" + tagtemplate "github.com/upbound/provider-gcp/internal/controller/datacatalog/tagtemplate" +) + +// Setup_datacatalog creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_datacatalog(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + entry.Setup, + entrygroup.Setup, + tag.Setup, + tagtemplate.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_dataflow_setup.go b/internal/controller/zz_dataflow_setup.go new file mode 100755 index 000000000..5d612c583 --- /dev/null +++ b/internal/controller/zz_dataflow_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + job "github.com/upbound/provider-gcp/internal/controller/dataflow/job" +) + +// Setup_dataflow creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_dataflow(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + job.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_datafusion_setup.go b/internal/controller/zz_datafusion_setup.go new file mode 100755 index 000000000..1ed9cdb4b --- /dev/null +++ b/internal/controller/zz_datafusion_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + instance "github.com/upbound/provider-gcp/internal/controller/datafusion/instance" +) + +// Setup_datafusion creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_datafusion(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + instance.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_datalossprevention_setup.go b/internal/controller/zz_datalossprevention_setup.go new file mode 100755 index 000000000..8ecc4122e --- /dev/null +++ b/internal/controller/zz_datalossprevention_setup.go @@ -0,0 +1,32 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + deidentifytemplate "github.com/upbound/provider-gcp/internal/controller/datalossprevention/deidentifytemplate" + inspecttemplate "github.com/upbound/provider-gcp/internal/controller/datalossprevention/inspecttemplate" + jobtrigger "github.com/upbound/provider-gcp/internal/controller/datalossprevention/jobtrigger" + storedinfotype "github.com/upbound/provider-gcp/internal/controller/datalossprevention/storedinfotype" +) + +// Setup_datalossprevention creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_datalossprevention(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + deidentifytemplate.Setup, + inspecttemplate.Setup, + jobtrigger.Setup, + storedinfotype.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_dataplex_setup.go b/internal/controller/zz_dataplex_setup.go new file mode 100755 index 000000000..eca4c4c87 --- /dev/null +++ b/internal/controller/zz_dataplex_setup.go @@ -0,0 +1,30 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + asset "github.com/upbound/provider-gcp/internal/controller/dataplex/asset" + lake "github.com/upbound/provider-gcp/internal/controller/dataplex/lake" + zone "github.com/upbound/provider-gcp/internal/controller/dataplex/zone" +) + +// Setup_dataplex creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_dataplex(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + asset.Setup, + lake.Setup, + zone.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_dataproc_setup.go b/internal/controller/zz_dataproc_setup.go new file mode 100755 index 000000000..aeeb13613 --- /dev/null +++ b/internal/controller/zz_dataproc_setup.go @@ -0,0 +1,34 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + autoscalingpolicy "github.com/upbound/provider-gcp/internal/controller/dataproc/autoscalingpolicy" + cluster "github.com/upbound/provider-gcp/internal/controller/dataproc/cluster" + job "github.com/upbound/provider-gcp/internal/controller/dataproc/job" + metastoreservice "github.com/upbound/provider-gcp/internal/controller/dataproc/metastoreservice" + workflowtemplate "github.com/upbound/provider-gcp/internal/controller/dataproc/workflowtemplate" +) + +// Setup_dataproc creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_dataproc(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + autoscalingpolicy.Setup, + cluster.Setup, + job.Setup, + metastoreservice.Setup, + workflowtemplate.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_datastore_setup.go b/internal/controller/zz_datastore_setup.go new file mode 100755 index 000000000..817277846 --- /dev/null +++ b/internal/controller/zz_datastore_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + index "github.com/upbound/provider-gcp/internal/controller/datastore/index" +) + +// Setup_datastore creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_datastore(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + index.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_datastream_setup.go b/internal/controller/zz_datastream_setup.go new file mode 100755 index 000000000..49ba3429b --- /dev/null +++ b/internal/controller/zz_datastream_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + connectionprofile "github.com/upbound/provider-gcp/internal/controller/datastream/connectionprofile" + privateconnection "github.com/upbound/provider-gcp/internal/controller/datastream/privateconnection" +) + +// Setup_datastream creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_datastream(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + connectionprofile.Setup, + privateconnection.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_dialogflowcx_setup.go b/internal/controller/zz_dialogflowcx_setup.go new file mode 100755 index 000000000..d6ba26365 --- /dev/null +++ b/internal/controller/zz_dialogflowcx_setup.go @@ -0,0 +1,40 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + agent "github.com/upbound/provider-gcp/internal/controller/dialogflowcx/agent" + entitytype "github.com/upbound/provider-gcp/internal/controller/dialogflowcx/entitytype" + environment "github.com/upbound/provider-gcp/internal/controller/dialogflowcx/environment" + flow "github.com/upbound/provider-gcp/internal/controller/dialogflowcx/flow" + intent "github.com/upbound/provider-gcp/internal/controller/dialogflowcx/intent" + page "github.com/upbound/provider-gcp/internal/controller/dialogflowcx/page" + version "github.com/upbound/provider-gcp/internal/controller/dialogflowcx/version" + webhook "github.com/upbound/provider-gcp/internal/controller/dialogflowcx/webhook" +) + +// Setup_dialogflowcx creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_dialogflowcx(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + agent.Setup, + entitytype.Setup, + environment.Setup, + flow.Setup, + intent.Setup, + page.Setup, + version.Setup, + webhook.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_dns_setup.go b/internal/controller/zz_dns_setup.go new file mode 100755 index 000000000..deb16e8b3 --- /dev/null +++ b/internal/controller/zz_dns_setup.go @@ -0,0 +1,32 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + managedzone "github.com/upbound/provider-gcp/internal/controller/dns/managedzone" + managedzoneiammember "github.com/upbound/provider-gcp/internal/controller/dns/managedzoneiammember" + policy "github.com/upbound/provider-gcp/internal/controller/dns/policy" + recordset "github.com/upbound/provider-gcp/internal/controller/dns/recordset" +) + +// Setup_dns creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_dns(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + managedzone.Setup, + managedzoneiammember.Setup, + policy.Setup, + recordset.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_documentai_setup.go b/internal/controller/zz_documentai_setup.go new file mode 100755 index 000000000..0e4452b64 --- /dev/null +++ b/internal/controller/zz_documentai_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + processor "github.com/upbound/provider-gcp/internal/controller/documentai/processor" +) + +// Setup_documentai creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_documentai(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + processor.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_essentialcontacts_setup.go b/internal/controller/zz_essentialcontacts_setup.go new file mode 100755 index 000000000..c9331a271 --- /dev/null +++ b/internal/controller/zz_essentialcontacts_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + contact "github.com/upbound/provider-gcp/internal/controller/essentialcontacts/contact" +) + +// Setup_essentialcontacts creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_essentialcontacts(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + contact.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_eventarc_setup.go b/internal/controller/zz_eventarc_setup.go new file mode 100755 index 000000000..bf33f5c29 --- /dev/null +++ b/internal/controller/zz_eventarc_setup.go @@ -0,0 +1,30 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + channel "github.com/upbound/provider-gcp/internal/controller/eventarc/channel" + googlechannelconfig "github.com/upbound/provider-gcp/internal/controller/eventarc/googlechannelconfig" + trigger "github.com/upbound/provider-gcp/internal/controller/eventarc/trigger" +) + +// Setup_eventarc creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_eventarc(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + channel.Setup, + googlechannelconfig.Setup, + trigger.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_filestore_setup.go b/internal/controller/zz_filestore_setup.go new file mode 100755 index 000000000..b4bd0dc81 --- /dev/null +++ b/internal/controller/zz_filestore_setup.go @@ -0,0 +1,30 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + backup "github.com/upbound/provider-gcp/internal/controller/filestore/backup" + instance "github.com/upbound/provider-gcp/internal/controller/filestore/instance" + snapshot "github.com/upbound/provider-gcp/internal/controller/filestore/snapshot" +) + +// Setup_filestore creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_filestore(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + backup.Setup, + instance.Setup, + snapshot.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_firebaserules_setup.go b/internal/controller/zz_firebaserules_setup.go new file mode 100755 index 000000000..3fafc7fe5 --- /dev/null +++ b/internal/controller/zz_firebaserules_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + release "github.com/upbound/provider-gcp/internal/controller/firebaserules/release" + ruleset "github.com/upbound/provider-gcp/internal/controller/firebaserules/ruleset" +) + +// Setup_firebaserules creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_firebaserules(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + release.Setup, + ruleset.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_gke_setup.go b/internal/controller/zz_gke_setup.go new file mode 100755 index 000000000..689be1a11 --- /dev/null +++ b/internal/controller/zz_gke_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + backupbackupplan "github.com/upbound/provider-gcp/internal/controller/gke/backupbackupplan" +) + +// Setup_gke creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_gke(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + backupbackupplan.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_gkehub_setup.go b/internal/controller/zz_gkehub_setup.go new file mode 100755 index 000000000..59f917944 --- /dev/null +++ b/internal/controller/zz_gkehub_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + membership "github.com/upbound/provider-gcp/internal/controller/gkehub/membership" + membershipiammember "github.com/upbound/provider-gcp/internal/controller/gkehub/membershipiammember" +) + +// Setup_gkehub creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_gkehub(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + membership.Setup, + membershipiammember.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_healthcare_setup.go b/internal/controller/zz_healthcare_setup.go new file mode 100755 index 000000000..ac0752f98 --- /dev/null +++ b/internal/controller/zz_healthcare_setup.go @@ -0,0 +1,30 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + consentstore "github.com/upbound/provider-gcp/internal/controller/healthcare/consentstore" + dataset "github.com/upbound/provider-gcp/internal/controller/healthcare/dataset" + datasetiammember "github.com/upbound/provider-gcp/internal/controller/healthcare/datasetiammember" +) + +// Setup_healthcare creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_healthcare(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + consentstore.Setup, + dataset.Setup, + datasetiammember.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_iam_setup.go b/internal/controller/zz_iam_setup.go new file mode 100755 index 000000000..ca9589f75 --- /dev/null +++ b/internal/controller/zz_iam_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + workloadidentitypool "github.com/upbound/provider-gcp/internal/controller/iam/workloadidentitypool" + workloadidentitypoolprovider "github.com/upbound/provider-gcp/internal/controller/iam/workloadidentitypoolprovider" +) + +// Setup_iam creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_iam(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + workloadidentitypool.Setup, + workloadidentitypoolprovider.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_iap_setup.go b/internal/controller/zz_iap_setup.go new file mode 100755 index 000000000..153818c38 --- /dev/null +++ b/internal/controller/zz_iap_setup.go @@ -0,0 +1,38 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + appengineserviceiammember "github.com/upbound/provider-gcp/internal/controller/iap/appengineserviceiammember" + appengineversioniammember "github.com/upbound/provider-gcp/internal/controller/iap/appengineversioniammember" + tunneliammember "github.com/upbound/provider-gcp/internal/controller/iap/tunneliammember" + webbackendserviceiammember "github.com/upbound/provider-gcp/internal/controller/iap/webbackendserviceiammember" + webiammember "github.com/upbound/provider-gcp/internal/controller/iap/webiammember" + webtypeappengineiammember "github.com/upbound/provider-gcp/internal/controller/iap/webtypeappengineiammember" + webtypecomputeiammember "github.com/upbound/provider-gcp/internal/controller/iap/webtypecomputeiammember" +) + +// Setup_iap creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_iap(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + appengineserviceiammember.Setup, + appengineversioniammember.Setup, + tunneliammember.Setup, + webbackendserviceiammember.Setup, + webiammember.Setup, + webtypeappengineiammember.Setup, + webtypecomputeiammember.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_identityplatform_setup.go b/internal/controller/zz_identityplatform_setup.go new file mode 100755 index 000000000..afdab1ddb --- /dev/null +++ b/internal/controller/zz_identityplatform_setup.go @@ -0,0 +1,40 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + defaultsupportedidpconfig "github.com/upbound/provider-gcp/internal/controller/identityplatform/defaultsupportedidpconfig" + inboundsamlconfig "github.com/upbound/provider-gcp/internal/controller/identityplatform/inboundsamlconfig" + oauthidpconfig "github.com/upbound/provider-gcp/internal/controller/identityplatform/oauthidpconfig" + projectdefaultconfig "github.com/upbound/provider-gcp/internal/controller/identityplatform/projectdefaultconfig" + tenant "github.com/upbound/provider-gcp/internal/controller/identityplatform/tenant" + tenantdefaultsupportedidpconfig "github.com/upbound/provider-gcp/internal/controller/identityplatform/tenantdefaultsupportedidpconfig" + tenantinboundsamlconfig "github.com/upbound/provider-gcp/internal/controller/identityplatform/tenantinboundsamlconfig" + tenantoauthidpconfig "github.com/upbound/provider-gcp/internal/controller/identityplatform/tenantoauthidpconfig" +) + +// Setup_identityplatform creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_identityplatform(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + defaultsupportedidpconfig.Setup, + inboundsamlconfig.Setup, + oauthidpconfig.Setup, + projectdefaultconfig.Setup, + tenant.Setup, + tenantdefaultsupportedidpconfig.Setup, + tenantinboundsamlconfig.Setup, + tenantoauthidpconfig.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_kms_setup.go b/internal/controller/zz_kms_setup.go new file mode 100755 index 000000000..0d33d0989 --- /dev/null +++ b/internal/controller/zz_kms_setup.go @@ -0,0 +1,38 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + cryptokey "github.com/upbound/provider-gcp/internal/controller/kms/cryptokey" + cryptokeyiammember "github.com/upbound/provider-gcp/internal/controller/kms/cryptokeyiammember" + cryptokeyversion "github.com/upbound/provider-gcp/internal/controller/kms/cryptokeyversion" + keyring "github.com/upbound/provider-gcp/internal/controller/kms/keyring" + keyringiammember "github.com/upbound/provider-gcp/internal/controller/kms/keyringiammember" + keyringimportjob "github.com/upbound/provider-gcp/internal/controller/kms/keyringimportjob" + secretciphertext "github.com/upbound/provider-gcp/internal/controller/kms/secretciphertext" +) + +// Setup_kms creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_kms(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + cryptokey.Setup, + cryptokeyiammember.Setup, + cryptokeyversion.Setup, + keyring.Setup, + keyringiammember.Setup, + keyringimportjob.Setup, + secretciphertext.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_logging_setup.go b/internal/controller/zz_logging_setup.go new file mode 100755 index 000000000..ec8d88aeb --- /dev/null +++ b/internal/controller/zz_logging_setup.go @@ -0,0 +1,34 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + logview "github.com/upbound/provider-gcp/internal/controller/logging/logview" + metric "github.com/upbound/provider-gcp/internal/controller/logging/metric" + projectbucketconfig "github.com/upbound/provider-gcp/internal/controller/logging/projectbucketconfig" + projectexclusion "github.com/upbound/provider-gcp/internal/controller/logging/projectexclusion" + projectsink "github.com/upbound/provider-gcp/internal/controller/logging/projectsink" +) + +// Setup_logging creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_logging(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + logview.Setup, + metric.Setup, + projectbucketconfig.Setup, + projectexclusion.Setup, + projectsink.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_memcache_setup.go b/internal/controller/zz_memcache_setup.go new file mode 100755 index 000000000..5f835787a --- /dev/null +++ b/internal/controller/zz_memcache_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + instance "github.com/upbound/provider-gcp/internal/controller/memcache/instance" +) + +// Setup_memcache creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_memcache(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + instance.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_mlengine_setup.go b/internal/controller/zz_mlengine_setup.go new file mode 100755 index 000000000..cf203b000 --- /dev/null +++ b/internal/controller/zz_mlengine_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + model "github.com/upbound/provider-gcp/internal/controller/mlengine/model" +) + +// Setup_mlengine creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_mlengine(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + model.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_monitoring_setup.go b/internal/controller/zz_monitoring_setup.go new file mode 100755 index 000000000..99bab9d7d --- /dev/null +++ b/internal/controller/zz_monitoring_setup.go @@ -0,0 +1,42 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + alertpolicy "github.com/upbound/provider-gcp/internal/controller/monitoring/alertpolicy" + customservice "github.com/upbound/provider-gcp/internal/controller/monitoring/customservice" + dashboard "github.com/upbound/provider-gcp/internal/controller/monitoring/dashboard" + group "github.com/upbound/provider-gcp/internal/controller/monitoring/group" + metricdescriptor "github.com/upbound/provider-gcp/internal/controller/monitoring/metricdescriptor" + notificationchannel "github.com/upbound/provider-gcp/internal/controller/monitoring/notificationchannel" + service "github.com/upbound/provider-gcp/internal/controller/monitoring/service" + slo "github.com/upbound/provider-gcp/internal/controller/monitoring/slo" + uptimecheckconfig "github.com/upbound/provider-gcp/internal/controller/monitoring/uptimecheckconfig" +) + +// Setup_monitoring creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_monitoring(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + alertpolicy.Setup, + customservice.Setup, + dashboard.Setup, + group.Setup, + metricdescriptor.Setup, + notificationchannel.Setup, + service.Setup, + slo.Setup, + uptimecheckconfig.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_monolith_setup.go similarity index 99% rename from internal/controller/zz_setup.go rename to internal/controller/zz_monolith_setup.go index fad075f26..4ffeec184 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_monolith_setup.go @@ -339,9 +339,9 @@ import ( workflow "github.com/upbound/provider-gcp/internal/controller/workflows/workflow" ) -// Setup creates all controllers with the supplied logger and adds them to +// Setup_monolith creates all controllers with the supplied logger and adds them to // the supplied manager. -func Setup(mgr ctrl.Manager, o controller.Options) error { +func Setup_monolith(mgr ctrl.Manager, o controller.Options) error { for _, setup := range []func(ctrl.Manager, controller.Options) error{ domain.Setup, envgroup.Setup, diff --git a/internal/controller/zz_networkconnectivity_setup.go b/internal/controller/zz_networkconnectivity_setup.go new file mode 100755 index 000000000..ffd8c7ccd --- /dev/null +++ b/internal/controller/zz_networkconnectivity_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + hub "github.com/upbound/provider-gcp/internal/controller/networkconnectivity/hub" + spoke "github.com/upbound/provider-gcp/internal/controller/networkconnectivity/spoke" +) + +// Setup_networkconnectivity creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_networkconnectivity(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + hub.Setup, + spoke.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_networkmanagement_setup.go b/internal/controller/zz_networkmanagement_setup.go new file mode 100755 index 000000000..2cee96cd1 --- /dev/null +++ b/internal/controller/zz_networkmanagement_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + connectivitytest "github.com/upbound/provider-gcp/internal/controller/networkmanagement/connectivitytest" +) + +// Setup_networkmanagement creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_networkmanagement(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + connectivitytest.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_notebooks_setup.go b/internal/controller/zz_notebooks_setup.go new file mode 100755 index 000000000..3d126ebaf --- /dev/null +++ b/internal/controller/zz_notebooks_setup.go @@ -0,0 +1,34 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + environment "github.com/upbound/provider-gcp/internal/controller/notebooks/environment" + instance "github.com/upbound/provider-gcp/internal/controller/notebooks/instance" + instanceiammember "github.com/upbound/provider-gcp/internal/controller/notebooks/instanceiammember" + runtime "github.com/upbound/provider-gcp/internal/controller/notebooks/runtime" + runtimeiammember "github.com/upbound/provider-gcp/internal/controller/notebooks/runtimeiammember" +) + +// Setup_notebooks creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_notebooks(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + environment.Setup, + instance.Setup, + instanceiammember.Setup, + runtime.Setup, + runtimeiammember.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_osconfig_setup.go b/internal/controller/zz_osconfig_setup.go new file mode 100755 index 000000000..9e850627c --- /dev/null +++ b/internal/controller/zz_osconfig_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + ospolicyassignment "github.com/upbound/provider-gcp/internal/controller/osconfig/ospolicyassignment" + patchdeployment "github.com/upbound/provider-gcp/internal/controller/osconfig/patchdeployment" +) + +// Setup_osconfig creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_osconfig(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + ospolicyassignment.Setup, + patchdeployment.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_oslogin_setup.go b/internal/controller/zz_oslogin_setup.go new file mode 100755 index 000000000..f81e08764 --- /dev/null +++ b/internal/controller/zz_oslogin_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + sshpublickey "github.com/upbound/provider-gcp/internal/controller/oslogin/sshpublickey" +) + +// Setup_oslogin creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_oslogin(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + sshpublickey.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_privateca_setup.go b/internal/controller/zz_privateca_setup.go new file mode 100755 index 000000000..372c8d02c --- /dev/null +++ b/internal/controller/zz_privateca_setup.go @@ -0,0 +1,36 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + capool "github.com/upbound/provider-gcp/internal/controller/privateca/capool" + capooliammember "github.com/upbound/provider-gcp/internal/controller/privateca/capooliammember" + certificate "github.com/upbound/provider-gcp/internal/controller/privateca/certificate" + certificateauthority "github.com/upbound/provider-gcp/internal/controller/privateca/certificateauthority" + certificatetemplate "github.com/upbound/provider-gcp/internal/controller/privateca/certificatetemplate" + certificatetemplateiammember "github.com/upbound/provider-gcp/internal/controller/privateca/certificatetemplateiammember" +) + +// Setup_privateca creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_privateca(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + capool.Setup, + capooliammember.Setup, + certificate.Setup, + certificateauthority.Setup, + certificatetemplate.Setup, + certificatetemplateiammember.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_pubsub_setup.go b/internal/controller/zz_pubsub_setup.go new file mode 100755 index 000000000..2937c8bb6 --- /dev/null +++ b/internal/controller/zz_pubsub_setup.go @@ -0,0 +1,40 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + litereservation "github.com/upbound/provider-gcp/internal/controller/pubsub/litereservation" + litesubscription "github.com/upbound/provider-gcp/internal/controller/pubsub/litesubscription" + litetopic "github.com/upbound/provider-gcp/internal/controller/pubsub/litetopic" + schema "github.com/upbound/provider-gcp/internal/controller/pubsub/schema" + subscription "github.com/upbound/provider-gcp/internal/controller/pubsub/subscription" + subscriptioniammember "github.com/upbound/provider-gcp/internal/controller/pubsub/subscriptioniammember" + topic "github.com/upbound/provider-gcp/internal/controller/pubsub/topic" + topiciammember "github.com/upbound/provider-gcp/internal/controller/pubsub/topiciammember" +) + +// Setup_pubsub creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_pubsub(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + litereservation.Setup, + litesubscription.Setup, + litetopic.Setup, + schema.Setup, + subscription.Setup, + subscriptioniammember.Setup, + topic.Setup, + topiciammember.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_redis_setup.go b/internal/controller/zz_redis_setup.go new file mode 100755 index 000000000..1351b0b5d --- /dev/null +++ b/internal/controller/zz_redis_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + instance "github.com/upbound/provider-gcp/internal/controller/redis/instance" +) + +// Setup_redis creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_redis(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + instance.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_secretmanager_setup.go b/internal/controller/zz_secretmanager_setup.go new file mode 100755 index 000000000..d399b8d20 --- /dev/null +++ b/internal/controller/zz_secretmanager_setup.go @@ -0,0 +1,30 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + secret "github.com/upbound/provider-gcp/internal/controller/secretmanager/secret" + secretiammember "github.com/upbound/provider-gcp/internal/controller/secretmanager/secretiammember" + secretversion "github.com/upbound/provider-gcp/internal/controller/secretmanager/secretversion" +) + +// Setup_secretmanager creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_secretmanager(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + secret.Setup, + secretiammember.Setup, + secretversion.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_servicenetworking_setup.go b/internal/controller/zz_servicenetworking_setup.go new file mode 100755 index 000000000..4d5cc4507 --- /dev/null +++ b/internal/controller/zz_servicenetworking_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + connection "github.com/upbound/provider-gcp/internal/controller/servicenetworking/connection" +) + +// Setup_servicenetworking creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_servicenetworking(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + connection.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_sourcerepo_setup.go b/internal/controller/zz_sourcerepo_setup.go new file mode 100755 index 000000000..c34aa8eaa --- /dev/null +++ b/internal/controller/zz_sourcerepo_setup.go @@ -0,0 +1,28 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + repository "github.com/upbound/provider-gcp/internal/controller/sourcerepo/repository" + repositoryiammember "github.com/upbound/provider-gcp/internal/controller/sourcerepo/repositoryiammember" +) + +// Setup_sourcerepo creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_sourcerepo(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + repository.Setup, + repositoryiammember.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_spanner_setup.go b/internal/controller/zz_spanner_setup.go new file mode 100755 index 000000000..59c2afe7e --- /dev/null +++ b/internal/controller/zz_spanner_setup.go @@ -0,0 +1,32 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + database "github.com/upbound/provider-gcp/internal/controller/spanner/database" + databaseiammember "github.com/upbound/provider-gcp/internal/controller/spanner/databaseiammember" + instance "github.com/upbound/provider-gcp/internal/controller/spanner/instance" + instanceiammember "github.com/upbound/provider-gcp/internal/controller/spanner/instanceiammember" +) + +// Setup_spanner creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_spanner(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + database.Setup, + databaseiammember.Setup, + instance.Setup, + instanceiammember.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_sql_setup.go b/internal/controller/zz_sql_setup.go new file mode 100755 index 000000000..71dfe35a7 --- /dev/null +++ b/internal/controller/zz_sql_setup.go @@ -0,0 +1,34 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + database "github.com/upbound/provider-gcp/internal/controller/sql/database" + databaseinstance "github.com/upbound/provider-gcp/internal/controller/sql/databaseinstance" + sourcerepresentationinstance "github.com/upbound/provider-gcp/internal/controller/sql/sourcerepresentationinstance" + sslcert "github.com/upbound/provider-gcp/internal/controller/sql/sslcert" + user "github.com/upbound/provider-gcp/internal/controller/sql/user" +) + +// Setup_sql creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_sql(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + database.Setup, + databaseinstance.Setup, + sourcerepresentationinstance.Setup, + sslcert.Setup, + user.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_storage_setup.go b/internal/controller/zz_storage_setup.go new file mode 100755 index 000000000..936354714 --- /dev/null +++ b/internal/controller/zz_storage_setup.go @@ -0,0 +1,44 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + bucket "github.com/upbound/provider-gcp/internal/controller/storage/bucket" + bucketaccesscontrol "github.com/upbound/provider-gcp/internal/controller/storage/bucketaccesscontrol" + bucketacl "github.com/upbound/provider-gcp/internal/controller/storage/bucketacl" + bucketiammember "github.com/upbound/provider-gcp/internal/controller/storage/bucketiammember" + bucketobject "github.com/upbound/provider-gcp/internal/controller/storage/bucketobject" + defaultobjectaccesscontrol "github.com/upbound/provider-gcp/internal/controller/storage/defaultobjectaccesscontrol" + defaultobjectacl "github.com/upbound/provider-gcp/internal/controller/storage/defaultobjectacl" + notification "github.com/upbound/provider-gcp/internal/controller/storage/notification" + objectaccesscontrol "github.com/upbound/provider-gcp/internal/controller/storage/objectaccesscontrol" + objectacl "github.com/upbound/provider-gcp/internal/controller/storage/objectacl" +) + +// Setup_storage creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_storage(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + bucket.Setup, + bucketaccesscontrol.Setup, + bucketacl.Setup, + bucketiammember.Setup, + bucketobject.Setup, + defaultobjectaccesscontrol.Setup, + defaultobjectacl.Setup, + notification.Setup, + objectaccesscontrol.Setup, + objectacl.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_storagetransfer_setup.go b/internal/controller/zz_storagetransfer_setup.go new file mode 100755 index 000000000..b2e44f6f7 --- /dev/null +++ b/internal/controller/zz_storagetransfer_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + agentpool "github.com/upbound/provider-gcp/internal/controller/storagetransfer/agentpool" +) + +// Setup_storagetransfer creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_storagetransfer(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + agentpool.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_tpu_setup.go b/internal/controller/zz_tpu_setup.go new file mode 100755 index 000000000..e82615f05 --- /dev/null +++ b/internal/controller/zz_tpu_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + node "github.com/upbound/provider-gcp/internal/controller/tpu/node" +) + +// Setup_tpu creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_tpu(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + node.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_vertexai_setup.go b/internal/controller/zz_vertexai_setup.go new file mode 100755 index 000000000..c21c0bf62 --- /dev/null +++ b/internal/controller/zz_vertexai_setup.go @@ -0,0 +1,32 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + dataset "github.com/upbound/provider-gcp/internal/controller/vertexai/dataset" + featurestore "github.com/upbound/provider-gcp/internal/controller/vertexai/featurestore" + featurestoreentitytype "github.com/upbound/provider-gcp/internal/controller/vertexai/featurestoreentitytype" + tensorboard "github.com/upbound/provider-gcp/internal/controller/vertexai/tensorboard" +) + +// Setup_vertexai creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_vertexai(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + dataset.Setup, + featurestore.Setup, + featurestoreentitytype.Setup, + tensorboard.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/internal/controller/zz_workflows_setup.go b/internal/controller/zz_workflows_setup.go new file mode 100755 index 000000000..f222337bf --- /dev/null +++ b/internal/controller/zz_workflows_setup.go @@ -0,0 +1,26 @@ +/* +Copyright 2021 Upbound Inc. +*/ + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/upbound/upjet/pkg/controller" + + workflow "github.com/upbound/provider-gcp/internal/controller/workflows/workflow" +) + +// Setup_workflows creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_workflows(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + workflow.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/package/crossplane-config.yaml b/package/crossplane-config.yaml new file mode 100644 index 000000000..4304484d5 --- /dev/null +++ b/package/crossplane-config.yaml @@ -0,0 +1,20 @@ +apiVersion: meta.pkg.crossplane.io/v1alpha1 +kind: Provider +metadata: + name: provider-gcp-{{ APIGROUP }} + labels: + pkg.crossplane.io/provider-family: gcp + annotations: + meta.crossplane.io/maintainer: Upbound + meta.crossplane.io/source: github.com/upbound/provider-gcp + meta.crossplane.io/description: | + Upbound's official Crossplane provider to manage Google Cloud Platform (GCP) + {{ APIGROUP }} services in Kubernetes. + meta.crossplane.io/readme: | + Provider GCP is a Crossplane provider for [Google Cloud Platform + (GCP)](https://cloud.google.com) developed and supported by Upbound. + Available resources and their fields can be found in the [Upbound + Marketplace](https://marketplace.upbound.io/providers/upbound/provider-gcp). + If you encounter an issue please reach out on support@upbound.io email + address. This is a subpackage for the {{ APIGROUP }} API group. + friendly-name.meta.crossplane.io: Provider GCP ({{ APIGROUP }}) diff --git a/package/crossplane-monolith.yaml b/package/crossplane-monolith.yaml new file mode 100644 index 000000000..3df2713b6 --- /dev/null +++ b/package/crossplane-monolith.yaml @@ -0,0 +1,18 @@ +apiVersion: meta.pkg.crossplane.io/v1alpha1 +kind: Provider +metadata: + name: provider-gcp + annotations: + meta.crossplane.io/maintainer: Upbound + meta.crossplane.io/source: github.com/upbound/provider-gcp + meta.crossplane.io/description: | + Upbound's official Crossplane provider to manage Google Cloud Platform (GCP) + services in Kubernetes. + meta.crossplane.io/readme: | + Provider GCP is a Crossplane provider for [Google Cloud Platform + (GCP)](https://cloud.google.com) developed and supported by Upbound. + Available resources and their fields can be found in the [Upbound + Marketplace](https://marketplace.upbound.io/providers/upbound/provider-gcp). + If you encounter an issue please reach out on support@upbound.io email + address. + friendly-name.meta.crossplane.io: Provider GCP diff --git a/package/crossplane.yaml b/package/crossplane.yaml index 8bb5125e4..0a06eaba6 100644 --- a/package/crossplane.yaml +++ b/package/crossplane.yaml @@ -1,18 +1,24 @@ apiVersion: meta.pkg.crossplane.io/v1alpha1 kind: Provider metadata: - name: provider-gcp + name: provider-gcp-{{ APIGROUP }} + labels: + pkg.crossplane.io/provider-family: gcp annotations: meta.crossplane.io/maintainer: Upbound meta.crossplane.io/source: github.com/upbound/provider-gcp meta.crossplane.io/description: | Upbound's official Crossplane provider to manage Google Cloud Platform (GCP) - services in Kubernetes. + {{ APIGROUP }} services in Kubernetes. meta.crossplane.io/readme: | Provider GCP is a Crossplane provider for [Google Cloud Platform (GCP)](https://cloud.google.com) developed and supported by Upbound. Available resources and their fields can be found in the [Upbound Marketplace](https://marketplace.upbound.io/providers/upbound/provider-gcp). If you encounter an issue please reach out on support@upbound.io email - address. - friendly-name.meta.crossplane.io: Provider GCP \ No newline at end of file + address. This is a subpackage for the {{ APIGROUP }} API group. + friendly-name.meta.crossplane.io: Provider GCP ({{ APIGROUP }}) +spec: + dependsOn: + - provider: {{ XPKG_REG_ORGS }}/provider-gcp-config + version: ">={{ VERSION }}" \ No newline at end of file