Skip to content

Commit

Permalink
[molecule] dynamically determine the openshift identity provider (#757)
Browse files Browse the repository at this point in the history
This is so we can run this test on different types of clusters (CRC specifically)
  • Loading branch information
jmazzitelli authored Mar 29, 2024
1 parent 606559d commit bbdf6b5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions molecule/openshift-auth-test/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,22 @@
- kiali_output.json.strategy == "openshift"
- kiali_output.json.authorizationEndpoint is search("oauth/authorize")
- kiali_output.json.sessionInfo.keys() | length == 0
- name: Set the auth endpoint we are being redirected to and assume our test credentials are for the htpasswd provider

- name: Get OpenShift identity provider of type HTPasswd
k8s_info:
api_version: config.openshift.io/v1
kind: OAuth
name: cluster
namespace: openshift-config
register: openshift_oauth_cluster_raw

- name: Determine the name of the identity provider which may be different on CRC or other clusters
set_fact:
openshift_idp_name: "{{ openshift_oauth_cluster_raw.resources[0] | json_query('spec.identityProviders[?type==`HTPasswd`].name') | join }}"

- name: Set the auth endpoint we are being redirected to and assume our test credentials are for the HTPasswd provider
set_fact:
auth_endpoint: "{{ kiali_output.json.authorizationEndpoint | regex_replace('\\?', '?idp=htpasswd&') }}"
auth_endpoint: "{{ kiali_output.json.authorizationEndpoint | regex_replace('\\?', '?idp=' + openshift_idp_name + '&') }}"

- name: Send request to oauth-openshift /oauth/authorize endpoint
uri:
Expand Down

0 comments on commit bbdf6b5

Please sign in to comment.