Skip to content

Commit

Permalink
fix: removal of part of the secret.data should happen when deleted fr…
Browse files Browse the repository at this point in the history
…om sops.template.data (#32)

* fix: removal of part of the secret.data should happen when deleted from sops.template.data

* update charts
  • Loading branch information
isindir committed Oct 14, 2020
1 parent 7c68f4a commit a0d7e1b
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SHELL := /bin/bash
GO := GO15VENDOREXPERIMENT=1 GO111MODULE=on GOPROXY=https://proxy.golang.org go
SOPS_SEC_OPERATOR_VERSION := 0.1.4
SOPS_SEC_OPERATOR_VERSION := 0.1.5

# https://github.com/kubernetes-sigs/controller-tools/releases
CONTROLLER_TOOLS_VERSION := "v0.2.5"
Expand Down
4 changes: 2 additions & 2 deletions chart/helm2/sops-secrets-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
version: 0.3.4
appVersion: 0.1.4
version: 0.3.5
appVersion: 0.1.5
description: sops secrets operator
name: sops-secrets-operator
sources:
Expand Down
2 changes: 1 addition & 1 deletion chart/helm2/sops-secrets-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replicaCount: 1 # Deployment replica count - should not be modified

image:
repository: isindir/sops-secrets-operator # Operator image
tag: 0.1.4 # Operator image tag
tag: 0.1.5 # Operator image tag
pullPolicy: Always # Operator image pull policy

imagePullSecrets: [] # Secrets to pull image from private docker repository
Expand Down
4 changes: 2 additions & 2 deletions chart/helm3/sops-secrets-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
version: 0.4.5
appVersion: 0.1.4
version: 0.4.6
appVersion: 0.1.5
type: application
description: sops secrets operator
name: sops-secrets-operator
Expand Down
2 changes: 1 addition & 1 deletion chart/helm3/sops-secrets-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replicaCount: 1 # Deployment replica count - should not be modified

image:
repository: isindir/sops-secrets-operator # Operator image
tag: 0.1.4 # Operator image tag
tag: 0.1.5 # Operator image tag
pullPolicy: Always # Operator image pull policy

imagePullSecrets: [] # Secrets to pull image from private docker repository
Expand Down
10 changes: 9 additions & 1 deletion controllers/sopssecret_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (r *SopsSecretReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)
// reconciledSecrets := instanceEncrypted.Status.SecretsReconciled

// iterating over secret templates
r.Log.Info("Enetring template data loop", "sopssecret", req.NamespacedName)
r.Log.Info("Entering template data loop", "sopssecret", req.NamespacedName)
for _, secretTemplateValue := range instance.Spec.SecretsTemplate {
// Define a new secret object
newSecret, err := newSecretForCR(instance, &secretTemplateValue, r.Log)
Expand Down Expand Up @@ -157,6 +157,7 @@ func (r *SopsSecretReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)
foundSecret = foundSecret.DeepCopy()

foundSecret.StringData = newSecret.StringData
foundSecret.Data = map[string][]byte{}
foundSecret.Type = newSecret.Type
foundSecret.ObjectMeta.Annotations = newSecret.ObjectMeta.Annotations
foundSecret.ObjectMeta.Labels = newSecret.ObjectMeta.Labels
Expand All @@ -175,6 +176,13 @@ func (r *SopsSecretReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)

return reconcile.Result{}, err
}
r.Log.Info(
"Secret successfully refreshed",
"secret",
foundSecret.Name,
"namespace",
foundSecret.Namespace,
)
}
}

Expand Down
Binary file added docs/sops-secrets-operator-0.3.5.tgz
Binary file not shown.
Binary file added docs/sops-secrets-operator-0.4.6.tgz
Binary file not shown.

0 comments on commit a0d7e1b

Please sign in to comment.