Skip to content

Commit

Permalink
Fix secret creation
Browse files Browse the repository at this point in the history
Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
  • Loading branch information
unguiculus committed Apr 24, 2020
1 parent 3d48307 commit 34a2c3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pkg/apis/craftypath/v1alpha1/sopssecret_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ type SopsSecretSpec struct {

// SopsSecretStatus defines the observed state of SopsSecret
type SopsSecretStatus struct {
LastUpdate metav1.Time
Reason string
Status string
LastUpdate metav1.Time `json:"lastUpdate,omitempty"`
Reason string `json:"reason,omitempty"`
Status string `json:"status,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
10 changes: 5 additions & 5 deletions pkg/controller/sopssecret/sopssecret_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package sopssecret

import (
"context"
"encoding/base64"
"fmt"
"math"
"time"
Expand Down Expand Up @@ -150,10 +149,7 @@ func (r *ReconcileSopsSecret) update(ctx context.Context, secret *corev1.Secret,
if err != nil {
return err
}
logger(ctx).V(1).Info("base64-encoding data", "fileName", fileName)
buf := make([]byte, base64.StdEncoding.EncodedLen(len(decrypted)))
base64.StdEncoding.Encode(buf, decrypted)
data[fileName] = buf
data[fileName] = decrypted
}

secret.ObjectMeta.Annotations = sopsSecret.Annotations
Expand Down Expand Up @@ -211,6 +207,10 @@ func (r *ReconcileSopsSecret) manageError(ctx context.Context, instance *craftyp
func (r *ReconcileSopsSecret) manageSuccess(ctx context.Context, instance *craftypathv1alpha1.SopsSecret, result controllerutil.OperationResult) (reconcile.Result, error) {
logger(ctx).V(1).Info("handling reconciliation success")

if result == controllerutil.OperationResultNone {
return reconcile.Result{}, nil
}

status := craftypathv1alpha1.SopsSecretStatus{
LastUpdate: metav1.Now(),
Reason: "",
Expand Down

0 comments on commit 34a2c3f

Please sign in to comment.