Skip to content

Commit

Permalink
Make sure that the user we expect has proper credentials set.
Browse files Browse the repository at this point in the history
When a cluster is installed the username in the loopback kubeconfig
is equal to hostname of that local master. This changes the variable
to equal a value of what would originally be set.

Backports openshift#11169
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1675133
  • Loading branch information
rjhowe committed Feb 11, 2019
1 parent bbb98f2 commit 98a19a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions roles/openshift_control_plane/tasks/set_loopback_context.yml
Expand Up @@ -16,6 +16,17 @@
- loopback_context_string not in l_loopback_config.stdout
register: set_loopback_cluster

- command: >
{{ openshift_client_binary }} config set-credentials
--client-certificate=/etc/origin/master/openshift-master.crt
--client-key=/etc/origin/master/openshift-master.key
--embed-certs=true
{{ openshift.master.loopback_user }}
--config={{ openshift_master_loopback_config }}
when:
- set_loopback_cluster is changed
register: l_set_loopback_credentials

- command: >
{{ openshift_client_binary }} config set-context
--cluster={{ openshift.master.loopback_cluster_name }}
Expand Down
2 changes: 1 addition & 1 deletion roles/openshift_facts/library/openshift_facts.py
Expand Up @@ -394,7 +394,7 @@ def set_url_facts_if_unset(facts):
ports[prefix]))

r_lhn = "{0}:{1}".format(hostname, ports['api']).replace('.', '-')
r_lhu = "system:openshift-master/{0}:{1}".format(api_hostname, ports['api']).replace('.', '-')
r_lhu = "system:openshift-master/{0}:{1}".format(hostname, ports['api']).replace('.', '-')
facts['master'].setdefault('loopback_cluster_name', r_lhn)
facts['master'].setdefault('loopback_context_name', "default/{0}/system:openshift-master".format(r_lhn))
facts['master'].setdefault('loopback_user', r_lhu)
Expand Down

0 comments on commit 98a19a2

Please sign in to comment.