Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow enabling ArgoCD workloads independently #1021

Merged
88 changes: 84 additions & 4 deletions api/v1alpha1/argocd_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func (src *ArgoCD) ConvertTo(dstRaw conversion.Hub) error {
dst.Spec.Notifications = v1beta1.ArgoCDNotifications(src.Spec.Notifications)
dst.Spec.Prometheus = *ConvertAlphaToBetaPrometheus(&src.Spec.Prometheus)
dst.Spec.RBAC = v1beta1.ArgoCDRBACSpec(src.Spec.RBAC)
dst.Spec.Redis = v1beta1.ArgoCDRedisSpec(src.Spec.Redis)
dst.Spec.Repo = v1beta1.ArgoCDRepoSpec(src.Spec.Repo)
dst.Spec.Redis = *ConvertAlphaToBetaRedis(&src.Spec.Redis)
dst.Spec.Repo = *ConvertAlphaToBetaRepo(&src.Spec.Repo)
dst.Spec.RepositoryCredentials = src.Spec.RepositoryCredentials
dst.Spec.ResourceHealthChecks = ConvertAlphaToBetaResourceHealthChecks(src.Spec.ResourceHealthChecks)
dst.Spec.ResourceIgnoreDifferences = ConvertAlphaToBetaResourceIgnoreDifferences(src.Spec.ResourceIgnoreDifferences)
Expand Down Expand Up @@ -143,8 +143,8 @@ func (dst *ArgoCD) ConvertFrom(srcRaw conversion.Hub) error {
dst.Spec.Notifications = ArgoCDNotifications(src.Spec.Notifications)
dst.Spec.Prometheus = *ConvertBetaToAlphaPrometheus(&src.Spec.Prometheus)
dst.Spec.RBAC = ArgoCDRBACSpec(src.Spec.RBAC)
dst.Spec.Redis = ArgoCDRedisSpec(src.Spec.Redis)
dst.Spec.Repo = ArgoCDRepoSpec(src.Spec.Repo)
dst.Spec.Redis = *ConvertBetaToAlphaRedis(&src.Spec.Redis)
dst.Spec.Repo = *ConvertBetaToAlphaRepo(&src.Spec.Repo)
dst.Spec.RepositoryCredentials = src.Spec.RepositoryCredentials
dst.Spec.ResourceHealthChecks = ConvertBetaToAlphaResourceHealthChecks(src.Spec.ResourceHealthChecks)
dst.Spec.ResourceIgnoreDifferences = ConvertBetaToAlphaResourceIgnoreDifferences(src.Spec.ResourceIgnoreDifferences)
Expand Down Expand Up @@ -184,6 +184,46 @@ func ConvertAlphaToBetaController(src *ArgoCDApplicationControllerSpec) *v1beta1
return dst
}

func ConvertAlphaToBetaRedis(src *ArgoCDRedisSpec) *v1beta1.ArgoCDRedisSpec {
var dst *v1beta1.ArgoCDRedisSpec
if src != nil {
dst = &v1beta1.ArgoCDRedisSpec{
AutoTLS: src.AutoTLS,
DisableTLSVerification: src.DisableTLSVerification,
Image: src.Image,
Resources: src.Resources,
Version: src.Version,
}
}
return dst
}

func ConvertAlphaToBetaRepo(src *ArgoCDRepoSpec) *v1beta1.ArgoCDRepoSpec {
var dst *v1beta1.ArgoCDRepoSpec
if src != nil {
dst = &v1beta1.ArgoCDRepoSpec{
AutoTLS: src.AutoTLS,
Env: src.Env,
ExecTimeout: src.ExecTimeout,
ExtraRepoCommandArgs: src.ExtraRepoCommandArgs,
Image: src.Image,
InitContainers: src.InitContainers,
LogFormat: src.LogFormat,
LogLevel: src.LogLevel,
MountSAToken: src.MountSAToken,
Replicas: src.Replicas,
Resources: src.Resources,
ServiceAccount: src.ServiceAccount,
SidecarContainers: src.SidecarContainers,
VerifyTLS: src.VerifyTLS,
Version: src.Version,
VolumeMounts: src.VolumeMounts,
Volumes: src.Volumes,
}
}
return dst
}

func ConvertAlphaToBetaWebhookServer(src *WebhookServerSpec) *v1beta1.WebhookServerSpec {
var dst *v1beta1.WebhookServerSpec
if src != nil {
Expand Down Expand Up @@ -604,3 +644,43 @@ func ConvertBetaToAlphaResourceHealthChecks(src []v1beta1.ResourceHealthCheck) [
}
return dst
}

func ConvertBetaToAlphaRedis(src *v1beta1.ArgoCDRedisSpec) *ArgoCDRedisSpec {
var dst *ArgoCDRedisSpec
if src != nil {
dst = &ArgoCDRedisSpec{
AutoTLS: src.AutoTLS,
DisableTLSVerification: src.DisableTLSVerification,
Image: src.Image,
Resources: src.Resources,
Version: src.Version,
}
}
return dst
}

func ConvertBetaToAlphaRepo(src *v1beta1.ArgoCDRepoSpec) *ArgoCDRepoSpec {
var dst *ArgoCDRepoSpec
if src != nil {
dst = &ArgoCDRepoSpec{
AutoTLS: src.AutoTLS,
Env: src.Env,
ExecTimeout: src.ExecTimeout,
ExtraRepoCommandArgs: src.ExtraRepoCommandArgs,
Image: src.Image,
InitContainers: src.InitContainers,
LogFormat: src.LogFormat,
LogLevel: src.LogLevel,
MountSAToken: src.MountSAToken,
Replicas: src.Replicas,
Resources: src.Resources,
ServiceAccount: src.ServiceAccount,
SidecarContainers: src.SidecarContainers,
VerifyTLS: src.VerifyTLS,
Version: src.Version,
VolumeMounts: src.VolumeMounts,
Volumes: src.Volumes,
}
}
return dst
}
41 changes: 41 additions & 0 deletions api/v1beta1/argocd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ type ArgoCDApplicationControllerSpec struct {

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

// Enabled is the flag to enable the Application Controller during ArgoCD installation. (optional, default `true`)
Enabled *bool `json:"enabled,omitempty"`
}

func (a *ArgoCDApplicationControllerSpec) IsEnabled() bool {
return a.Enabled == nil || (a.Enabled != nil && *a.Enabled)
}

// ArgoCDApplicationControllerShardSpec defines the options available for enabling sharding for the Application Controller component.
Expand Down Expand Up @@ -162,6 +169,13 @@ type ArgoCDApplicationSet struct {

// 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"`

// Enabled is the flag to enable the Application Set Controller during ArgoCD installation. (optional, default `true`)
Enabled *bool `json:"enabled,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems unnecessary for appset, since we can already enable/disable appset by leaving it as nil or not nil
is there some way this field will become useful in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tried keeping it consistent with the format being used for other core components of ArgoCD. It would be better to update that behavior eventually as ApplicationSet is considered a core component for ArgoCD now.

}

func (a *ArgoCDApplicationSet) IsEnabled() bool {
return a.Enabled == nil || (a.Enabled != nil && *a.Enabled)
}

// ArgoCDCASpec defines the CA options for ArgCD.
Expand Down Expand Up @@ -413,6 +427,16 @@ type ArgoCDRedisSpec struct {
// The value specified here can currently be:
// - openshift - Use the OpenShift service CA to request TLS config
AutoTLS string `json:"autotls,omitempty"`

// Enabled is the flag to enable Redis during ArgoCD installation. (optional, default `true`)
Enabled *bool `json:"enabled,omitempty"`

// Remote specifies the remote URL of the Redis container. (optional, by default, a local instance managed by the operator is used.)
Remote *string `json:"remote,omitempty"`
}

func (a *ArgoCDRedisSpec) IsEnabled() bool {
return a.Enabled == nil || (a.Enabled != nil && *a.Enabled)
}

// ArgoCDRepoSpec defines the desired state for the Argo CD repo server component.
Expand Down Expand Up @@ -473,6 +497,16 @@ type ArgoCDRepoSpec struct {

// SidecarContainers defines the list of sidecar containers for the repo server deployment
SidecarContainers []corev1.Container `json:"sidecarContainers,omitempty"`

// Enabled is the flag to enable Repo Server during ArgoCD installation. (optional, default `true`)
Enabled *bool `json:"enabled,omitempty"`

// Remote specifies the remote URL of the Repo Server container. (optional, by default, a local instance managed by the operator is used.)
Remote *string `json:"remote,omitempty"`
}

func (a *ArgoCDRepoSpec) IsEnabled() bool {
return a.Enabled == nil || (a.Enabled != nil && *a.Enabled)
}

// ArgoCDRouteSpec defines the desired state for an OpenShift Route.
Expand Down Expand Up @@ -563,6 +597,13 @@ type ArgoCDServerSpec struct {
// ExtraCommandArgs will not be added, if one of these commands is already part of the server command
// with same or different value.
ExtraCommandArgs []string `json:"extraCommandArgs,omitempty"`

// Enabled is the flag to enable ArgoCD Server during ArgoCD installation. (optional, default `true`)
Enabled *bool `json:"enabled,omitempty"`
}

func (a *ArgoCDServerSpec) IsEnabled() bool {
return a.Enabled == nil || (a.Enabled != nil && *a.Enabled)
}

// ArgoCDServerServiceSpec defines the Service options for Argo CD Server component.
Expand Down
35 changes: 35 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.

30 changes: 30 additions & 0 deletions bundle/manifests/argoproj.io_argocds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6990,6 +6990,10 @@ spec:
description: ArgoCDApplicationSet defines whether the Argo CD ApplicationSet
controller should be installed.
properties:
enabled:
description: Enabled is the flag to enable the Application Set
Controller during ArgoCD installation. (optional, default `true`)
type: boolean
env:
description: Env lets you specify environment for applicationSet
controller pods
Expand Down Expand Up @@ -7342,6 +7346,10 @@ spec:
to a duration, e.g. 10m or 600s to control the synchronisation
frequency."
type: string
enabled:
description: Enabled is the flag to enable the Application Controller
during ArgoCD installation. (optional, default `true`)
type: boolean
env:
description: Env lets you specify environment for application
controller pods
Expand Down Expand Up @@ -8358,9 +8366,18 @@ spec:
description: DisableTLSVerification defines whether redis server
API should be accessed using strict TLS validation
type: boolean
enabled:
description: Enabled is the flag to enable Redis during ArgoCD
installation. (optional, default `true`)
type: boolean
image:
description: Image is the Redis container image.
type: string
remote:
description: Remote specifies the remote URL of the Redis container.
(optional, by default, a local instance managed by the operator
is used.)
type: string
resources:
description: Resources defines the Compute Resources required
by the container for Redis.
Expand Down Expand Up @@ -8424,6 +8441,10 @@ spec:
can currently be: - openshift - Use the OpenShift service CA
to request TLS config'
type: string
enabled:
description: Enabled is the flag to enable Repo Server during
ArgoCD installation. (optional, default `true`)
type: boolean
env:
description: Env lets you specify environment for repo server
pods
Expand Down Expand Up @@ -9882,6 +9903,11 @@ spec:
description: MountSAToken describes whether you would like to
have the Repo server mount the service account token
type: boolean
remote:
description: Remote specifies the remote URL of the Repo Server
container. (optional, by default, a local instance managed by
the operator is used.)
type: string
replicas:
description: Replicas defines the number of replicas for argocd-repo-server.
Value should be greater than or equal to 0. Default is nil.
Expand Down Expand Up @@ -13067,6 +13093,10 @@ spec:
required:
- enabled
type: object
enabled:
description: Enabled is the flag to enable ArgoCD Server during
ArgoCD installation. (optional, default `true`)
type: boolean
env:
description: Env lets you specify environment for API server pods
items:
Expand Down
Loading
Loading