Skip to content

Commit

Permalink
feat: Unify sso status & remove deprecated .spec.sso & .spec.dex fiel…
Browse files Browse the repository at this point in the history
…ds (#896)

* Remove deprecated dex & sso fields

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Unify .status.sso

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Add unit test for .status.sso unification

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Add & fix e2e tests for unified status.sso

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* make bundle

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Fix make bundle codegen ci failure

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Fix keycloak status reconciliation

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Case insensitive sso provider check

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Do not block reconciliation due to sso failures

SSO is a non-critical component and we shouldn't block reconciliation on its failure

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Remove extra .ToLower() calls on already defined sso value

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Remove envVar & setEnvVarFunc feilds from dex unit tests

There are a lot of unit tests that have envVar & setEnvVarFunc field that was required for DISABLE_DEX testing.
These fields are not required in these tests anymore.

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* Fix ci failure

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

---------

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
  • Loading branch information
svghadi authored Jun 27, 2023
1 parent a3e8ccd commit 671b3d3
Show file tree
Hide file tree
Showing 45 changed files with 418 additions and 1,766 deletions.
48 changes: 16 additions & 32 deletions api/v1alpha1/argocd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package v1alpha1

import (
"strings"

routev1 "github.com/openshift/api/route/v1"

"github.com/argoproj-labs/argocd-operator/common"
Expand Down Expand Up @@ -199,12 +201,6 @@ type ArgoCDDexSpec struct {
Version string `json:"version,omitempty"`
}

// ArgoCDDexOAuthSpec defines the desired state for the Dex OAuth configuration.
type ArgoCDDexOAuthSpec struct {
// Enabled will toggle OAuth support for the Dex server.
Enabled bool `json:"enabled"`
}

// ArgoCDGrafanaSpec defines the desired state for the Grafana component.
type ArgoCDGrafanaSpec struct {
// Enabled will toggle Grafana support globally for ArgoCD.
Expand Down Expand Up @@ -616,16 +612,8 @@ const (

// ArgoCDSSOSpec defines SSO provider.
type ArgoCDSSOSpec struct {
// Image is the SSO container image.
Image string `json:"image,omitempty"`
// Provider installs and configures the given SSO Provider with Argo CD.
Provider SSOProviderType `json:"provider,omitempty"`
// Resources defines the Compute Resources required by the container for SSO.
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// VerifyTLS set to false disables strict TLS validation.
VerifyTLS *bool `json:"verifyTLS,omitempty"`
// Version is the SSO container image tag.
Version string `json:"version,omitempty"`

// Dex contains the configuration for Argo CD dex authentication
Dex *ArgoCDDexSpec `json:"dex,omitempty"`
Expand Down Expand Up @@ -677,9 +665,6 @@ type ArgoCDSpec struct {
// Controller defines the Application Controller options for ArgoCD.
Controller ArgoCDApplicationControllerSpec `json:"controller,omitempty"`

// Dex defines the Dex server options for ArgoCD.
Dex *ArgoCDDexSpec `json:"dex,omitempty"`

// DisableAdmin will disable the admin user.
DisableAdmin bool `json:"disableAdmin,omitempty"`

Expand Down Expand Up @@ -840,14 +825,14 @@ type ArgoCDStatus struct {
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="ApplicationSetController",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
ApplicationSetController string `json:"applicationSetController,omitempty"`

// Dex is a simple, high-level summary of where the Argo CD Dex component is in its lifecycle.
// There are four possible dex values:
// Pending: The Argo CD Dex component has been accepted by the Kubernetes system, but one or more of the required resources have not been created.
// Running: All of the required Pods for the Argo CD Dex component are in a Ready state.
// Failed: At least one of the Argo CD Dex component Pods had a failure.
// Unknown: The state of the Argo CD Dex component could not be obtained.
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="Dex",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
Dex string `json:"dex,omitempty"`
// SSO is a simple, high-level summary of where the Argo CD SSO(Dex/Keycloak) component is in its lifecycle.
// There are four possible sso values:
// Pending: The Argo CD SSO component has been accepted by the Kubernetes system, but one or more of the required resources have not been created.
// Running: All of the required Pods for the Argo CD SSO component are in a Ready state.
// Failed: At least one of the Argo CD SSO component Pods had a failure.
// Unknown: The state of the Argo CD SSO component could not be obtained.
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="SSO",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
SSO string `json:"sso,omitempty"`

// NotificationsController is a simple, high-level summary of where the Argo CD notifications controller component is in its lifecycle.
// There are four possible NotificationsController values:
Expand All @@ -858,13 +843,6 @@ type ArgoCDStatus struct {
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="NotificationsController",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
NotificationsController string `json:"notificationsController,omitempty"`

// SSOConfig defines the status of SSO configuration.
// Success: Only one SSO provider is configured in CR.
// Failed: SSO configuration is illegal or more than one SSO providers are configured in CR.
// Unknown: The SSO configuration could not be obtained.
//+operator-sdk:csv:customresourcedefinitions:type=status,displayName="SSOConfig",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
SSOConfig string `json:"ssoConfig,omitempty"`

// Phase is a simple, high-level summary of where the ArgoCD is in its lifecycle.
// There are four possible phase values:
// Pending: The ArgoCD has been accepted by the Kubernetes system, but one or more of the required resources have not been created.
Expand Down Expand Up @@ -1035,3 +1013,9 @@ func ParseResourceTrackingMethod(name string) ResourceTrackingMethod {

return ResourceTrackingMethodInvalid
}

// ToLower returns the lower case representation for a SSOProviderType
func (p SSOProviderType) ToLower() SSOProviderType {
str := string(p)
return SSOProviderType(strings.ToLower(str))
}
30 changes: 0 additions & 30 deletions api/v1alpha1/zz_generated.deepcopy.go

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

58 changes: 9 additions & 49 deletions bundle/manifests/argocd-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -349,38 +349,6 @@ spec:
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Controller
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
- description: Config is the dex connector configuration.
displayName: Configuration
path: dex.config
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Dex
- urn:alm:descriptor:com.tectonic.ui:text
- description: Image is the Dex container image.
displayName: Image
path: dex.image
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Dex
- urn:alm:descriptor:com.tectonic.ui:text
- description: OpenShiftOAuth enables OpenShift OAuth authentication for the
Dex server.
displayName: OpenShift OAuth Enabled'
path: dex.openShiftOAuth
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Dex
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Resources defines the Compute Resources required by the container
for Dex.
displayName: Resource Requirements'
path: dex.resources
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Dex
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
- description: Version is the Dex container image tag.
displayName: Version
path: dex.version
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:fieldGroup:Dex
- urn:alm:descriptor:com.tectonic.ui:text
- description: GAAnonymizeUsers toggles user IDs being hashed before sending
to google analytics.
displayName: Google Analytics Anonymize Users'
Expand Down Expand Up @@ -780,17 +748,6 @@ spec:
path: applicationSetController
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: 'Dex is a simple, high-level summary of where the Argo CD Dex
component is in its lifecycle. There are four possible dex values: Pending:
The Argo CD Dex component has been accepted by the Kubernetes system, but
one or more of the required resources have not been created. Running: All
of the required Pods for the Argo CD Dex component are in a Ready state.
Failed: At least one of the Argo CD Dex component Pods had a failure. Unknown:
The state of the Argo CD Dex component could not be obtained.'
displayName: Dex
path: dex
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: 'NotificationsController is a simple, high-level summary of where
the Argo CD notifications controller component is in its lifecycle. There
are four possible NotificationsController values: Pending: The Argo CD notifications
Expand Down Expand Up @@ -848,12 +805,15 @@ spec:
path: server
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
- description: 'SSOConfig defines the status of SSO configuration. Success:
Only one SSO provider is configured in CR. Failed: SSO configuration is
illegal or more than one SSO providers are configured in CR. Unknown: The
SSO configuration could not be obtained.'
displayName: SSOConfig
path: ssoConfig
- description: 'SSO is a simple, high-level summary of where the Argo CD SSO(Dex/Keycloak)
component is in its lifecycle. There are four possible sso values: Pending:
The Argo CD SSO component has been accepted by the Kubernetes system, but
one or more of the required resources have not been created. Running: All
of the required Pods for the Argo CD SSO component are in a Ready state.
Failed: At least one of the Argo CD SSO component Pods had a failure. Unknown:
The state of the Argo CD SSO component could not be obtained.'
displayName: SSO
path: sso
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:text
version: v1alpha1
Expand Down
110 changes: 9 additions & 101 deletions bundle/manifests/argoproj.io_argocds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -569,56 +569,6 @@ spec:
type: integer
type: object
type: object
dex:
description: Dex defines the Dex server options for ArgoCD.
properties:
config:
description: Config is the dex connector configuration.
type: string
groups:
description: Optional list of required groups a user must be a
member of
items:
type: string
type: array
image:
description: Image is the Dex container image.
type: string
openShiftOAuth:
description: OpenShiftOAuth enables OpenShift OAuth authentication
for the Dex server.
type: boolean
resources:
description: Resources defines the Compute Resources required
by the container for Dex.
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Limits describes the maximum amount of compute
resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
version:
description: Version is the Dex container image tag.
type: string
type: object
disableAdmin:
description: DisableAdmin will disable the admin user.
type: boolean
Expand Down Expand Up @@ -6222,9 +6172,6 @@ spec:
description: Version is the Dex container image tag.
type: string
type: object
image:
description: Image is the SSO container image.
type: string
keycloak:
description: Keycloak contains the configuration for Argo CD keycloak
authentication
Expand Down Expand Up @@ -6275,39 +6222,6 @@ spec:
description: Provider installs and configures the given SSO Provider
with Argo CD.
type: string
resources:
description: Resources defines the Compute Resources required
by the container for SSO.
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Limits describes the maximum amount of compute
resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
verifyTLS:
description: VerifyTLS set to false disables strict TLS validation.
type: boolean
version:
description: Version is the SSO container image tag.
type: string
type: object
statusBadgeEnabled:
description: StatusBadgeEnabled toggles application status badge feature.
Expand Down Expand Up @@ -6371,16 +6285,6 @@ spec:
component Pods had a failure. Unknown: The state of the Argo CD
applicationSet controller component could not be obtained.'
type: string
dex:
description: 'Dex is a simple, high-level summary of where the Argo
CD Dex component is in its lifecycle. There are four possible dex
values: Pending: The Argo CD Dex component has been accepted by
the Kubernetes system, but one or more of the required resources
have not been created. Running: All of the required Pods for the
Argo CD Dex component are in a Ready state. Failed: At least one
of the Argo CD Dex component Pods had a failure. Unknown: The state
of the Argo CD Dex component could not be obtained.'
type: string
host:
description: Host is the hostname of the Ingress.
type: string
Expand Down Expand Up @@ -6445,11 +6349,15 @@ spec:
one of the Argo CD server component Pods had a failure. Unknown:
The state of the Argo CD server component could not be obtained.'
type: string
ssoConfig:
description: 'SSOConfig defines the status of SSO configuration. Success:
Only one SSO provider is configured in CR. Failed: SSO configuration
is illegal or more than one SSO providers are configured in CR.
Unknown: The SSO configuration could not be obtained.'
sso:
description: 'SSO is a simple, high-level summary of where the Argo
CD SSO(Dex/Keycloak) component is in its lifecycle. There are four
possible sso values: Pending: The Argo CD SSO component has been
accepted by the Kubernetes system, but one or more of the required
resources have not been created. Running: All of the required Pods
for the Argo CD SSO component are in a Ready state. Failed: At least
one of the Argo CD SSO component Pods had a failure. Unknown: The
state of the Argo CD SSO component could not be obtained.'
type: string
type: object
type: object
Expand Down
Loading

0 comments on commit 671b3d3

Please sign in to comment.