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

Check API registration if API is not available #1482

Merged
merged 8 commits into from
Aug 8, 2024

Conversation

anandf
Copy link
Collaborator

@anandf anandf commented Jul 26, 2024

What type of PR is this?

Uncomment only one /kind line, and delete the rest.
For example, > /kind bug would simply become: /kind bug

/kind bug

What does this PR do / why we need it:
When there is an issue with the API server pods, or the API server pods are just coming up after a restart, the current check for API availability done with a discovery client will fail. This makes the operator code to assume that the server does not support the Route API. To fix this, whenever the API availability check fails, the operator checks if the API is registered. If registered, then the operator assumes that the Route API is supported in the cluster and would eventually become available.

Have you updated the necessary documentation?
NA

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

Which issue(s) this PR fixes:
Fixes https://issues.redhat.com/browse/GITOPS-4358

How to test changes / Special notes to the reviewer:

Steps to reproduce the problem in OCP cluster.

  1. Delete the API server pods and restart the gitops-operator pod
oc delete pod --all --wait=false -n openshift-apiserver --all
oc delete pods --all -n openshift-gitops-operator
  1. Now try logging in to the ArgoCD UI, you will see an error like below
oidc: issuer did not match the issuer returned by provider, expected "https://openshift-gitops-server-openshift-gitops.apps.<DNS_DOMAIN_NAME>/api/dex" got "https://openshift-gitops-server/api/dex"

controllers/argocd/util.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@svghadi svghadi left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
Copy link
Collaborator

@svghadi svghadi left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks.

@anandf anandf merged commit bff6377 into argoproj-labs:master Aug 8, 2024
7 checks passed
anandf added a commit to anandf/argocd-operator that referenced this pull request Aug 16, 2024
* Fix for checking route api availability for getting the server URL

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added check for api registration, if its not available

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added another option to check API registration directly

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added more logs and removed commented code

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Updated the condition to check only route enabled

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added permission to get and list apiservices for argocd controller

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added rbac role to manifests

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Fix for adding rbac policies for api registration service

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

---------

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
anandf added a commit that referenced this pull request Aug 19, 2024
* Check API registration if API is not available (#1482)

* Fix for checking route api availability for getting the server URL

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added check for api registration, if its not available

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added another option to check API registration directly

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added more logs and removed commented code

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Updated the condition to check only route enabled

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added permission to get and list apiservices for argocd controller

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Added rbac role to manifests

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Fix for adding rbac policies for api registration service

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

---------

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

* Updated argocd operator version

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>

---------

Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
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