Skip to content

Commit

Permalink
allow enabling ArgoCD workloads independently (#1021)
Browse files Browse the repository at this point in the history
* allow enabling ArgoCD core workloads independently

Signed-off-by: ishitasequeira <[email protected]>

* fix lint

Signed-off-by: ishitasequeira <[email protected]>

* check for dependent component urls if dependent components are disabled

Signed-off-by: ishitasequeira <[email protected]>

* fix build

Signed-off-by: ishitasequeira <[email protected]>

* fix make bundle

Signed-off-by: ishitasequeira <[email protected]>

* fix tests

Signed-off-by: ishitasequeira <[email protected]>

* Update flags for each component

Signed-off-by: ishitasequeira <[email protected]>

* Update configuration using remote flag

Signed-off-by: ishitasequeira <[email protected]>

* fix CI

Signed-off-by: ishitasequeira <[email protected]>

* Address comments

Signed-off-by: ishitasequeira <[email protected]>

* Addressed feedback

Signed-off-by: ishitasequeira <[email protected]>

* update conversion webhook

Signed-off-by: ishitasequeira <[email protected]>

* fix make build

Signed-off-by: ishitasequeira <[email protected]>

---------

Signed-off-by: ishitasequeira <[email protected]>
  • Loading branch information
ishitasequeira authored Nov 16, 2023
1 parent 17064c9 commit 9a294a2
Show file tree
Hide file tree
Showing 10 changed files with 372 additions and 18 deletions.
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"`
}

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

0 comments on commit 9a294a2

Please sign in to comment.