Skip to content

Commit

Permalink
feat: enable management policies by default
Browse files Browse the repository at this point in the history
Signed-off-by: Marques Johansson <[email protected]>
  • Loading branch information
displague committed Jul 20, 2024
1 parent 13be323 commit e9e9e4c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion cmd/provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func main() {

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 ManagementPolicies.").Default("true").Envar("ENABLE_MANAGEMENT_POLICIES").Bool(
)
kingpin.MustParse(app.Parse(os.Args[1:]))

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

View workflow job for this annotation

GitHub Actions / e2e-tests

syntax error: unexpected ., expected type

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

View workflow job for this annotation

GitHub Actions / publish-artifacts

syntax error: unexpected ., expected type

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

View workflow job for this annotation

GitHub Actions / publish-artifacts

syntax error: unexpected ., expected type

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

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected ., expected type

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

View workflow job for this annotation

GitHub Actions / lint

expected type, found '.' (typecheck)

Expand Down Expand Up @@ -105,12 +106,27 @@ func main() {
OperationTrackerStore: upcontroller.NewOperationStore(log),
}

if *enableManagementPolicies {
o.Features.Enable(features.EnableBetaManagementPolicies)
log.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies)
}

if *enableExternalSecretStores {
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(*essTLS

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

View workflow job for this annotation

GitHub Actions / e2e-tests

syntax error: unexpected newline in argument list; possibly missing comma or )

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

View workflow job for this annotation

GitHub Actions / publish-artifacts

syntax error: unexpected newline in argument list; possibly missing comma or )

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

View workflow job for this annotation

GitHub Actions / publish-artifacts

syntax error: unexpected newline in argument list; possibly missing comma or )

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

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected newline in argument list; possibly missing comma or ) (typecheck)

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

View workflow job for this annotation

GitHub Actions / lint

missing ',' before newline in argument list (typecheck)
CertsPath, "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{
kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{
ObjectMeta: metav1.ObjectMeta{
Name: "default",
},
Expand All @@ -121,6 +137,7 @@ func main() {
DefaultScope: *namespace,
},
},
Status: v1alpha.StoreConfigStatus{},
})), "cannot create default store config")
}

Expand Down

0 comments on commit e9e9e4c

Please sign in to comment.