Skip to content

Commit

Permalink
rm syncSecret func
Browse files Browse the repository at this point in the history
  • Loading branch information
szeort committed Jul 11, 2024
1 parent 9c5da42 commit 96b8b1f
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions controllers/k8s_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
errors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
)
Expand Down Expand Up @@ -100,28 +99,6 @@ func (r *CFAPIReconciler) ssa(ctx context.Context, obj client.Object) error {
return r.Client.Patch(ctx, obj, client.Apply, client.ForceOwnership, client.FieldOwner(fieldOwner))
}

func (r *CFAPIReconciler) syncSecret(ctx context.Context, source, target types.NamespacedName) error {
var sourceSecret = &corev1.Secret{}
var err = r.Client.Get(ctx, source, sourceSecret)
if err != nil {
return err

}
targetSecret := corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: target.Name,
Namespace: target.Namespace,
},
Type: "kubernetes.io/dockerconfigjson",
Data: sourceSecret.Data,
}
if r.secretExists(target.Namespace, target.Name) {
return r.Client.Patch(ctx, &targetSecret, client.MergeFrom(&corev1.Secret{}))
} else {
return r.Client.Create(context.Background(), &targetSecret)
}
}

func (r *CFAPIReconciler) createIfMissing(ctx context.Context, object client.Object) error {
err := r.Client.Create(ctx, object)
if !errors.IsAlreadyExists(err) {
Expand Down

0 comments on commit 96b8b1f

Please sign in to comment.