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

fix: verify DeploymentConfig API when installing keycloak using Template #1329

Merged
merged 3 commits into from
May 21, 2024

Conversation

chetan-rns
Copy link
Collaborator

What type of PR is this?

/kind bug

What does this PR do / why we need it:

Users have the option to disable DeploymentConfig API on their OCP clusters. In such cases, the operator shouldn't watch the DeploymentConfig APIs and shouldn't install Keycloak using Template.

https://docs.openshift.com/container-platform/4.14/installing/cluster-capabilities.html#deployment-config-capability_cluster-capabilities

Have you updated the necessary documentation?

  • Documentation update is required by this PR.
  • Documentation has been updated.

Which issue(s) this PR fixes:

Fixes https://issues.redhat.com/browse/GITOPS-4489

How to test changes / Special notes to the reviewer:

@chetan-rns chetan-rns marked this pull request as ready for review May 2, 2024 11:45
Copy link
Member

@jgwest jgwest left a comment

Choose a reason for hiding this comment

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

One question I have for this PR:

My concern with this PR is that it is sending new OpenShift 4.15 clusters down an untested path: currently, (I suspect) the vast vast majority of OpenShift users would have DeploymentConfig configured, and thus when keyclock was enabled, it would use the template-based approach.

Very very few users would be using the non-Template, Ingress-based approach: basically only argocd-operator users on non-OpenShift.

However, with this PR, we are now sending all those new OpenShift 4.15 users (with cluster that defaults to not having this API) down this mostly untested code path.

All those users would switch from using the Template API-based codepath that is commonly used, to the ingress-based codepath which is rarely used. (And anything that is rarely used is a lot less likely to work)

For example, if you don't have the required APIs installed, we will no longer install keycloak from the official openshift image on registry.redhat.com: registry.redhat.io/rh-sso-7/sso76-openshift-rhel8

Instead, we install keycloak from quay.io/keycloak/keycloak:

	// ArgoCDKeycloakImage is the default Keycloak Image used for the non-openshift platforms when not specified.
	ArgoCDKeycloakImage = "quay.io/keycloak/keycloak"

As an example of the kind of issues we might encounter, the quay.io/keycloak version hasn't been updated in 2 years, whereas the openshift tag was updated 7 months ago.

An alternative to the approach taken in this PR would be just to disable the keycloak functionality entirely if the user doesn't have the required APIs, and output a message telling the user to install those PRs.

controllers/argocd/sso.go Outdated Show resolved Hide resolved
main.go Show resolved Hide resolved
@chetan-rns
Copy link
Collaborator Author

@jgwest That's a valid concern. I agree that the Operator should prefer the official image for Keycloak on OCP clusters. I've updated the PR to log and return an error if the user selects Keycloak but the DeploymentConfig API is absent. I also had to check if the Template API is present to ensure it is an OCP cluster. This should prevent new users from installing the unofficial image.

As a long-term solution, we should update the Template to use Deployment instead.

@chetan-rns chetan-rns requested a review from jgwest May 8, 2024 05:51
main.go Show resolved Hide resolved
@chetan-rns
Copy link
Collaborator Author

@jgwest @iam-veeramalla This PR might be redundant if we plan to move away from Templates. Until then we can accept this as a temporary solution so users don't see errors when the DeploymentConfig is disabled. WDYT?

@jgwest jgwest merged commit 5dc1abe into argoproj-labs:master May 21, 2024
7 checks passed
@jgwest
Copy link
Member

jgwest commented May 21, 2024

Merging as no objections were raised.

reginapizza pushed a commit to reginapizza/argocd-operator that referenced this pull request Jun 5, 2024
…ate (argoproj-labs#1329)

* fix: verify DeploymentConfig API when installing keycloak using Template

Signed-off-by: Chetan Banavikalmutt <[email protected]>

* return an error if the DeploymentConfig API is not present on OCP

Signed-off-by: Chetan Banavikalmutt <[email protected]>

* log when the Keycloak instance can't be managed using Template

Signed-off-by: Chetan Banavikalmutt <[email protected]>

---------

Signed-off-by: Chetan Banavikalmutt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants