Skip to content
Draft
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
80 changes: 52 additions & 28 deletions argocd-operator/api/v1alpha1/argocd_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,20 +817,21 @@ func ConvertAlphaToBetaPrincipal(src *PrincipalSpec) *v1beta1.PrincipalSpec {
var dst *v1beta1.PrincipalSpec
if src != nil {
dst = &v1beta1.PrincipalSpec{
Enabled: src.Enabled,
Auth: src.Auth,
LogLevel: src.LogLevel,
LogFormat: src.LogFormat,
Image: src.Image,
LabelSelector: src.LabelSelector,
Env: src.Env,
Server: ConvertAlphaToBetaPrincipalServer(src.Server),
Redis: ConvertAlphaToBetaPrincipalRedis(src.Redis),
Namespace: ConvertAlphaToBetaPrincipalNamespace(src.Namespace),
TLS: ConvertAlphaToBetaPrincipalTLS(src.TLS),
ResourceProxy: ConvertAlphaToBetaPrincipalResourceProxy(src.ResourceProxy),
JWT: ConvertAlphaToBetaPrincipalJWT(src.JWT),
Metrics: ConvertAlphaToBetaMetrics(src.Metrics),
Enabled: src.Enabled,
Auth: src.Auth,
LogLevel: src.LogLevel,
LogFormat: src.LogFormat,
Image: src.Image,
LabelSelector: src.LabelSelector,
Env: src.Env,
Server: ConvertAlphaToBetaPrincipalServer(src.Server),
Redis: ConvertAlphaToBetaPrincipalRedis(src.Redis),
Namespace: ConvertAlphaToBetaPrincipalNamespace(src.Namespace),
TLS: ConvertAlphaToBetaPrincipalTLS(src.TLS),
ResourceProxy: ConvertAlphaToBetaPrincipalResourceProxy(src.ResourceProxy),
JWT: ConvertAlphaToBetaPrincipalJWT(src.JWT),
Metrics: ConvertAlphaToBetaMetrics(src.Metrics),
SelfRegistration: ConvertAlphaToBetaPrincipalSelfRegistration(src.SelfRegistration),
}
}
return dst
Expand All @@ -851,20 +852,21 @@ func ConvertBetaToAlphaPrincipal(src *v1beta1.PrincipalSpec) *PrincipalSpec {
var dst *PrincipalSpec
if src != nil {
dst = &PrincipalSpec{
Enabled: src.Enabled,
Auth: src.Auth,
LogLevel: src.LogLevel,
LogFormat: src.LogFormat,
Image: src.Image,
LabelSelector: src.LabelSelector,
Env: src.Env,
Server: ConvertBetaToAlphaPrincipalServer(src.Server),
Redis: ConvertBetaToAlphaPrincipalRedis(src.Redis),
Namespace: ConvertBetaToAlphaPrincipalNamespace(src.Namespace),
TLS: ConvertBetaToAlphaPrincipalTLS(src.TLS),
ResourceProxy: ConvertBetaToAlphaPrincipalResourceProxy(src.ResourceProxy),
JWT: ConvertBetaToAlphaPrincipalJWT(src.JWT),
Metrics: ConvertBetaToAlphaMetrics(src.Metrics),
Enabled: src.Enabled,
Auth: src.Auth,
LogLevel: src.LogLevel,
LogFormat: src.LogFormat,
Image: src.Image,
LabelSelector: src.LabelSelector,
Env: src.Env,
Server: ConvertBetaToAlphaPrincipalServer(src.Server),
Redis: ConvertBetaToAlphaPrincipalRedis(src.Redis),
Namespace: ConvertBetaToAlphaPrincipalNamespace(src.Namespace),
TLS: ConvertBetaToAlphaPrincipalTLS(src.TLS),
ResourceProxy: ConvertBetaToAlphaPrincipalResourceProxy(src.ResourceProxy),
JWT: ConvertBetaToAlphaPrincipalJWT(src.JWT),
Metrics: ConvertBetaToAlphaMetrics(src.Metrics),
SelfRegistration: ConvertBetaToAlphaPrincipalSelfRegistration(src.SelfRegistration),
}
}
return dst
Expand Down Expand Up @@ -1211,3 +1213,25 @@ func ConvertAlphaToBetaNamespaceManagement(src []ManagedNamespaces) []v1beta1.Ma
}
return dst
}

func ConvertAlphaToBetaPrincipalSelfRegistration(src *PrincipalSelfRegistrationSpec) *v1beta1.PrincipalSelfRegistrationSpec {
var dst *v1beta1.PrincipalSelfRegistrationSpec
if src != nil {
dst = &v1beta1.PrincipalSelfRegistrationSpec{
Enabled: src.Enabled,
ClientCertSecretName: src.ClientCertSecretName,
}
}
return dst
}

func ConvertBetaToAlphaPrincipalSelfRegistration(src *v1beta1.PrincipalSelfRegistrationSpec) *PrincipalSelfRegistrationSpec {
var dst *PrincipalSelfRegistrationSpec
if src != nil {
dst = &PrincipalSelfRegistrationSpec{
Enabled: src.Enabled,
ClientCertSecretName: src.ClientCertSecretName,
}
}
return dst
}
58 changes: 58 additions & 0 deletions argocd-operator/api/v1alpha1/argocd_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,35 @@ func TestAlphaToBetaConversion(t *testing.T) {
}
}),
},
{
name: "ArgoCD Example - Agent Principal with SelfRegistration",
input: makeTestArgoCDAlpha(func(cr *ArgoCD) {
enabled := true
selfRegEnabled := true
cr.Spec.ArgoCDAgent = &ArgoCDAgentSpec{
Principal: &PrincipalSpec{
Enabled: &enabled,
SelfRegistration: &PrincipalSelfRegistrationSpec{
Enabled: &selfRegEnabled,
ClientCertSecretName: "argocd-agent-shared-client-cert",
},
},
}
}),
expectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
enabled := true
selfRegEnabled := true
cr.Spec.ArgoCDAgent = &v1beta1.ArgoCDAgentSpec{
Principal: &v1beta1.PrincipalSpec{
Enabled: &enabled,
SelfRegistration: &v1beta1.PrincipalSelfRegistrationSpec{
Enabled: &selfRegEnabled,
ClientCertSecretName: "argocd-agent-shared-client-cert",
},
},
}
}),
},
}

for _, test := range tests {
Expand Down Expand Up @@ -1252,6 +1281,35 @@ func TestBetaToAlphaConversion(t *testing.T) {
}
}),
},
{
name: "ArgoCD Example - Agent Principal with SelfRegistration",
input: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {
enabled := true
selfRegEnabled := true
cr.Spec.ArgoCDAgent = &v1beta1.ArgoCDAgentSpec{
Principal: &v1beta1.PrincipalSpec{
Enabled: &enabled,
SelfRegistration: &v1beta1.PrincipalSelfRegistrationSpec{
Enabled: &selfRegEnabled,
ClientCertSecretName: "argocd-agent-shared-client-cert",
},
},
}
}),
expectedOutput: makeTestArgoCDAlpha(func(cr *ArgoCD) {
enabled := true
selfRegEnabled := true
cr.Spec.ArgoCDAgent = &ArgoCDAgentSpec{
Principal: &PrincipalSpec{
Enabled: &enabled,
SelfRegistration: &PrincipalSelfRegistrationSpec{
Enabled: &selfRegEnabled,
ClientCertSecretName: "argocd-agent-shared-client-cert",
},
},
}
}),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
Expand Down
13 changes: 13 additions & 0 deletions argocd-operator/api/v1alpha1/argocd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,19 @@ type PrincipalSpec struct {

// Metrics defines the metrics configuration for the Principal ServiceMonitor.
Metrics *ArgoCDMetricsSpec `json:"metrics,omitempty"`

// SelfRegistration defines the self-registration options for the Principal component.
SelfRegistration *PrincipalSelfRegistrationSpec `json:"selfRegistration,omitempty"`
}

type PrincipalSelfRegistrationSpec struct {
// Enabled is the flag to enable self-registration of agents.
// When enabled, agents with valid credentials can automatically register on connection.
Enabled *bool `json:"enabled,omitempty"`

// ClientCertSecretName is the name of the TLS secret containing shared client cert
// for self-registered cluster secrets (must have tls.crt, tls.key, ca.crt).
ClientCertSecretName string `json:"clientCertSecretName,omitempty"`
}

type PrincipalServerSpec struct {
Expand Down
25 changes: 25 additions & 0 deletions argocd-operator/api/v1alpha1/zz_generated.deepcopy.go

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

13 changes: 13 additions & 0 deletions argocd-operator/api/v1beta1/argocd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1490,6 +1490,19 @@ type PrincipalSpec struct {

// Metrics defines the metrics configuration for the Principal ServiceMonitor.
Metrics *ArgoCDMetricsSpec `json:"metrics,omitempty"`

// SelfRegistration defines the self-registration options for the Principal component.
SelfRegistration *PrincipalSelfRegistrationSpec `json:"selfRegistration,omitempty"`
}

type PrincipalSelfRegistrationSpec struct {
// Enabled is the flag to enable self-registration of agents.
// When enabled, agents with valid credentials can automatically register on connection.
Enabled *bool `json:"enabled,omitempty"`

// ClientCertSecretName is the name of the TLS secret containing shared client cert
// for self-registered cluster secrets (must have tls.crt, tls.key, ca.crt).
ClientCertSecretName string `json:"clientCertSecretName,omitempty"`
}

type PrincipalServerSpec struct {
Expand Down
25 changes: 25 additions & 0 deletions argocd-operator/api/v1beta1/zz_generated.deepcopy.go

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

30 changes: 30 additions & 0 deletions argocd-operator/bundle/manifests/argoproj.io_argocds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,21 @@ spec:
the TLS certificate and key for the resource proxy.
type: string
type: object
selfRegistration:
description: SelfRegistration defines the self-registration
options for the Principal component.
properties:
clientCertSecretName:
description: |-
ClientCertSecretName is the name of the TLS secret containing shared client cert
for self-registered cluster secrets (must have tls.crt, tls.key, ca.crt).
type: string
enabled:
description: |-
Enabled is the flag to enable self-registration of agents.
When enabled, agents with valid credentials can automatically register on connection.
type: boolean
type: object
server:
description: Server defines the server options for the Principal
component.
Expand Down Expand Up @@ -14183,6 +14198,21 @@ spec:
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
selfRegistration:
description: SelfRegistration defines the self-registration
options for the Principal component.
properties:
clientCertSecretName:
description: |-
ClientCertSecretName is the name of the TLS secret containing shared client cert
for self-registered cluster secrets (must have tls.crt, tls.key, ca.crt).
type: string
enabled:
description: |-
Enabled is the flag to enable self-registration of agents.
When enabled, agents with valid credentials can automatically register on connection.
type: boolean
type: object
server:
description: Server defines the server options for the Principal
component.
Expand Down
4 changes: 2 additions & 2 deletions argocd-operator/common/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ vs-ssh.visualstudio.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Hr1oTWqNqOlzGJOf
ArgoCDCmdParamsConfigMapName = "argocd-cmd-params-cm"

// ArgoCDAgentPrincipalDefaultImageName is the default image name for the ArgoCD agent's principal component.
ArgoCDAgentPrincipalDefaultImageName = "quay.io/argoprojlabs/argocd-agent:v0.9.0"
ArgoCDAgentPrincipalDefaultImageName = "quay.io/argoprojlabs/argocd-agent:v0.10.0"

// ArgoCDAgentAgentDefaultImageName is the default image name for the ArgoCD agent's agent component.
ArgoCDAgentAgentDefaultImageName = "quay.io/argoprojlabs/argocd-agent:v0.9.0"
ArgoCDAgentAgentDefaultImageName = "quay.io/argoprojlabs/argocd-agent:v0.10.0"

// ArgoCDImageUpdaterControllerComponent is the name of the Image Updater controller control plane component
ArgoCDImageUpdaterControllerComponent = "argocd-image-updater-controller"
Expand Down
30 changes: 30 additions & 0 deletions argocd-operator/config/crd/bases/argoproj.io_argocds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,21 @@ spec:
the TLS certificate and key for the resource proxy.
type: string
type: object
selfRegistration:
description: SelfRegistration defines the self-registration
options for the Principal component.
properties:
clientCertSecretName:
description: |-
ClientCertSecretName is the name of the TLS secret containing shared client cert
for self-registered cluster secrets (must have tls.crt, tls.key, ca.crt).
type: string
enabled:
description: |-
Enabled is the flag to enable self-registration of agents.
When enabled, agents with valid credentials can automatically register on connection.
type: boolean
type: object
server:
description: Server defines the server options for the Principal
component.
Expand Down Expand Up @@ -14172,6 +14187,21 @@ spec:
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
selfRegistration:
description: SelfRegistration defines the self-registration
options for the Principal component.
properties:
clientCertSecretName:
description: |-
ClientCertSecretName is the name of the TLS secret containing shared client cert
for self-registered cluster secrets (must have tls.crt, tls.key, ca.crt).
type: string
enabled:
description: |-
Enabled is the flag to enable self-registration of agents.
When enabled, agents with valid credentials can automatically register on connection.
type: boolean
type: object
server:
description: Server defines the server options for the Principal
component.
Expand Down
Loading
Loading