Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cmd/provider/main.go): External Secrets Store initialization #66

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
"path/filepath"
"time"

"github.com/crossplane/crossplane-runtime/pkg/certificates"

Check failure on line 13 in cmd/provider/main.go

View workflow job for this annotation

GitHub Actions / local-deploy

other declaration of certificates

Check failure on line 13 in cmd/provider/main.go

View workflow job for this annotation

GitHub Actions / unit-tests

other declaration of certificates

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
"github.com/crossplane/crossplane-runtime/pkg/certificates"

Check failure on line 16 in cmd/provider/main.go

View workflow job for this annotation

GitHub Actions / local-deploy

certificates redeclared in this block

Check failure on line 16 in cmd/provider/main.go

View workflow job for this annotation

GitHub Actions / local-deploy

"github.com/crossplane/crossplane-runtime/pkg/certificates" imported and not used

Check failure on line 16 in cmd/provider/main.go

View workflow job for this annotation

GitHub Actions / unit-tests

certificates redeclared in this block

Check failure on line 16 in cmd/provider/main.go

View workflow job for this annotation

GitHub Actions / unit-tests

"github.com/crossplane/crossplane-runtime/pkg/certificates" imported and not used
xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller"
"github.com/crossplane/crossplane-runtime/pkg/feature"
"github.com/crossplane/crossplane-runtime/pkg/logging"
Expand Down Expand Up @@ -114,19 +115,20 @@
SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *providerSource, *providerVersion),
}

o.ESSOptions = &tjcontroller.ESSOptions{}
if *essTLSCertsPath != "" {
log.Info("ESS TLS certificates path is set. Loading mTLS configuration.")
tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false)
kingpin.FatalIfError(err, "Cannot load ESS TLS config.")

o.ESSOptions.TLSConfig = tCfg
}

if *enableExternalSecretStores {
o.Features.Enable(features.EnableAlphaExternalSecretStores)
o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind
log.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores)

o.ESSOptions = &tjcontroller.ESSOptions{}
if *essTLSCertsPath != "" {
log.Info("ESS TLS certificates path is set. Loading mTLS configuration.")
tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false)
kingpin.FatalIfError(err, "Cannot load ESS TLS config.")

o.ESSOptions.TLSConfig = tCfg
}

// Ensure default store config exists.
kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{
ObjectMeta: metav1.ObjectMeta{
Expand Down
Loading