Skip to content

Commit

Permalink
chore: rebase against master branch (#1010)
Browse files Browse the repository at this point in the history
* rebase refactoring branch against master

---------

Signed-off-by: Jaideep Rao <[email protected]>
  • Loading branch information
jaideepr97 authored Sep 28, 2023
1 parent 4ceafa5 commit 32c01d0
Show file tree
Hide file tree
Showing 115 changed files with 27,212 additions and 7,596 deletions.
4 changes: 4 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ mkdocs:
python:
install:
- requirements: docs/requirements.txt
build:
os: "ubuntu-22.04"
tools:
python: "3.7"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY version/ version/

# Build
ARG LD_FLAGS
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$LD_FLAGS" -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="$LD_FLAGS" -a -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
4 changes: 4 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ reviewers:
- jopit
- jaideepr97
- ishitasequeira
- reginapizza
- ciiay
- svghadi

190 changes: 95 additions & 95 deletions api/v1alpha1/argocd_conversion.go

Large diffs are not rendered by default.

134 changes: 67 additions & 67 deletions api/v1alpha1/argocd_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/conversion"

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

type argoCDAlphaOpt func(*ArgoCD)
Expand All @@ -31,10 +31,10 @@ func makeTestArgoCDAlpha(opts ...argoCDAlphaOpt) *ArgoCD {
return a
}

type argoCDBetaOpt func(*v1beta1.ArgoCD)
type argoCDBetaOpt func(*argoproj.ArgoCD)

func makeTestArgoCDBeta(opts ...argoCDBetaOpt) *v1beta1.ArgoCD {
a := &v1beta1.ArgoCD{
func makeTestArgoCDBeta(opts ...argoCDBetaOpt) *argoproj.ArgoCD {
a := &argoproj.ArgoCD{
ObjectMeta: metav1.ObjectMeta{
Name: "test-argocd",
Namespace: "default",
Expand All @@ -54,7 +54,7 @@ func TestAlphaToBetaConversion(t *testing.T) {
tests := []struct {
name string
input *ArgoCD
expectedOutput *v1beta1.ArgoCD
expectedOutput *argoproj.ArgoCD
}{
// dex conversion
{
Expand All @@ -66,10 +66,10 @@ func TestAlphaToBetaConversion(t *testing.T) {
Version: "latest",
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
cr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.SSO = &argoproj.ArgoCDSSOSpec{
Provider: "dex",
Dex: &v1beta1.ArgoCDDexSpec{
Dex: &argoproj.ArgoCDDexSpec{
OpenShiftOAuth: true,
Image: "test",
Version: "latest",
Expand Down Expand Up @@ -97,10 +97,10 @@ func TestAlphaToBetaConversion(t *testing.T) {
},
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
cr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{
Provider: v1beta1.SSOProviderTypeDex,
Dex: &v1beta1.ArgoCDDexSpec{
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.SSO = &argoproj.ArgoCDSSOSpec{
Provider: argoproj.SSOProviderTypeDex,
Dex: &argoproj.ArgoCDDexSpec{
OpenShiftOAuth: true,
Resources: &corev1.ResourceRequirements{
Limits: corev1.ResourceList{
Expand All @@ -124,10 +124,10 @@ func TestAlphaToBetaConversion(t *testing.T) {
},
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
cr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{
Provider: v1beta1.SSOProviderTypeDex,
Dex: &v1beta1.ArgoCDDexSpec{
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.SSO = &argoproj.ArgoCDSSOSpec{
Provider: argoproj.SSOProviderTypeDex,
Dex: &argoproj.ArgoCDDexSpec{
Config: "test-config",
},
}
Expand All @@ -142,9 +142,9 @@ func TestAlphaToBetaConversion(t *testing.T) {
},
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
cr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{
Dex: &v1beta1.ArgoCDDexSpec{
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.SSO = &argoproj.ArgoCDSSOSpec{
Dex: &argoproj.ArgoCDDexSpec{
OpenShiftOAuth: false,
},
}
Expand All @@ -165,13 +165,13 @@ func TestAlphaToBetaConversion(t *testing.T) {
},
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
cr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{
Provider: v1beta1.SSOProviderTypeDex,
Dex: &v1beta1.ArgoCDDexSpec{
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.SSO = &argoproj.ArgoCDSSOSpec{
Provider: argoproj.SSOProviderTypeDex,
Dex: &argoproj.ArgoCDDexSpec{
OpenShiftOAuth: true,
},
Keycloak: &v1beta1.ArgoCDKeycloakSpec{
Keycloak: &argoproj.ArgoCDKeycloakSpec{
Image: "keycloak",
},
}
Expand All @@ -192,12 +192,12 @@ func TestAlphaToBetaConversion(t *testing.T) {
VerifyTLS: tls,
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
tls := new(bool)
*tls = false
cr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{
Provider: v1beta1.SSOProviderTypeKeycloak,
Keycloak: &v1beta1.ArgoCDKeycloakSpec{
cr.Spec.SSO = &argoproj.ArgoCDSSOSpec{
Provider: argoproj.SSOProviderTypeKeycloak,
Keycloak: &argoproj.ArgoCDKeycloakSpec{
RootCA: "__CA__",
VerifyTLS: tls,
},
Expand All @@ -211,9 +211,9 @@ func TestAlphaToBetaConversion(t *testing.T) {
Image: "test-image",
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
cr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{
Keycloak: &v1beta1.ArgoCDKeycloakSpec{
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.SSO = &argoproj.ArgoCDSSOSpec{
Keycloak: &argoproj.ArgoCDKeycloakSpec{
Image: "test-image",
},
}
Expand All @@ -224,7 +224,7 @@ func TestAlphaToBetaConversion(t *testing.T) {
{
name: "ArgoCD Example - Empty",
input: makeTestArgoCDAlpha(func(cr *ArgoCD) {}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {}),
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {}),
},
{
name: "ArgoCD Example - Dex + RBAC",
Expand All @@ -248,25 +248,25 @@ func TestAlphaToBetaConversion(t *testing.T) {
},
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
cr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{
Provider: v1beta1.SSOProviderTypeDex,
Dex: &v1beta1.ArgoCDDexSpec{
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.SSO = &argoproj.ArgoCDSSOSpec{
Provider: argoproj.SSOProviderTypeDex,
Dex: &argoproj.ArgoCDDexSpec{
OpenShiftOAuth: true,
},
}

defaultPolicy := "role:readonly"
policy := "g, system:cluster-admins, role:admin"
scope := "[groups]"
cr.Spec.RBAC = v1beta1.ArgoCDRBACSpec{
cr.Spec.RBAC = argoproj.ArgoCDRBACSpec{
DefaultPolicy: &defaultPolicy,
Policy: &policy,
Scopes: &scope,
}

cr.Spec.Server = v1beta1.ArgoCDServerSpec{
Route: v1beta1.ArgoCDRouteSpec{
cr.Spec.Server = argoproj.ArgoCDServerSpec{
Route: argoproj.ArgoCDRouteSpec{
Enabled: true,
},
}
Expand Down Expand Up @@ -321,21 +321,21 @@ func TestAlphaToBetaConversion(t *testing.T) {
},
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
cr.Spec.ResourceIgnoreDifferences = &v1beta1.ResourceIgnoreDifference{
All: &v1beta1.IgnoreDifferenceCustomization{
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.ResourceIgnoreDifferences = &argoproj.ResourceIgnoreDifference{
All: &argoproj.IgnoreDifferenceCustomization{
JsonPointers: []string{
"/spec/replicas",
},
ManagedFieldsManagers: []string{
"kube-controller-manager",
},
},
ResourceIdentifiers: []v1beta1.ResourceIdentifiers{
ResourceIdentifiers: []argoproj.ResourceIdentifiers{
{
Group: "admissionregistration.k8s.io",
Kind: "MutatingWebhookConfiguration",
Customization: v1beta1.IgnoreDifferenceCustomization{
Customization: argoproj.IgnoreDifferenceCustomization{
JqPathExpressions: []string{
"'.webhooks[]?.clientConfig.caBundle'",
},
Expand All @@ -344,7 +344,7 @@ func TestAlphaToBetaConversion(t *testing.T) {
{
Group: "apps",
Kind: "Deployment",
Customization: v1beta1.IgnoreDifferenceCustomization{
Customization: argoproj.IgnoreDifferenceCustomization{
ManagedFieldsManagers: []string{
"kube-controller-manager",
},
Expand All @@ -355,13 +355,13 @@ func TestAlphaToBetaConversion(t *testing.T) {
},
},
}
cr.Spec.ResourceHealthChecks = []v1beta1.ResourceHealthCheck{
cr.Spec.ResourceHealthChecks = []argoproj.ResourceHealthCheck{
{
Group: "certmanager.k8s.io",
Kind: "Certificate",
},
}
cr.Spec.ResourceActions = []v1beta1.ResourceAction{
cr.Spec.ResourceActions = []argoproj.ResourceAction{
{
Group: "apps",
Kind: "Deployment",
Expand All @@ -377,7 +377,7 @@ func TestAlphaToBetaConversion(t *testing.T) {
"ping": "pong",
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.Image = "test-image"
cr.Spec.ExtraConfig = map[string]string{
"ping": "pong",
Expand Down Expand Up @@ -411,21 +411,21 @@ func TestAlphaToBetaConversion(t *testing.T) {
Insecure: true,
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
cr.Spec.Server.Autoscale = v1beta1.ArgoCDServerAutoscaleSpec{
expectedOutput: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.Server.Autoscale = argoproj.ArgoCDServerAutoscaleSpec{
Enabled: true,
}
cr.Spec.Import = &v1beta1.ArgoCDImportSpec{
cr.Spec.Import = &argoproj.ArgoCDImportSpec{
Name: "test-name",
}
cr.Spec.Server = v1beta1.ArgoCDServerSpec{
cr.Spec.Server = argoproj.ArgoCDServerSpec{
Host: "test-host.argocd.org",
GRPC: v1beta1.ArgoCDServerGRPCSpec{
Ingress: v1beta1.ArgoCDIngressSpec{
GRPC: argoproj.ArgoCDServerGRPCSpec{
Ingress: argoproj.ArgoCDIngressSpec{
Enabled: false,
},
},
Ingress: v1beta1.ArgoCDIngressSpec{
Ingress: argoproj.ArgoCDIngressSpec{
Enabled: true,
TLS: []v1.IngressTLS{
{Hosts: []string{
Expand All @@ -443,13 +443,13 @@ func TestAlphaToBetaConversion(t *testing.T) {
t.Run(test.name, func(t *testing.T) {

// Set v1beta1 object in Hub, converted values will be set in this object.
var hub conversion.Hub = &v1beta1.ArgoCD{}
var hub conversion.Hub = &argoproj.ArgoCD{}

// Call ConvertTo function to convert v1alpha1 version to v1beta1
test.input.ConvertTo(hub)

// Fetch the converted object
result := hub.(*v1beta1.ArgoCD)
result := hub.(*argoproj.ArgoCD)

// Compare converted object with expected.
assert.Equal(t, test.expectedOutput, result)
Expand All @@ -462,17 +462,17 @@ func TestAlphaToBetaConversion(t *testing.T) {
func TestBetaToAlphaConversion(t *testing.T) {
tests := []struct {
name string
input *v1beta1.ArgoCD
input *argoproj.ArgoCD
expectedOutput *ArgoCD
}{
{
name: "ArgoCD Example - Empty",
input: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {}),
input: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {}),
expectedOutput: makeTestArgoCDAlpha(func(cr *ArgoCD) {}),
},
{
name: "ArgoCD Example - Image + ExtraConfig",
input: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
input: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.Image = "test-image"
cr.Spec.ExtraConfig = map[string]string{
"ping": "pong",
Expand All @@ -487,25 +487,25 @@ func TestBetaToAlphaConversion(t *testing.T) {
},
{
name: "ArgoCD Example - Dex + RBAC",
input: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
cr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{
Provider: v1beta1.SSOProviderTypeDex,
Dex: &v1beta1.ArgoCDDexSpec{
input: makeTestArgoCDBeta(func(cr *argoproj.ArgoCD) {
cr.Spec.SSO = &argoproj.ArgoCDSSOSpec{
Provider: argoproj.SSOProviderTypeDex,
Dex: &argoproj.ArgoCDDexSpec{
OpenShiftOAuth: true,
},
}

defaultPolicy := "role:readonly"
policy := "g, system:cluster-admins, role:admin"
scope := "[groups]"
cr.Spec.RBAC = v1beta1.ArgoCDRBACSpec{
cr.Spec.RBAC = argoproj.ArgoCDRBACSpec{
DefaultPolicy: &defaultPolicy,
Policy: &policy,
Scopes: &scope,
}

cr.Spec.Server = v1beta1.ArgoCDServerSpec{
Route: v1beta1.ArgoCDRouteSpec{
cr.Spec.Server = argoproj.ArgoCDServerSpec{
Route: argoproj.ArgoCDRouteSpec{
Enabled: true,
},
}
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/argocd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ type ArgoCDSpec struct {
// RepositoryCredentials are the Git pull credentials to configure Argo CD with upon creation of the cluster.
RepositoryCredentials string `json:"repositoryCredentials,omitempty"`

// Deprecated field. Support dropped in v1beta1 version.
// ResourceCustomizations customizes resource behavior. Keys are in the form: group/Kind. Please note that this is being deprecated in favor of ResourceHealthChecks, ResourceIgnoreDifferences, and ResourceActions.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Customizations'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"}
ResourceCustomizations string `json:"resourceCustomizations,omitempty"`
Expand Down
7 changes: 3 additions & 4 deletions api/v1beta1/argocd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ type ArgoCDApplicationSet struct {
LogLevel string `json:"logLevel,omitempty"`

WebhookServer WebhookServerSpec `json:"webhookServer,omitempty"`

// SCMRootCAConfigMap is the name of the config map that stores the Gitlab SCM Provider's TLS certificate which will be mounted on the ApplicationSet Controller (optional).
SCMRootCAConfigMap string `json:"scmRootCAConfigMap,omitempty"`
}

// ArgoCDCASpec defines the CA options for ArgCD.
Expand Down Expand Up @@ -748,10 +751,6 @@ type ArgoCDSpec struct {
// RepositoryCredentials are the Git pull credentials to configure Argo CD with upon creation of the cluster.
RepositoryCredentials string `json:"repositoryCredentials,omitempty"`

// ResourceCustomizations customizes resource behavior. Keys are in the form: group/Kind. Please note that this is being deprecated in favor of ResourceHealthChecks, ResourceIgnoreDifferences, and ResourceActions.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Customizations'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"}
ResourceCustomizations string `json:"resourceCustomizations,omitempty"`

// ResourceHealthChecks customizes resource health check behavior.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Resource Health Check Customizations'",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"}
ResourceHealthChecks []ResourceHealthCheck `json:"resourceHealthChecks,omitempty"`
Expand Down
Loading

0 comments on commit 32c01d0

Please sign in to comment.