Skip to content

fix(helm): improve --set parser - #1576

Merged
technosophos merged 1 commit into
helm:masterfrom
technosophos:feat/set-parser
Nov 29, 2016
Merged

technosophos merged 1 commit into
helm:masterfrom
technosophos:feat/set-parser

Conversation

@technosophos

@technosophos technosophos commented Nov 22, 2016 •

Copy link
Copy Markdown
Member

This replaces the old --set parser with a brand new one. This also changes
the internal algorithm from duplicating YAML to merging YAML, which
might solve a problem one user reported in chat, but which was never
captured in an issue because it is difficult to reproduce.

Closes #1540
Closes #1556
Closes #1558


This change is Reviewable

@technosophos technosophos added this to the 2.0.1 milestone Nov 22, 2016
@technosophos technosophos self-assigned this Nov 22, 2016
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 22, 2016
@technosophos

Copy link
Copy Markdown
Member Author

You should be able to do things like this now:

$ helm install docs/examples/alpine -f _scratch/foo.yaml --set=foobar.bar=baz,imagePullPolicy=always,ver=20161115.1,port=1234,foostr=foo\\,pair
NAME: intentional-puffin
LAST DEPLOYED: Mon Nov 21 19:38:50 2016
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Pod
NAME                           READY     STATUS              RESTARTS   AGE
intentional-puffin-my-alpine   0/1       ContainerCreating   0          6m


$  helm get values intentional-puffin
foobar:
  bar: baz
  foo: bar
foostr: foo,pair
imagePullPolicy: always
port: 1234
ver: "20161115.1"

Note that we have to use \\ because shell interprets the first one, and Helm interprets the second.

Comment thread cmd/helm/strvals/parser.go Outdated
type parser struct {
sc *bytes.Buffer
data map[string]interface{}
carryOn bool

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

remove me

@technosophos
technosophos force-pushed the feat/set-parser branch 3 times, most recently from 9ea185e to 5eced02 Compare November 23, 2016 18:10
@technosophos

Copy link
Copy Markdown
Member Author

Based on @adamreese 's feedback, also added support for lists:

$ helm install --set foo={1,2,3},bar={a,b,c} mychart

This replaces the old set parser with a brand new one. This also changes
the internal algorithm from duplicating YAML to merging YAML, which
might solve a problem one user reported in chat, but which was never
captured in an issue.

Closes helm#1540
Closes helm#1556
@technosophos
technosophos merged commit a081e27 into helm:master Nov 29, 2016
@technosophos

Copy link
Copy Markdown
Member Author

Cherry-picking to 2.0.1

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants