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
feat: updated changes by review feedback
=fcbedfaf1b5d
diff --git a/k8-operator/controllers/infisicalsecret_helper.go b/k8-operator/controllers/infisicalsecret_helper.goindex 042d19edfd..cc9b5c68eb 100644--- a/k8-operator/controllers/infisicalsecret_helper.go+++ b/k8-operator/controllers/infisicalsecret_helper.go@@ -227,11 +227,6 @@ func (r *InfisicalSecretReconciler) GetInfisicalServiceAccountCredentialsFromKubreturn model.ServiceAccountDetails{AccessKey: string(accessKeyFromSecret), PrivateKey: string(privateKeyFromSecret), PublicKey: string(publicKeyFromSecret)}, nil}-type TemplateSecret struct {- Value string `json:"value"`- SecretPath string `json:"secretPath"`-}-func (r *InfisicalSecretReconciler) CreateInfisicalManagedKubeSecret(ctx context.Context, infisicalSecret v1alpha1.InfisicalSecret, secretsFromAPI []model.SingleEnvironmentVariable, ETag string) error {plainProcessedSecrets := make(map[string][]byte)secretType := infisicalSecret.Spec.ManagedSecretReference.SecretType@@ -244,26 +239,26 @@ func (r *InfisicalSecretReconciler) CreateInfisicalManagedKubeSecret(ctx context}if managedTemplateData != nil {- secretKeyValue := make(map[string]TemplateSecret)+ secretKeyValue := make(map[string]model.SecretTemplateOptions)for _, secret := range secretsFromAPI {- secretKeyValue[secret.Key] = TemplateSecret{+ secretKeyValue[secret.Key] = model.SecretTemplateOptions{Value: secret.Value,SecretPath: secret.SecretPath,}}- for tmplKey, userTmpl := range managedTemplateData.Data {- tmpl, err := template.New("secret-templates").Parse(userTmpl)+ for templateKey, userTemplate := range managedTemplateData.Data {+ tmpl, err := template.New("secret-templates").Parse(userTemplate)if err != nil {- return fmt.Errorf("Unable to compile template: %s", tmplKey, err)+ return fmt.Errorf("Unable to compile template: %s", templateKey, err)}buf := bytes.NewBuffer(nil)err = tmpl.Execute(buf, secretKeyValue)if err != nil {- return fmt.Errorf("Unable to execute template: %s", tmplKey, err)+ return fmt.Errorf("Unable to execute template: %s", templateKey, err)}- plainProcessedSecrets[tmplKey] = buf.Bytes()+ plainProcessedSecrets[templateKey] = buf.Bytes()}}@@ -330,26 +325,26 @@ func (r *InfisicalSecretReconciler) UpdateInfisicalManagedKubeSecret(ctx context}if managedTemplateData != nil {- secretKeyValue := make(map[string]TemplateSecret)+ secretKeyValue := make(map[string]model.SecretTemplateOptions)for _, secret := range secretsFromAPI {- secretKeyValue[secret.Key] = TemplateSecret{+ secretKeyValue[secret.Key] = model.SecretTemplateOptions{Value: secret.Value,SecretPath: secret.SecretPath,}}- for tmplKey, userTmpl := range managedTemplateData.Data {- tmpl, err := template.New("secret-templates").Parse(userTmpl)+ for templateKey, userTemplate := range managedTemplateData.Data {+ tmpl, err := template.New("secret-templates").Parse(userTemplate)if err != nil {- return fmt.Errorf("Unable to compile template: %s", tmplKey, err)+ return fmt.Errorf("Unable to compile template: %s", templateKey, err)}buf := bytes.NewBuffer(nil)err = tmpl.Execute(buf, secretKeyValue)if err != nil {- return fmt.Errorf("Unable to execute template: %s", tmplKey, err)+ return fmt.Errorf("Unable to execute template: %s", templateKey, err)}- plainProcessedSecrets[tmplKey] = buf.Bytes()+ plainProcessedSecrets[templateKey] = buf.Bytes()}}diff --git a/k8-operator/main.go b/k8-operator/main.goindex d400545ff2..50c0cda004 100644--- a/k8-operator/main.go+++ b/k8-operator/main.go@@ -36,7 +36,7 @@ func main() {var metricsAddr stringvar enableLeaderElection boolvar probeAddr string- flag.StringVar(&metricsAddr, "metrics-bind-address", ":8082", "The address the metric endpoint binds to.")+ flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")flag.BoolVar(&enableLeaderElection, "leader-elect", false,"Enable leader election for controller manager. "+diff --git a/k8-operator/packages/model/model.go b/k8-operator/packages/model/model.goindex aa68597f5d..e3328061cc 100644--- a/k8-operator/packages/model/model.go+++ b/k8-operator/packages/model/model.go@@ -21,5 +21,10 @@ type SingleEnvironmentVariable struct {Value string `json:"value"`SecretPath string `json:"secretPath"`Type string `json:"type"`- ID string `json:"_id"`+ ID string `json:"id"`+}++type SecretTemplateOptions struct {+ Value string `json:"value"`+ SecretPath string `json:"secretPath"`}