-
Notifications
You must be signed in to change notification settings - Fork 36
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
Added check for config changes #33
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1433,7 +1433,7 @@ def shutdown(): | |
def build_kubeconfig(server): | ||
'''Gather the relevant data for Kubernetes configuration objects and create | ||
a config object with that information.''' | ||
hookenv.status_set('maintenance', 'Writing kubeconfig file.') | ||
|
||
ca_exists = ca_crt_path.exists() | ||
client_pass = get_password('basic_auth.csv', 'admin') | ||
# Do we have everything we need? | ||
|
@@ -1458,6 +1458,13 @@ def build_kubeconfig(server): | |
kubeconfig_path = os.path.join(os.sep, 'home', 'ubuntu', 'config') | ||
# Create the kubeconfig on this system so users can access the cluster. | ||
|
||
with open(kubeclientconfig_path, 'r') as conf: | ||
if not data_changed('kube-config-build', conf.read()): | ||
hookenv.log('Skipping config write. No changes.', 'DEBUG') | ||
return | ||
|
||
hookenv.status_set('maintenance', 'Writing kubeconfig file.') | ||
|
||
if ks: | ||
create_kubeconfig(kubeconfig_path, server, ca_crt_path, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow good catch. OK will work on that. |
||
user='admin', password=client_pass, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You meant
kubeconfig_path
vskubeclientconfig_path
here, right?Also, I think on initial deployment,
/home/ubuntu/config
won't exist yet. That'll lead to aFileNotFoundError
on thisopen
. Consider atry/pass
or check with something likeisfile()
to workaround that.