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

vsphere: Add support for passing ignition user-data #458

Merged
merged 1 commit into from Jan 13, 2020
Merged

vsphere: Add support for passing ignition user-data #458

merged 1 commit into from Jan 13, 2020

Conversation

bison
Copy link
Contributor

@bison bison commented Jan 9, 2020

This adds support for fetching the user-data secret referenced in the
ProviderSpec of a Machine using the vsphere provider, and passing that
data as ignition config via guestinfo variables.

@bison
Copy link
Contributor Author

bison commented Jan 9, 2020

/hold

Needs further testing.

@openshift-ci-robot openshift-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 9, 2020
@bison
Copy link
Contributor Author

bison commented Jan 9, 2020

Still open question: Ignition uses guestinfo keys specific to Ignition, so this only supports Ignition as-is. I guess we're only interested in supporting Ignition in OpenShift, so should we maybe rename the userDataSecret field to ignitionSecret?

}

// EncodeIgnitionConfig attempts to decode the given data until it looks to be
// plain-text, then returns a base64 encoded version of that plain-text.
Copy link
Member

Choose a reason for hiding this comment

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

nit: this is not ignition specific, could be may be called base64DataToString, sanitiseBase64 or similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The implementation happens to not be Ignition specific, but the function is meant to encode Ignition data for inclusion in guestinfo variables, so I think the name should reflect that.

for {
decoded, err := base64.StdEncoding.DecodeString(string(data))
if err != nil {
break
Copy link
Member

Choose a reason for hiding this comment

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

nit: may be log something here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like what? This is expected to break. It breaks when the input looks like plain-text, i.e. can no longer be successfully decoded. And the input is considered secret, so it shouldn't be logged.

Copy link
Member

Choose a reason for hiding this comment

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

actually don't we want to return err here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, we want to break and then re-encode as base64. This function ensures that you can pass either plain-text, or already encoded data (e.g. straight from a k8s secret) to IgnitionConfig() and have it do the right thing.

This adds support for fetching the user-data secret referenced in the
ProviderSpec of a Machine using the vsphere provider, and passing that
data as ignition config via guestinfo variables.
@bison
Copy link
Contributor Author

bison commented Jan 10, 2020

This is working now. We just need to decide if we call the field UserDataSecret or not. I guess I don't really care that much, but it seems a little misleading.

@bison
Copy link
Contributor Author

bison commented Jan 10, 2020

/test unit

@bison
Copy link
Contributor Author

bison commented Jan 13, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 13, 2020
@enxebre
Copy link
Member

enxebre commented Jan 13, 2020

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 13, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enxebre

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 13, 2020
@bison
Copy link
Contributor Author

bison commented Jan 13, 2020

/refresh

@openshift-merge-robot openshift-merge-robot merged commit f6e1147 into openshift:master Jan 13, 2020
@bison bison deleted the vsphere-ignition branch January 13, 2020 15:45
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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants