Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/v1alpha1/argocd_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,8 @@ func ConvertAlphaToBetaPrincipalServer(src *PrincipalServerSpec) *v1beta1.Princi
KeepAliveMinInterval: src.KeepAliveMinInterval,
Image: src.Image,
Env: src.Env,
Service: v1beta1.ArgoCDAgentPrincipalServiceSpec(src.Service),
Route: v1beta1.ArgoCDAgentPrincipalRouteSpec(src.Route),
}
}
return dst
Expand All @@ -802,6 +804,8 @@ func ConvertBetaToAlphaPrincipalServer(src *v1beta1.PrincipalServerSpec) *Princi
KeepAliveMinInterval: src.KeepAliveMinInterval,
Image: src.Image,
Env: src.Env,
Service: ArgoCDAgentPrincipalServiceSpec(src.Service),
Route: ArgoCDAgentPrincipalRouteSpec(src.Route),
}
}
return dst
Expand Down
49 changes: 49 additions & 0 deletions api/v1alpha1/argocd_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
v1 "k8s.io/api/networking/v1"
resourcev1 "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/conversion"

v1beta1 "github.com/argoproj-labs/argocd-operator/api/v1beta1"
Expand Down Expand Up @@ -529,6 +530,12 @@ func TestAlphaToBetaConversion(t *testing.T) {
Enabled: &enabled,
Server: &PrincipalServerSpec{
Auth: "mtls:CN=([^,]+)",
Service: ArgoCDAgentPrincipalServiceSpec{
Type: corev1.ServiceTypeClusterIP,
},
Route: ArgoCDAgentPrincipalRouteSpec{
Enabled: ptr.To(true),
},
},
},
}
Expand All @@ -540,6 +547,12 @@ func TestAlphaToBetaConversion(t *testing.T) {
Enabled: &enabled,
Server: &v1beta1.PrincipalServerSpec{
Auth: "mtls:CN=([^,]+)",
Service: v1beta1.ArgoCDAgentPrincipalServiceSpec{
Type: corev1.ServiceTypeClusterIP,
},
Route: v1beta1.ArgoCDAgentPrincipalRouteSpec{
Enabled: ptr.To(true),
},
},
},
}
Expand All @@ -563,6 +576,12 @@ func TestAlphaToBetaConversion(t *testing.T) {
LogFormat: "text",
Image: "quay.io/user/argocd-agent:v1",
KeepAliveMinInterval: "30s",
Service: ArgoCDAgentPrincipalServiceSpec{
Type: corev1.ServiceTypeLoadBalancer,
},
Route: ArgoCDAgentPrincipalRouteSpec{
Enabled: ptr.To(false),
},
},
Redis: &PrincipalRedisSpec{
ServerAddress: "redis:6379",
Expand Down Expand Up @@ -606,6 +625,12 @@ func TestAlphaToBetaConversion(t *testing.T) {
LogFormat: "text",
KeepAliveMinInterval: "30s",
Image: "quay.io/user/argocd-agent:v1",
Service: v1beta1.ArgoCDAgentPrincipalServiceSpec{
Type: corev1.ServiceTypeLoadBalancer,
},
Route: v1beta1.ArgoCDAgentPrincipalRouteSpec{
Enabled: ptr.To(false),
},
},
Redis: &v1beta1.PrincipalRedisSpec{
ServerAddress: "redis:6379",
Expand Down Expand Up @@ -760,6 +785,12 @@ func TestBetaToAlphaConversion(t *testing.T) {
Enabled: &enabled,
Server: &v1beta1.PrincipalServerSpec{
Auth: "mtls:CN=([^,]+)",
Service: v1beta1.ArgoCDAgentPrincipalServiceSpec{
Type: corev1.ServiceTypeNodePort,
},
Route: v1beta1.ArgoCDAgentPrincipalRouteSpec{
Enabled: ptr.To(true),
},
},
},
}
Expand All @@ -771,6 +802,12 @@ func TestBetaToAlphaConversion(t *testing.T) {
Enabled: &enabled,
Server: &PrincipalServerSpec{
Auth: "mtls:CN=([^,]+)",
Service: ArgoCDAgentPrincipalServiceSpec{
Type: corev1.ServiceTypeNodePort,
},
Route: ArgoCDAgentPrincipalRouteSpec{
Enabled: ptr.To(true),
},
},
},
}
Expand All @@ -797,6 +834,12 @@ func TestBetaToAlphaConversion(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "TEST_ENV", Value: "test-value"},
},
Service: v1beta1.ArgoCDAgentPrincipalServiceSpec{
Type: corev1.ServiceTypeExternalName,
},
Route: v1beta1.ArgoCDAgentPrincipalRouteSpec{
Enabled: ptr.To(false),
},
},
Redis: &v1beta1.PrincipalRedisSpec{
ServerAddress: "redis:6379",
Expand Down Expand Up @@ -843,6 +886,12 @@ func TestBetaToAlphaConversion(t *testing.T) {
Env: []corev1.EnvVar{
{Name: "TEST_ENV", Value: "test-value"},
},
Service: ArgoCDAgentPrincipalServiceSpec{
Type: corev1.ServiceTypeExternalName,
},
Route: ArgoCDAgentPrincipalRouteSpec{
Enabled: ptr.To(false),
},
},
Redis: &PrincipalRedisSpec{
ServerAddress: "redis:6379",
Expand Down
22 changes: 22 additions & 0 deletions api/v1alpha1/argocd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,14 @@ type PrincipalServerSpec struct {

// Env lets you specify environment for principal pods
Env []corev1.EnvVar `json:"env,omitempty"`

// Service defines the options for the Service backing the ArgoCD Agent component.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can add a comment like: 'if Service is not defined, a default of ClusterIP will be used'

// If not set, type ClusterIP will be used by default.
Service ArgoCDAgentPrincipalServiceSpec `json:"service,omitempty"`

// Route defines the options for the Route backing the ArgoCD Agent component.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can add a comment like 'If Route is not specified, a default of ... will be used'

// Route is disabled only when explicitly configured with Enabled: false
Route ArgoCDAgentPrincipalRouteSpec `json:"route,omitempty"`
}

type PrincipalRedisSpec struct {
Expand Down Expand Up @@ -1123,6 +1131,20 @@ type PrincipalTLSSpec struct {
InsecureGenerate *bool `json:"insecureGenerate,omitempty"`
}

// ArgoCDAgentPrincipalServiceSpec defines the options for the Service backing the ArgoCD Agent Principal component.
type ArgoCDAgentPrincipalServiceSpec struct {
// Type is the ServiceType to use for the Service resource.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can add a comment indicating what the default is for this field. Something like 'if type is not specified, the default of 'ClusterIP' will be used'

// If not set, type ClusterIP will be used by default.
Type corev1.ServiceType `json:"type"`
}

// ArgoCDAgentPrincipalRouteSpec defines the options for the Route backing the ArgoCD Agent Principal component.
type ArgoCDAgentPrincipalRouteSpec struct {
// Enabled will toggle the creation of the OpenShift Route, ignored in case of non OpenShift cluster.
// Route is disabled only when explicitly configured with false
Enabled *bool `json:"enabled,omitempty"`
}

func (a *PrincipalSpec) IsEnabled() bool {
return a.Enabled != nil && *a.Enabled
}
Expand Down
37 changes: 37 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions api/v1beta1/argocd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,14 @@ type PrincipalServerSpec struct {

// Env lets you specify environment for principal pods
Env []corev1.EnvVar `json:"env,omitempty"`

// Service defines the options for the Service backing the ArgoCD Agent component.
// If not set, type ClusterIP will be used by default.
Service ArgoCDAgentPrincipalServiceSpec `json:"service,omitempty"`

// Route defines the options for the Route backing the ArgoCD Agent component.
// Route is disabled only when explicitly configured with Enabled: false
Route ArgoCDAgentPrincipalRouteSpec `json:"route,omitempty"`
}

type PrincipalRedisSpec struct {
Expand Down Expand Up @@ -1282,6 +1290,20 @@ type PrincipalTLSSpec struct {
InsecureGenerate *bool `json:"insecureGenerate,omitempty"`
}

// ArgoCDAgentPrincipalServiceSpec defines the options for the Service backing the ArgoCD Agent Principalcomponent.
type ArgoCDAgentPrincipalServiceSpec struct {
// Type is the ServiceType to use for the Service resource.
// If not set, type ClusterIP will be used by default.
Type corev1.ServiceType `json:"type"`
}

// ArgoCDAgentPrincipalRouteSpec defines the options for the Route backing the ArgoCD Agent Principal component.
type ArgoCDAgentPrincipalRouteSpec struct {
// Enabled will toggle the creation of the OpenShift Route, ignored in case of non OpenShift cluster.
// Route is disabled only when explicitly configured with false
Enabled *bool `json:"enabled,omitempty"`
}

func (a *PrincipalSpec) IsEnabled() bool {
return a.Enabled != nil && *a.Enabled
}
Expand Down
37 changes: 37 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions bundle/manifests/argoproj.io_argocds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,30 @@ spec:
description: LogLevel refers to the log level used by
the Principal component.
type: string
route:
description: |-
Route defines the options for the Route backing the ArgoCD Agent component.
Route is disabled only when explicitly configured with Enabled: false
properties:
enabled:
description: |-
Enabled will toggle the creation of the OpenShift Route, ignored in case of non OpenShift cluster.
Route is disabled only when explicitly configured with false
type: boolean
type: object
service:
description: |-
Service defines the options for the Service backing the ArgoCD Agent component.
If not set, type ClusterIP will be used by default.
properties:
type:
description: |-
Type is the ServiceType to use for the Service resource.
If not set, type ClusterIP will be used by default.
type: string
required:
- type
type: object
type: object
tls:
description: TLS defines the TLS options for the Principal
Expand Down Expand Up @@ -10640,6 +10664,30 @@ spec:
description: LogLevel refers to the log level used by
the Principal component.
type: string
route:
description: |-
Route defines the options for the Route backing the ArgoCD Agent component.
Route is disabled only when explicitly configured with Enabled: false
properties:
enabled:
description: |-
Enabled will toggle the creation of the OpenShift Route, ignored in case of non OpenShift cluster.
Route is disabled only when explicitly configured with false
type: boolean
type: object
service:
description: |-
Service defines the options for the Service backing the ArgoCD Agent component.
If not set, type ClusterIP will be used by default.
properties:
type:
description: |-
Type is the ServiceType to use for the Service resource.
If not set, type ClusterIP will be used by default.
type: string
required:
- type
type: object
type: object
tls:
description: TLS defines the TLS options for the Principal
Expand Down
Loading