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

Hostname patch for vsphere provider limitations with juju #44780

Merged

Conversation

lazypower
Copy link
Contributor

What this PR does / why we need it:
The Juju VSphere provider doesn't set a unique hostname which causes issues when scaling worker-pools and they all have the hostname ubuntuguest. Instead we assign the JUJU_UNIT_NAME to that hostname to prevent the collision which allows the master to sort out that there are multiple units and not one attempting re-registration.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes https://github.com/juju-solutions/bundle-canonical-kubernetes/issues/237

Special notes for your reviewer:
The charm-pre-exec runs before it installs the charm software so the validation can happen quickly. Check hostname output, as well as kubectl get no post deployment.

Resolves juju vsphere hostname bug showing only a single node in a scaled node-pool.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 21, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-github-robot k8s-github-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Apr 21, 2017
MY_HOSTNAME=$(hostname)

if [ "${MY_HOSTNAME}" == "ubuntuguest" ]; then
echo "Detected broken vsphere integration. Applying hostname override"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use juju-log?


if [ "${MY_HOSTNAME}" == "ubuntuguest" ]; then
echo "Detected broken vsphere integration. Applying hostname override"
if [ -z "${JUJU_UNIT_NAME}" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

We should do bash fallback instead of just exiting. For example

: ${JUJU_UNIT_NAME:=`uuidgen`}

At the top of the script will make sure that JUJU_UNIT_NAME exists or is assigned to a UUID

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, We can certainly do that. +1

@marcoceppi
Copy link
Contributor

I think this is a good place to resolve this, in exec.d, just a few places to simplify logic

This patch sets the hostname to a unique identifier (the juju unit name)
during pre-deployment of the charm. This may not be a FQDN resolveable
hostname but will prevent hostname collision.
@lazypower
Copy link
Contributor Author

@marcoceppi i took your suggestions wholesale and verified they work as intended. Ready for another pass on this one.

@lazypower
Copy link
Contributor Author

@k8s-bot gce etcd3 e2e test this

@marcoceppi
Copy link
Contributor

/assign @marcoceppi

@marcoceppi
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 21, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chuckbutler, marcoceppi

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 42486, 44780)

@k8s-github-robot k8s-github-robot merged commit 12adc0e into kubernetes:master Apr 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

showing only 1 worker node - vsphere
7 participants