Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
requested changes
Daniel Hougaard34b7d28e2fe0
diff --git a/k8-operator/api/v1alpha1/generators.go b/k8-operator/api/v1alpha1/generators.goindex 2fb74661cb..0f6d86c2dd 100644--- a/k8-operator/api/v1alpha1/generators.go+++ b/k8-operator/api/v1alpha1/generators.go@@ -34,7 +34,6 @@ type ClusterGeneratorSpec struct {Kind GeneratorKind `json:"kind"`// Generator the spec for this generator, must match the kind.- // +kubebuilder:validation:OptionalGenerator GeneratorSpec `json:"generator,omitempty"`}@@ -96,26 +95,29 @@ type UUIDList struct {type PasswordSpec struct {// Length of the password to be generated.// Defaults to 24+ // +kubebuilder:validation:Optional// +kubebuilder:default=24Length int `json:"length"`- // Digits specifies the number of digits in the generated+ // digits specifies the number of digits in the generated// password. If omitted it defaults to 25% of the length of the passwordDigits *int `json:"digits,omitempty"`- // Symbols specifies the number of symbol characters in the generated+ // symbols specifies the number of symbol characters in the generated// password. If omitted it defaults to 25% of the length of the passwordSymbols *int `json:"symbols,omitempty"`- // SymbolCharacters specifies the special characters that should be used+ // symbolCharacters specifies the special characters that should be used// in the generated password.SymbolCharacters *string `json:"symbolCharacters,omitempty"`- // Set NoUpper to disable uppercase characters+ // Set noUpper to disable uppercase characters+ // +kubebuilder:validation:Optional// +kubebuilder:default=falseNoUpper bool `json:"noUpper"`- // set AllowRepeat to true to allow repeating characters.+ // set allowRepeat to true to allow repeating characters.+ // +kubebuilder:validation:Optional// +kubebuilder:default=falseAllowRepeat bool `json:"allowRepeat"`}diff --git a/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_helper.go b/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_helper.goindex 9db0599aba..1400b163bd 100644--- a/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_helper.go+++ b/k8-operator/controllers/infisicalpushsecret/infisicalpushsecret_helper.go@@ -107,7 +107,7 @@ func (r *InfisicalPushSecretReconciler) updateResourceVariables(infisicalPushSecinfisicalPushSecretResourceVariablesMap[string(infisicalPushSecret.UID)] = resourceVariables}-func (r *InfisicalPushSecretReconciler) processGenerators(infisicalPushSecret v1alpha1.InfisicalPushSecret) (map[string]string, error) {+func (r *InfisicalPushSecretReconciler) processGenerators(ctx context.Context, infisicalPushSecret v1alpha1.InfisicalPushSecret) (map[string]string, error) {processedSecrets := make(map[string]string)@@ -119,13 +119,17 @@ func (r *InfisicalPushSecretReconciler) processGenerators(infisicalPushSecret v1generatorRef := generator.GeneratorRefclusterGenerator := &v1alpha1.ClusterGenerator{}- err := r.Client.Get(context.TODO(), types.NamespacedName{Name: generatorRef.Name}, clusterGenerator)+ err := r.Client.Get(ctx, types.NamespacedName{Name: generatorRef.Name}, clusterGenerator)if err != nil {return nil, fmt.Errorf("unable to get ClusterGenerator resource [err=%s]", err)}if generatorRef.Kind == v1alpha1.GeneratorKindPassword {// get the custom ClusterGenerator resource from the cluster+ if clusterGenerator.Spec.Generator.PasswordSpec == nil {+ return nil, fmt.Errorf("password spec is not defined in the ClusterGenerator resource")+ }+password, err := generatorUtil.GeneratorPassword(*clusterGenerator.Spec.Generator.PasswordSpec)if err != nil {return nil, fmt.Errorf("unable to generate password [err=%s]", err)@@ -233,7 +237,7 @@ func (r *InfisicalPushSecretReconciler) ReconcileInfisicalPushSecret(ctx context}}- generatorSecrets, err := r.processGenerators(infisicalPushSecret)+ generatorSecrets, err := r.processGenerators(ctx, infisicalPushSecret)if err != nil {return fmt.Errorf("unable to process generators [err=%s]", err)}diff --git a/k8-operator/go.mod b/k8-operator/go.modindex fb76b38f22..c9b868b006 100644--- a/k8-operator/go.mod+++ b/k8-operator/go.mod@@ -4,10 +4,12 @@ go 1.21require (github.com/Masterminds/sprig/v3 v3.3.0+ github.com/aws/smithy-go v1.20.3github.com/infisical/go-sdk v0.4.4github.com/lestrrat-go/jwx/v2 v2.1.4github.com/onsi/ginkgo/v2 v2.6.0github.com/onsi/gomega v1.24.1+ github.com/sethvargo/go-password v0.3.1k8s.io/apimachinery v0.26.1k8s.io/client-go v0.26.1sigs.k8s.io/controller-runtime v0.14.4@@ -34,7 +36,6 @@ require (github.com/aws/aws-sdk-go-v2/service/sso v1.22.1 // indirectgithub.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.2 // indirectgithub.com/aws/aws-sdk-go-v2/service/sts v1.30.1 // indirect- github.com/aws/smithy-go v1.20.3 // indirectgithub.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirectgithub.com/felixge/httpsnoop v1.0.4 // indirectgithub.com/go-logr/stdr v1.2.2 // indirect@@ -51,7 +52,6 @@ require (github.com/mitchellh/copystructure v1.2.0 // indirectgithub.com/mitchellh/reflectwalk v1.0.2 // indirectgithub.com/segmentio/asm v1.2.0 // indirect- github.com/sethvargo/go-password v0.3.1 // indirectgithub.com/shopspring/decimal v1.4.0 // indirectgithub.com/spf13/cast v1.7.0 // indirectgo.opencensus.io v0.24.0 // indirect@@ -86,7 +86,7 @@ require (github.com/google/gnostic v0.5.7-v3refs // indirectgithub.com/google/go-cmp v0.6.0 // indirectgithub.com/google/gofuzz v1.1.0 // indirect- github.com/google/uuid v1.6.0 // indirect+ github.com/google/uuid v1.6.0github.com/imdario/mergo v0.3.12 // indirectgithub.com/josharian/intern v1.0.0 // indirectgithub.com/json-iterator/go v1.1.12 // indirectdiff --git a/k8-operator/packages/generator/password.go b/k8-operator/packages/generator/password.goindex 724dc74c7b..d322f10144 100644--- a/k8-operator/packages/generator/password.go+++ b/k8-operator/packages/generator/password.go@@ -39,7 +39,7 @@ func GeneratorPassword(spec v1alpha1.PasswordSpec) (string, error) {symbolCharacters := defaultSymbolChars- if spec.SymbolCharacters != nil {+ if spec.SymbolCharacters != nil && *spec.SymbolCharacters != "" {symbolCharacters = *spec.SymbolCharacters}diff --git a/k8-operator/packages/util/helpers.go b/k8-operator/packages/util/helpers.goindex bcee360467..ef37127159 100644--- a/k8-operator/packages/util/helpers.go+++ b/k8-operator/packages/util/helpers.go@@ -9,7 +9,7 @@ import (func ConvertIntervalToDuration(resyncInterval *string) (time.Duration, error) {- if resyncInterval == nil {+ if resyncInterval == nil || *resyncInterval == "" {return 0, nil}