Skip to content

Commit

Permalink
Move the function ArgocdInitialAdminSecretObject() to the argocd.go f…
Browse files Browse the repository at this point in the history
…ile of the util package

Signed-off-by: cmoulliard <[email protected]>
  • Loading branch information
cmoulliard committed Dec 13, 2024
1 parent 570ca30 commit 2fe31a3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
16 changes: 0 additions & 16 deletions pkg/controllers/localbuild/argo.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import (
"github.com/cnoe-io/idpbuilder/api/v1alpha1"
"github.com/cnoe-io/idpbuilder/globals"
"github.com/cnoe-io/idpbuilder/pkg/k8s"
"github.com/cnoe-io/idpbuilder/pkg/util"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -59,16 +56,3 @@ func (r *LocalbuildReconciler) ReconcileArgo(ctx context.Context, req ctrl.Reque
resource.Status.ArgoCD.Available = true
return ctrl.Result{}, nil
}

func (r *LocalbuildReconciler) ArgocdInitialAdminSecretObject() corev1.Secret {
return corev1.Secret{
TypeMeta: metav1.TypeMeta{
Kind: "Secret",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: util.ArgocdInitialAdminSecretName,
Namespace: util.ArgocdNamespace,
},
}
}
2 changes: 1 addition & 1 deletion pkg/controllers/localbuild/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ func (r *LocalbuildReconciler) requestArgoCDAppSetRefresh(ctx context.Context) e
}

func (r *LocalbuildReconciler) extractArgocdInitialAdminSecret(ctx context.Context) (string, error) {
sec := r.ArgocdInitialAdminSecretObject()
sec := util.ArgocdInitialAdminSecretObject()
err := r.Client.Get(ctx, types.NamespacedName{
Namespace: sec.GetNamespace(),
Name: sec.GetName(),
Expand Down
15 changes: 15 additions & 0 deletions pkg/util/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package util
import (
"fmt"
"github.com/cnoe-io/idpbuilder/api/v1alpha1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
Expand All @@ -15,3 +17,16 @@ const (
func ArgocdBaseUrl(config v1alpha1.BuildCustomizationSpec) string {
return fmt.Sprintf(ArgocdIngressURL, config.Protocol, config.Port)
}

func ArgocdInitialAdminSecretObject() corev1.Secret {
return corev1.Secret{
TypeMeta: metav1.TypeMeta{
Kind: "Secret",
APIVersion: "v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: ArgocdInitialAdminSecretName,
Namespace: ArgocdNamespace,
},
}
}

0 comments on commit 2fe31a3

Please sign in to comment.