Skip to content

feat(helm): Add --node-selectors, --set and --output flags to helm init - #2557

Merged
jascott1 merged 1 commit into
helm:masterfrom
jascott1:i2299-init
Oct 10, 2017
Merged

jascott1 merged 1 commit into
helm:masterfrom
jascott1:i2299-init

Conversation

@jascott1

@jascott1 jascott1 commented Jun 7, 2017 •

Copy link
Copy Markdown
Contributor

This implements #2299.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 7, 2017
Comment thread cmd/helm/installer/install.go Outdated
func parseNodeSelectors(labels string) map[string]string {
kv := strings.Split(labels, ",")
nodeSelectors := map[string]string{}
nodeSelectors["beta.kubernetes.io/os"] = "linux"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like a sensible way to do it. Have it default to linux and if the user specifies another one, it will be overwritten.

@thomastaylor312

Copy link
Copy Markdown
Contributor

Waiting to label until this is out of WIP. Ping one of us @jascott1 when this is ready for review

@k8s-reviewable

Copy link
Copy Markdown

This change is Reviewable

@seh

seh commented Jun 16, 2017

Copy link
Copy Markdown
Contributor

Reviewed 2 of 4 files at r3.
Review status: 2 of 5 files reviewed at latest revision, 9 unresolved discussions, some commit checks failed.


cmd/helm/init.go, line 124 at r3 (raw file):

which node tiller lands on

How about "on which node tiller lands?"


cmd/helm/init.go, line 124 at r3 (raw file):

node-selectors

The name implies that the flag accepts several selectors. How does one separate each selector? What's the syntax?


cmd/helm/init.go, line 125 at r3 (raw file):

	f.StringVar(&i.opts.NodeSelectors, "node-selectors", "", "labels to select which node tiller lands on")
	f.StringVarP(&i.opts.Output, "output", "o", "", "skip installation and output tiller's manifest in specified format (json,yaml)")

Instead of using a string here for the flag, consider defining a new type that implements pflag.Value. Approximately:

type outputFormat string

func (f outputFormat) String() string {
	return string(f)
}

func (outputFormat) Type() string {
	return "format"
}

const (
	fmtJSON outputFormat = "json"
	fmtYAML              = "yaml"
)

func (f *outputFormat) Set(s string) error {
	for _, of := range []outputFormat{fmtJSON, fmtYAML} {
		if s == string(of) {
			*f = of
			return nil
		}
	}
	return fmt.Errorf("unknown output format %q", s)
}

With that, you can use pflag.Var instead of pflag.StringVar


cmd/helm/init.go, line 192 at r3 (raw file):

	}
	if len(i.opts.Output) > 0 {

Remove blank line.


cmd/helm/init.go, line 204 at r3 (raw file):

				return err
			}
			jsons := string(jsonb)

It looks like you could avoid this conversion to a string by using io.WriteString with the metadata prefix followed by (*io.Writer).Write on jsonb[1:].


cmd/helm/installer/options.go, line 76 at r3 (raw file):

Tiller

I noticed that here we capitalize the word "Tiller," but in the flag documentation we write in lowercase as "tiller." I think it should be capitalized throughout.


cmd/helm/installer/options.go, line 79 at r3 (raw file):

json

Capitalize the format as "JSON."


cmd/helm/installer/options.go, line 108 at r3 (raw file):

// valuesMap returns user set values in map format
func (opts *Options) valuesMap() (map[string]interface{}, error) {
	m := map[string]interface{}{}

Do we expect the map to contain the same number of entries as opts.Values? If so:

m := make(map[string]interface{}, len(opts.Values))

cmd/helm/installer/options.go, line 110 at r3 (raw file):

	m := map[string]interface{}{}
	for _, skv := range opts.Values {
		err := strvals.ParseInto(skv, m)

Instead:

if err := strvals.ParseInto(skv,m); err != nil {
  return nil, err
}

Comments from Reviewable

@jascott1

Copy link
Copy Markdown
Contributor Author

Thanks @seh. Im still working on it and will check out your suggestions asap.

@jascott1

Copy link
Copy Markdown
Contributor Author

All flags are functioning now including --set which is working with values nested under lists but it still needs tests for those.

@jascott1

Copy link
Copy Markdown
Contributor Author

Review status: 1 of 5 files reviewed at latest revision, 9 unresolved discussions, some commit checks failed.


cmd/helm/init.go, line 124 at r3 (raw file):

Previously, seh (Steven E. Harris) wrote…

which node tiller lands on

How about "on which node tiller lands?"

technically I changed it to "node on which tiller is installed"


cmd/helm/init.go, line 125 at r3 (raw file):

Previously, seh (Steven E. Harris) wrote…

Instead of using a string here for the flag, consider defining a new type that implements pflag.Value. Approximately:

type outputFormat string

func (f outputFormat) String() string {
	return string(f)
}

func (outputFormat) Type() string {
	return "format"
}

const (
	fmtJSON outputFormat = "json"
	fmtYAML              = "yaml"
)

func (f *outputFormat) Set(s string) error {
	for _, of := range []outputFormat{fmtJSON, fmtYAML} {
		if s == string(of) {
			*f = of
			return nil
		}
	}
	return fmt.Errorf("unknown output format %q", s)
}

With that, you can use pflag.Var instead of pflag.StringVar

Will check into this next commit


cmd/helm/init.go, line 204 at r3 (raw file):

Previously, seh (Steven E. Harris) wrote…

It looks like you could avoid this conversion to a string by using io.WriteString with the metadata prefix followed by (*io.Writer).Write on jsonb[1:].

Will check into this next commit


cmd/helm/installer/options.go, line 76 at r3 (raw file):

Previously, seh (Steven E. Harris) wrote…

Tiller

I noticed that here we capitalize the word "Tiller," but in the flag documentation we write in lowercase as "tiller." I think it should be capitalized throughout.

Capitalized Tiller in options.go


cmd/helm/installer/options.go, line 108 at r3 (raw file):

Previously, seh (Steven E. Harris) wrote…

Do we expect the map to contain the same number of entries as opts.Values? If so:

m := make(map[string]interface{}, len(opts.Values))

No this is dynamic


Comments from Reviewable

@jascott1

Copy link
Copy Markdown
Contributor Author

Review status: 0 of 5 files reviewed at latest revision, 9 unresolved discussions.


cmd/helm/init.go, line 125 at r3 (raw file):

Previously, jascott1 (Justin Scott) wrote…

Will check into this next commit

I like it and concede its more proper but im not sure its worth it for simple string check. Are we doing this for consistency for flags of this type?


Comments from Reviewable

@jascott1

Copy link
Copy Markdown
Contributor Author

Review status: 0 of 5 files reviewed at latest revision, 9 unresolved discussions.


cmd/helm/init.go, line 204 at r3 (raw file):

Previously, jascott1 (Justin Scott) wrote…

Will check into this next commit

nice! looks way cooler taboot.


Comments from Reviewable

@seh

seh commented Jun 17, 2017

Copy link
Copy Markdown
Contributor

Reviewed 2 of 3 files at r5.
Review status: 2 of 5 files reviewed at latest revision, 4 unresolved discussions.


cmd/helm/init.go, line 125 at r3 (raw file):

Previously, jascott1 (Justin Scott) wrote…

I like it and concede its more proper but im not sure its worth it for simple string check. Are we doing this for consistency for flags of this type?

The idea is that cobra can then detect the mismatch as a flag parsing failure, and stop the program at that stage, in the same way that if you asked for an integer and got "pdq" as a command-line flag value, cobra would reject that value before you ever saw it.

It gets more worth the investment when you plan to use the flag type many times. Here, we only have one use at the moment, but maybe there are other places in Helm that will allow the user to specify this same kind of output format.


cmd/helm/init.go, line 204 at r3 (raw file):

Previously, jascott1 (Justin Scott) wrote…

nice! looks way cooler taboot.

It occurred to after writing last night that the original code winds up copying the JSON bytes three times: once to convert the byte vector to a string, once to concatenate the JSON string to the metadata prefix, and once more to write the combined string to the destination. We can't eliminate the last transfer, but the first two are unnecessary.


cmd/helm/init.go, line 205 at r5 (raw file):

			}
			io.WriteString(i.out, "{\"apiVersion\":\"extensions/v1beta1\",\"kind\":\"Deployment\",")
			(io.Writer).Write(i.out, jsonb[1:])

I was expecting a statement like this:

_, err := i.out.Write(jsonb[1:])
return err

cmd/helm/installer/options.go, line 47 at r5 (raw file):

	Namespace string

	// ServiceAccount is the Kubernetes service account to add to Tiller

It's not your focus here, but I'll note that most of these field documentation lines are punctuated, but some are not (such as the "Output" one you added below. Consider unifying them.


Comments from Reviewable

@jascott1
jascott1 force-pushed the i2299-init branch 2 times, most recently from 996dc3c to f7348e0 Compare June 20, 2017 01:05
@jascott1

Copy link
Copy Markdown
Contributor Author

Review status: 0 of 6 files reviewed at latest revision, 3 unresolved discussions.


cmd/helm/init.go, line 125 at r3 (raw file):

Previously, seh (Steven E. Harris) wrote…

The idea is that cobra can then detect the mismatch as a flag parsing failure, and stop the program at that stage, in the same way that if you asked for an integer and got "pdq" as a command-line flag value, cobra would reject that value before you ever saw it.

It gets more worth the investment when you plan to use the flag type many times. Here, we only have one use at the moment, but maybe there are other places in Helm that will allow the user to specify this same kind of output format.

Thanks for the explanation. I implemented your changes.


cmd/helm/init.go, line 204 at r3 (raw file):

Previously, seh (Steven E. Harris) wrote…

It occurred to after writing last night that the original code winds up copying the JSON bytes three times: once to convert the byte vector to a string, once to concatenate the JSON string to the metadata prefix, and once more to write the combined string to the destination. We can't eliminate the last transfer, but the first two are unnecessary.

Please take a look at the new revision and let me know. I also added json.Indent.


cmd/helm/init.go, line 205 at r5 (raw file):

Previously, seh (Steven E. Harris) wrote…

I was expecting a statement like this:

_, err := i.out.Write(jsonb[1:])
return err

Its been refactored in a different way. Please let me know what you think.


cmd/helm/installer/options.go, line 47 at r5 (raw file):

Previously, seh (Steven E. Harris) wrote…

It's not your focus here, but I'll note that most of these field documentation lines are punctuated, but some are not (such as the "Output" one you added below. Consider unifying them.

Done.


Comments from Reviewable

@jascott1 jascott1 changed the title WIP Add --node-selectors and --output flags to helm init Add --node-selectors and --output flags to helm init Jun 20, 2017
@jascott1 jascott1 changed the title Add --node-selectors and --output flags to helm init Add --node-selectors, --set and --output flags to helm init Jun 20, 2017
Comment thread cmd/helm/installer/install.go Outdated

// parseNodeSelectors takes a comma delimited list of key=values pairs and returns a map
func parseNodeSelectors(labels string) map[string]string {
func parseNodeSelectors(labels string, m map[string]string) map[string]string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • This function got strange with this change. It now mutates a supplied map in place, and returns that same map, though the signature can't promise that the returned map is the same as the map supplied as an argument. A caller might wonder whether he needs the return value. A caller might wonder whether his input argument is safe against mutation.

    What if you had parseNodeSelectors create and return a fresh map, eliminating this confusion, and then add your "os=linux" selector into the map returned from the call in generateDeployment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@seh User needs to be able to override that default selector. Are you suggesting that anything that needs to be mutated needs to be passed as a pointer?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No, I wasn't suggesting that. If you want that function to mutate in place, then don't return a map as well. That eliminates the confusion. With that signature change, I'd consider renaming it to parseNodeSelectorsInto.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

By the way, maps are (effectively) pointers. I recalled that article too late to include it earlier.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I renamed and updated to not return map. Thanks for the help!

@seh

seh commented Jun 20, 2017

Copy link
Copy Markdown
Contributor

Review status: 0 of 6 files reviewed at latest revision, 5 unresolved discussions.


cmd/helm/init.go, line 202 at r6 (raw file):

		case "json":
			var out bytes.Buffer
			jsonb, err := yaml.ToJSON([]byte(body))

Unfortunately, that conversion to []byte makes a copy—unless the compiler is clever enough to prove that yaml.ToJSON never writes through the slice.


cmd/helm/init.go, line 206 at r6 (raw file):

				return err
			}
			tm := []byte("{\"apiVersion\":\"extensions/v1beta1\",\"kind\":\"Deployment\",")

It would be better to use bytes.Buffer and (*bytes.Buffer).Write here and on the line below, then call (*bytes.Buffer).Bytes in the call to json.Indent below. You can supply the header byte vector to bytes.NewBuffer, though the subsequent call to Write is going to require reallocating the backing array and copying the initial content anyway. Best would be to size the initial array to length of "tm" plus the length of "json" - 1.

Here's a Playground sample that shows avoiding a few lurking copies.

It's a shame that there's no yaml.ToJSONIndent function like json.MarshalIndent.


Comments from Reviewable

@jascott1

Copy link
Copy Markdown
Contributor Author

Review status: 0 of 6 files reviewed at latest revision, 4 unresolved discussions.


cmd/helm/init.go, line 206 at r6 (raw file):

Previously, seh (Steven E. Harris) wrote…

It would be better to use bytes.Buffer and (*bytes.Buffer).Write here and on the line below, then call (*bytes.Buffer).Bytes in the call to json.Indent below. You can supply the header byte vector to bytes.NewBuffer, though the subsequent call to Write is going to require reallocating the backing array and copying the initial content anyway. Best would be to size the initial array to length of "tm" plus the length of "json" - 1.

Here's a Playground sample that shows avoiding a few lurking copies.

It's a shame that there's no yaml.ToJSONIndent function like json.MarshalIndent.

I altered it with your suggestions, thanks.


cmd/helm/installer/install.go, line 132 at r6 (raw file):

Previously, jascott1 (Justin Scott) wrote…

I renamed and updated to not return map. Thanks for the help!

Done.


Comments from Reviewable

@seh

seh commented Jun 21, 2017

Copy link
Copy Markdown
Contributor

Review status: 0 of 6 files reviewed at latest revision, 3 unresolved discussions.


cmd/helm/init.go, line 209 at r7 (raw file):
By the way, what is that first character in "jsonb" that we're skipping? The opening '{'?
If you come through here again, a comment would be nice. Consider:

Drop the opening object delimiter ('{').


cmd/helm/installer/install.go, line 139 at r7 (raw file):

Invalid

Error messages should not used capitalized first words so that they can be concatenated more easily.

Error strings should not start with a capital letter because they'll often be prefixed before printing

Also, consider using the "%q" verb to quote the offending label string.


docs/helm/helm_init.md, line 41 at r7 (raw file):

tiller

I think I noted this elsewhere, but our flags are inconsistent in capitalizing the word "tiller." Note that "--set" capitalizes it, but "--canary," "--client-only," "--net-host," "--node-selectors," "--output," "--tiller-image," "--tiller-tls," "--tiller-tls-cert," "--tiller-tls-key," "--tiller-tls-verify," and "--upgrade" do not. Oh, wait, there are more: "--host," and "--tiller-namespace."


Comments from Reviewable

@jascott1

Copy link
Copy Markdown
Contributor Author

Review status: 0 of 6 files reviewed at latest revision, 3 unresolved discussions.


cmd/helm/init.go, line 209 at r7 (raw file):

Previously, seh (Steven E. Harris) wrote…

By the way, what is that first character in "jsonb" that we're skipping? The opening '{'?
If you come through here again, a comment would be nice. Consider:

Drop the opening object delimiter ('{').

Good call.


cmd/helm/installer/install.go, line 139 at r7 (raw file):

Previously, seh (Steven E. Harris) wrote…

Invalid

Error messages should not used capitalized first words so that they can be concatenated more easily.

Error strings should not start with a capital letter because they'll often be prefixed before printing

Also, consider using the "%q" verb to quote the offending label string.

Good stuff. Thanks!


docs/helm/helm_init.md, line 41 at r7 (raw file):

Previously, seh (Steven E. Harris) wrote…

tiller

I think I noted this elsewhere, but our flags are inconsistent in capitalizing the word "tiller." Note that "--set" capitalizes it, but "--canary," "--client-only," "--net-host," "--node-selectors," "--output," "--tiller-image," "--tiller-tls," "--tiller-tls-cert," "--tiller-tls-key," "--tiller-tls-verify," and "--upgrade" do not. Oh, wait, there are more: "--host," and "--tiller-namespace."

I will defer that to another atomic commit for that purpose unless you think its important now.


Comments from Reviewable

@jascott1

Copy link
Copy Markdown
Contributor Author

Review status: 0 of 6 files reviewed at latest revision, 2 unresolved discussions.


docs/helm/helm_init.md, line 41 at r7 (raw file):

Previously, jascott1 (Justin Scott) wrote…

I will defer that to another atomic commit for that purpose unless you think its important now.

I started another PR for this. I noticed that "tiller" in many if not most of the other commands' usage strings are not capitalized. Im planning to gauge merit based on feedback from #2601


Comments from Reviewable

@seh

seh commented Jun 21, 2017 •

Copy link
Copy Markdown
Contributor

Reviewed 1 of 3 files at r4, 3 of 5 files at r6, 2 of 2 files at r8.
Review status: all files reviewed at latest revision, 9 unresolved discussions.


cmd/helm/init.go, line 196 at r8 (raw file):

		var body string
		var err error
		if body, err = installer.DeploymentManifest(&i.opts); err != nil {

Consider using the alternate deploymentManifest function proposed below that returns []byte instead of a string.


cmd/helm/init_test.go, line 323 at r8 (raw file):

expectF
This name confuses me. How about "unmarshalF" or just "unmarshal?"


cmd/helm/init_test.go, line 324 at r8 (raw file):

expectName
This name confuses me. How about "outputFormat" or "format?"


cmd/helm/init_test.go, line 355 at r8 (raw file):

		}
	}

Remove blank line.


cmd/helm/installer/install.go, line 115 at r8 (raw file):

string(buf)

I suspect that we can't change this signature at this point because this function is exported, but if you returned a []byte here instead of a string, you could save yourself two copies of the content up in (*initCmd).run.
Consider introducing a parallel function that returns []byte, and call on it from DeploymentManifest to preserve backward compatibility if necessary.

func deploymentManifest(opts *Options) ([]byte, error) {
obj, err := deployment(opts)
	if err != nil {
		return "", err
	}
	buf, err := yaml.Marshal(obj)
	return buf, err
}

func DeploymentManifest(opts *Options) (string, error) {
	b, err := deploymentManifest(opts)
	return string(b), err
}

If you're concerned that yaml.Marshal can emit content even when it fails, you could be more conservative, at the cost of an extra interface comparison:

func DeploymentManifest(opts *Options) (string, error) {
	b, err := deploymentManifest(opts)
	if err != nil {
		return "", err
	}
	return string(b), nil
}

cmd/helm/installer/install_test.go, line 447 at r8 (raw file):

		},
	}
	for _, tt := range tests {

You could use subtests here (*testing.T).Run, using the "name" field from "tt" as the subtest name. Your error messages could then be more concise, though the test name gets mangled somewhat.


cmd/helm/installer/install_test.go, line 457 at r8 (raw file):

			t.Fatalf("%s: error %q", tt.name, err)
		}
		// verify environment variable in deployment reflect the use of tls being enabled.

Since the sentence is punctuated, capitalize the first word.


cmd/helm/installer/install_test.go, line 457 at r8 (raw file):

			t.Fatalf("%s: error %q", tt.name, err)
		}
		// verify environment variable in deployment reflect the use of tls being enabled.

s/tls/TLS/


cmd/helm/installer/install_test.go, line 457 at r8 (raw file):

			t.Fatalf("%s: error %q", tt.name, err)
		}
		// verify environment variable in deployment reflect the use of tls being enabled.

s/reflect/reflects/ or s/variable/variables/, depending on whether there is more than one variable.


Comments from Reviewable

@jascott1

Copy link
Copy Markdown
Contributor Author

Review status: 4 of 6 files reviewed at latest revision, 9 unresolved discussions.


cmd/helm/init.go, line 196 at r8 (raw file):

Previously, seh (Steven E. Harris) wrote…

Consider using the alternate deploymentManifest function proposed below that returns []byte instead of a string.

Deferred this as noted in other comment.


cmd/helm/init_test.go, line 323 at r8 (raw file):

Previously, seh (Steven E. Harris) wrote…

expectF
This name confuses me. How about "unmarshalF" or just "unmarshal?"

Done.


cmd/helm/init_test.go, line 324 at r8 (raw file):

Previously, seh (Steven E. Harris) wrote…

expectName
This name confuses me. How about "outputFormat" or "format?"

Done.


cmd/helm/init_test.go, line 355 at r8 (raw file):

Previously, seh (Steven E. Harris) wrote…

Remove blank line.

Done.


cmd/helm/installer/install.go, line 115 at r8 (raw file):

Previously, seh (Steven E. Harris) wrote…

string(buf)
I suspect that we can't change this signature at this point because this function is exported, but if you returned a []byte here instead of a string, you could save yourself two copies of the content up in (*initCmd).run.
Consider introducing a parallel function that returns []byte, and call on it from DeploymentManifest to preserve backward compatibility if necessary.

func deploymentManifest(opts *Options) ([]byte, error) {
obj, err := deployment(opts)
	if err != nil {
		return "", err
	}
	buf, err := yaml.Marshal(obj)
	return buf, err
}

func DeploymentManifest(opts *Options) (string, error) {
	b, err := deploymentManifest(opts)
	return string(b), err
}

If you're concerned that yaml.Marshal can emit content even when it fails, you could be more conservative, at the cost of an extra interface comparison:

func DeploymentManifest(opts *Options) (string, error) {
	b, err := deploymentManifest(opts)
	if err !=nil {
		return "", err
	}
	return string(b), nil
}

Since this only affects the one shot init operation at this time, I'd rather defer taking on a wrapper func until we have another use.


cmd/helm/installer/install_test.go, line 447 at r8 (raw file):

Previously, seh (Steven E. Harris) wrote…

You could use subtests here (*testing.T).Run, using the "name" field from "tt" as the subtest name. Your error messages could then be more concise, though the test name gets mangled somewhat.

In this case I prefer following existing convention in the test file.


cmd/helm/installer/install_test.go, line 457 at r8 (raw file):

Previously, seh (Steven E. Harris) wrote…

s/reflect/reflects/ or s/variable/variables/, depending on whether there is more than one variable.

Removed line as it was stray from copy of existing test. Thanks for noticing it.


cmd/helm/installer/install_test.go, line 457 at r8 (raw file):

Previously, seh (Steven E. Harris) wrote…

s/tls/TLS/

Removed comment.


cmd/helm/installer/install_test.go, line 457 at r8 (raw file):

Previously, seh (Steven E. Harris) wrote…

Since the sentence is punctuated, capitalize the first word.

Removed stray comment.


Comments from Reviewable

@seh

seh commented Jun 21, 2017

Copy link
Copy Markdown
Contributor

:lgtm:

Thank you for your persistence. You suffered through me learning how to use Reviewable, which is quite complicated, but I think provides for good accountability through these iterative reviews.

Reviewed 2 of 2 files at r9.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@jascott1

Copy link
Copy Markdown
Contributor Author

@seh Thanks so much for all the insights! Its also my first time really working with Reviewable as well and so far I like it.

@jascott1 jascott1 changed the title Add --node-selectors, --set and --output flags to helm init feat(helm): Add --node-selectors, --set and --output flags to helm init Jun 22, 2017
@jascott1

Copy link
Copy Markdown
Contributor Author

I fixed them. Thanks for the excellent reviews as always!


Review status: 3 of 6 files reviewed at latest revision, 9 unresolved discussions.


cmd/helm/installer/install.go, line 262 at r14 (raw file):

Previously, seh (Steven E. Harris) wrote…

[]byte(finalY)

It looks like "finalY" is already of type []byte here, per the yaml.Marshal signature.

Done.


cmd/helm/installer/install_test.go, line 424 at r14 (raw file):

Previously, seh (Steven E. Harris) wrote…

The comment formatting is odd here.
Consider adding an intervening space after the comment delimiter, capitalizing the first word, capitalizing "Deployment," and punctuating the sentence.

Removed the comment as we removed the default node selector entirely.


cmd/helm/installer/install_test.go, line 457 at r14 (raw file):

Previously, seh (Steven E. Harris) wrote…

Verify environment variable

Since there can be more than one environment variable, write, "Verify that environment variables."

Done.


cmd/helm/installer/install_test.go, line 461 at r14 (raw file):

Previously, seh (Steven E. Harris) wrote…

nodeselector

Should that be "nodeSelector?"

Sure why not ;)


cmd/helm/installer/install_test.go, line 521 at r14 (raw file):

Previously, seh (Steven E. Harris) wrote…

Remove blank line.

Done.


cmd/helm/installer/options.go, line 76 at r14 (raw file):

Previously, seh (Steven E. Harris) wrote…

Punctuate this sentence.

Done.


cmd/helm/installer/options.go, line 79 at r14 (raw file):

Previously, seh (Steven E. Harris) wrote…

Punctuate this sentence.

Done.


cmd/helm/installer/options.go, line 82 at r14 (raw file):

Previously, seh (Steven E. Harris) wrote…

Punctuate this sentence.

Done.


Comments from Reviewable

@seh

seh commented Jul 11, 2017

Copy link
Copy Markdown
Contributor

:lgtm:


Reviewed 3 of 3 files at r15.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@jascott1

Copy link
Copy Markdown
Contributor Author

Woot!


Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@jascott1

Copy link
Copy Markdown
Contributor Author

@technosophos can we get a milestone for this one?

@thomastaylor312

Copy link
Copy Markdown
Contributor

@jascott1 I'm going to put this in 2.7 for now

@egeland

egeland commented Sep 25, 2017

Copy link
Copy Markdown

Would be great if the documentation for this would include an example of how to set a node affinity, and how to set a toleration. 👍

@thomastaylor312

Copy link
Copy Markdown
Contributor

@jascott1 What is the status on this one? Will it be ready for 2.7?

@jascott1

jascott1 commented Oct 9, 2017

Copy link
Copy Markdown
Contributor Author

@thomastaylor312 I will rebase today and should be good to go. I will also add some examples @egeland

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/medium labels Oct 9, 2017

@thomastaylor312 thomastaylor312 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One super tiny constant missing a type and an optional nit then this is good to go

Comment thread cmd/helm/init.go Outdated
return err
}
if _, err := fmt.Fprintln(w, "kind:", kind); err != nil {
const tm = `{"apiVersion":"extensions/v1beta1","kind":"Deployment",`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: This should probably be moved out from being declared in a case statement or make it not a const. It feels a little out of place there since it is a constant getting redeclared each time

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catch! Fixed.

Comment thread cmd/helm/installer/options.go Outdated

const (
fmtJSON OutputFormat = "json"
fmtYAML = "yaml"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this needs to have a type of OutputFormat as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure what I was thinking there either. Fixed.

@kfox1111

Copy link
Copy Markdown

Had an idea for this. @jascott1 plz ping me tomorrow about it.

@jascott1
jascott1 force-pushed the i2299-init branch 2 times, most recently from 107306c to 6abe222 Compare October 10, 2017 21:19
@jascott1

Copy link
Copy Markdown
Contributor Author

@thomastaylor312 I changed the --set to --override to not conflict with future enhancements.

This feature enables users to specify more control over where Tiller pod
lands by allowing "node-selectors" to be specified. Alternatively, the
"--output" flag will skip install and dump Tiller's raw Deployment manifest to stdout so user may alter it as they see fit (probably with a JSON manipulation tool like jq).

Closes helm#2299
@thomastaylor312

Copy link
Copy Markdown
Contributor

Approved pending CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. feature 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.

7 participants