Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Jaideep Rao <[email protected]>
  • Loading branch information
jaideepr97 committed Sep 28, 2023
1 parent 7d8f070 commit 97c92d8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions controllers/suite_testx.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

v1alpha1 "github.com/argoproj-labs/argocd-operator/api/v1alpha1"
argoprojv1alpha1 "github.com/argoproj-labs/argocd-operator/api/v1alpha1"
argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
//+kubebuilder:scaffold:imports
)
Expand Down Expand Up @@ -62,7 +62,7 @@ var _ = BeforeSuite(func() {
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

err = v1alpha1.AddToScheme(scheme.Scheme)
err = argoprojv1alpha1.AddToScheme(scheme.Scheme)
Expect(err).NotTo(HaveOccurred())

err = argoproj.AddToScheme(scheme.Scheme)
Expand Down
12 changes: 6 additions & 6 deletions pkg/util/removeFunctions.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package util
import (
"fmt"

"github.com/argoproj-labs/argocd-operator/api/v1beta1"
argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/common"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -13,14 +13,14 @@ import (
// FetchSecret will retrieve the object with the given Name using the provided client.
// The result will be returned.
func FetchSecret(client client.Client, meta metav1.ObjectMeta, name string) (*corev1.Secret, error) {
a := &v1beta1.ArgoCD{}
a := &argoproj.ArgoCD{}
a.ObjectMeta = meta
secret := NewSecretWithName(a, name)
return secret, FetchObject(client, meta.Namespace, name, secret)
}

// NewSecret returns a new Secret based on the given metadata.
func NewSecret(cr *v1beta1.ArgoCD) *corev1.Secret {
func NewSecret(cr *argoproj.ArgoCD) *corev1.Secret {
return &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Labels: common.DefaultLabels(cr.Name, cr.Name, ""),
Expand All @@ -30,14 +30,14 @@ func NewSecret(cr *v1beta1.ArgoCD) *corev1.Secret {
}

// NewTLSSecret returns a new TLS Secret based on the given metadata with the provided suffix on the Name.
func NewTLSSecret(cr *v1beta1.ArgoCD, suffix string) *corev1.Secret {
func NewTLSSecret(cr *argoproj.ArgoCD, suffix string) *corev1.Secret {
secret := NewSecretWithSuffix(cr, suffix)
secret.Type = corev1.SecretTypeTLS
return secret
}

// NewSecretWithName returns a new Secret based on the given metadata with the provided Name.
func NewSecretWithName(cr *v1beta1.ArgoCD, name string) *corev1.Secret {
func NewSecretWithName(cr *argoproj.ArgoCD, name string) *corev1.Secret {
secret := NewSecret(cr)

secret.ObjectMeta.Name = name
Expand All @@ -48,6 +48,6 @@ func NewSecretWithName(cr *v1beta1.ArgoCD, name string) *corev1.Secret {
}

// NewSecretWithSuffix returns a new Secret based on the given metadata with the provided suffix on the Name.
func NewSecretWithSuffix(cr *v1beta1.ArgoCD, suffix string) *corev1.Secret {
func NewSecretWithSuffix(cr *argoproj.ArgoCD, suffix string) *corev1.Secret {
return NewSecretWithName(cr, fmt.Sprintf("%s-%s", cr.Name, suffix))
}
6 changes: 3 additions & 3 deletions pkg/util/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import (

v1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/argoproj-labs/argocd-operator/api/v1beta1"
argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
"github.com/argoproj-labs/argocd-operator/common"
)

func TestDefaultAnnotations(t *testing.T) {
type args struct {
cr *v1beta1.ArgoCD
cr *argoproj.ArgoCD
}
tests := []struct {
name string
Expand All @@ -36,7 +36,7 @@ func TestDefaultAnnotations(t *testing.T) {
{
name: "simple annotations",
args: args{
&v1beta1.ArgoCD{
&argoproj.ArgoCD{
ObjectMeta: v1.ObjectMeta{
Name: "foo",
Namespace: "bar",
Expand Down
6 changes: 3 additions & 3 deletions pkg/workloads/workloads_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package workloads
import (
"errors"

"github.com/argoproj-labs/argocd-operator/api/v1beta1"
argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
oappsv1 "github.com/openshift/api/apps/v1"
appsv1 "k8s.io/api/apps/v1"
autoscaling "k8s.io/api/autoscaling/v1"
Expand Down Expand Up @@ -32,11 +32,11 @@ var (
}
)

func testMutationFuncFailed(cr *v1beta1.ArgoCD, resource interface{}, client cntrlClient.Client) error {
func testMutationFuncFailed(cr *argoproj.ArgoCD, resource interface{}, client cntrlClient.Client) error {
return errors.New("test-mutation-error")
}

func testMutationFuncSuccessful(cr *v1beta1.ArgoCD, resource interface{}, client cntrlClient.Client) error {
func testMutationFuncSuccessful(cr *argoproj.ArgoCD, resource interface{}, client cntrlClient.Client) error {
switch obj := resource.(type) {
case *appsv1.Deployment:
obj.Name = testNameMutated
Expand Down

0 comments on commit 97c92d8

Please sign in to comment.