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

Add hooks to bootstrapscript output #3195

Merged

Conversation

KashifSaadat
Copy link
Contributor

@KashifSaadat KashifSaadat commented Aug 14, 2017

Ping @gambol99

Related to:

Cluster Hooks are now added in their entirety to the nodeup user data scripts, dependant on whether the instance group roles match. This could increase the size of the user-data files significantly (getting closer to the 16KB mark) depending on users' hooks content. I considered hashing and fingerprinting the cluster hooks, but following discussions in #3120 thought we should keep the full output instead.

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

Hi @KashifSaadat. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 14, 2017
@KashifSaadat
Copy link
Contributor Author

/assign @justinsb

func (b *BootstrapScript) getRelevantHooks(hooks []kops.HookSpec, role kops.InstanceGroupRole) []kops.HookSpec {
relevantHooks := []kops.HookSpec{}
for _, hook := range hooks {
if len(hook.Roles) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

you might as well hit this early and check at the beginning no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We pass the full list of hook specs and roles can be defined differently for each hook, so will need to check on each one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Debug logging would probably be helpful if a user messes this up.

Copy link
Contributor

@chrislovecnm chrislovecnm Aug 18, 2017

Choose a reason for hiding this comment

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

What happens with an image where docker or the proper docker is not installed? For instance, RHEL does not have docker installed.

Copy link
Contributor

@chrislovecnm chrislovecnm left a comment

Choose a reason for hiding this comment

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

Questions for you.

export https_proxy=${http_proxy}
export no_proxy=
export NO_PROXY=${no_proxy}
echo "export http_proxy=${http_proxy}" >> /etc/default/docker
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a crazy side not we have functionality for this now in kops. i.e. egressProxy will setup http proxy.

@@ -57,20 +58,53 @@ func TestBootstrapUserData(t *testing.T) {
cs := []struct {
Role kops.InstanceGroupRole
ExpectedFilePath string
HookSpecRoles []kops.InstanceGroupRole
}{
{
Role: "Master",
ExpectedFilePath: "tests/data/bootstrapscript_0.txt",
Copy link
Contributor

Choose a reason for hiding this comment

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

Total nit pick question. Why do we need 5 test files? A quick eye ball was not showing me any differences.

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 worries, I was feeling it might be a bit excessive. :D Each of the test cases have some subtle differences in the instance group type / configuration, which can cause a change in output of the bootstrap script. I covered each where I felt the logic could go a bit wrong, such as multiple hook specs applying to specific / all instance groups. The test file contents all vary towards the bottom, in the generation of the cluster_spec.yaml and ig-spec.yaml files.

func (b *BootstrapScript) getRelevantHooks(hooks []kops.HookSpec, role kops.InstanceGroupRole) []kops.HookSpec {
relevantHooks := []kops.HookSpec{}
for _, hook := range hooks {
if len(hook.Roles) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Debug logging would probably be helpful if a user messes this up.

func (b *BootstrapScript) getRelevantHooks(hooks []kops.HookSpec, role kops.InstanceGroupRole) []kops.HookSpec {
relevantHooks := []kops.HookSpec{}
for _, hook := range hooks {
if len(hook.Roles) == 0 {
Copy link
Contributor

@chrislovecnm chrislovecnm Aug 18, 2017

Choose a reason for hiding this comment

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

What happens with an image where docker or the proper docker is not installed? For instance, RHEL does not have docker installed.

@chrislovecnm
Copy link
Contributor

@KashifSaadat do we have an issue that is tied to this PR? Do we need to update documentation? Thanks for the PR!

@KashifSaadat
Copy link
Contributor Author

Hey @chrislovecnm, thanks for the review :)

The PR is related to issue #3076, where certain spec changes do not trigger an update being required for a node. I raised PR #3120 to cover these cases, by including the spec detail within the bootstrap script it causes a diff in the node configuration and will mark it for update. This comes off the back of PR #3063 which made some changes to hooks.

I can include some documentation if you like, is there any related section which needs updating?

@chrislovecnm
Copy link
Contributor

Now I understand, so it does not matter if we have docker or anything else. Since this is not new functionality, we probably just need release notes on this.

This will only help with hooks and not say other component config values?

@KashifSaadat
Copy link
Contributor Author

Yep that's right, this PR only adds hooks into the user-data script. The PR #3120 covered some other component config cases, but possibly not all. If there's any you think I've missed, let me know and I can add to this (or raise a separate PR for them).

@chrislovecnm
Copy link
Contributor

/ok-to-test
/lgtm
/approve

We are good @KashifSaadat - pending e2e lets get this in

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 18, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: KashifSaadat, chrislovecnm

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

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 k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 18, 2017
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 32fda48 into kubernetes:master Aug 18, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants