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

MVP of templating #3040

Merged
merged 5 commits into from
Aug 4, 2017
Merged

MVP of templating #3040

merged 5 commits into from
Aug 4, 2017

Conversation

mad01
Copy link
Contributor

@mad01 mad01 commented Jul 24, 2017

MVP implementation of templating to generate cluster.yaml file: related to #2404 implementation is using the text/template

cat > values.yaml <<EOF
clusterName: eu1
kubernetesVersion: 1.7.1
dnsZone: k8s.example.com
awsRegion: eu-west-1
EOF
cat > cluster.tmpl.yaml <<EOF
apiVersion: kops/v1alpha2
kind: InstanceGroup
metadata:
  labels:
	kops.k8s.io/cluster: {{.clusterName}}.{{.dnsZone}}
  name: nodes
spec:
  image: coreos.com/CoreOS-stable-1409.6.0-hvm
  machineType: m4.large
  maxPrice: "0.5"
  maxSize: 2
  minSize: 15
  role: Node
  rootVolumeSize: 100
  subnets:
  - {{.awsRegion}}a
  - {{.awsRegion}}b
  - {{.awsRegion}}c

EOF

running the templating command

  kops toolbox template \
      --values values.yaml \
      --template cluster.tmpl.yaml \
      --output cluster.yaml

output

apiVersion: kops/v1alpha2
kind: InstanceGroup
metadata:
  labels:
	kops.k8s.io/cluster: eu1.k8s.example.com
  name: nodes
spec:
  image: coreos.com/CoreOS-stable-1409.6.0-hvm
  machineType: m4.large
  maxPrice: "0.5"
  maxSize: 2
  minSize: 15
  role: Node
  rootVolumeSize: 100
  subnets:
  - eu-west-1a
  - eu-west-1b
  - eu-west-1c

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

Hi @mad01. 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 Jul 24, 2017
@mad01 mad01 changed the title MPV of templating MVP of templating Jul 24, 2017
@chrislovecnm
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 25, 2017
@mad01
Copy link
Contributor Author

mad01 commented Aug 1, 2017

/assign @zmerlynn
I think this is good to go

@zmerlynn
Copy link
Member

zmerlynn commented Aug 2, 2017

Hey, sorry, I thought I could get to this today but haven't had a chance.
/assign justinsb

@justinsb
Copy link
Member

justinsb commented Aug 4, 2017

So I would have said that templating is probably out of scope, but the toolbox is where we do things that we think might be out of scope - it doesn't have the same guarantees that we'll continue to support it and doesn't have the same implication that things are core - although in practice things tend to wither rather than being removed :-)

I am wondering if we should force people to specify the style of templating they want to use. i.e. either pass a templatesyntax=go flag or specify the template using gotemplate. But I think we could add this later...

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, mad01

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 4, 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 10ce978 into kubernetes:master Aug 4, 2017
@stefancocora
Copy link

I am wondering if we should force people to specify the style of templating they want to use. i.e. either pass a templatesyntax=go flag or specify the template using gotemplate. But I think we could add this later...

👍
This should be a feature imho.
Having users specify the style of templating makes things a lot clearer and more specific, removes ambiguity. Reduced ambiguity brings clarity and that is a very important point in my book !

k8s-github-robot pushed a commit that referenced this pull request Oct 17, 2017
Automatic merge from submit-queue.

Add kops toolbox template docs

Document the template format of new command `kops toolbox template` (#3040)
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

7 participants