-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Manifest templates #1884
Manifest templates #1884
Conversation
@ozdanborne you can just look at the second commit in this series |
@spikecurtis Just wanted to bring up whitespace trimming:
There's some places in the manifest where you've put Other places, some of the I'll make some individual comments to point out examples. |
When do you plan to get this in? You may want to announce a freeze on manifest changes soon, otherwise you'll have a hard time rebasing. |
@@ -0,0 +1,127 @@ | |||
# This ConfigMap is used to configure a self-hosted {{include.prodname}} installation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about a jekyll comment at the top of each of these include manifests that explains which .include
flags it accepts. For this manifest, for example:
{% comment %}
calico-config.yaml acccepts the following include flags:
| Name | Accepted Values |
|-------------|-----------------|
| datastore | kdd, etcd |
| typha | true, false |
| network | calico, flannel |
| calico_ipam | true, false |
{% endcomment %}
I planned on getting it in ASAP. I'm assuming that CNX doesn't use these manifests (or not master, at any rate). |
image: docker.io/istio/proxy_init:0.6.0 | ||
args: | ||
- "-p" | ||
- {{ .MeshConfig.ProxyListenPort }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think jekyll is going to try to render this. So you'll need to put it in a {% raw %}{{ .MeshConfig.ProxyListenPort }}{% endraw %}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind! Looks like you did above 👍
I'm worried that Canal and Calico are too different to control with Edit: I'm less certain about splitting the daemonset but the calico-config and canal-config seem like it would be a clean way to simplify it. |
Canal + etcd seems to be the odd one. Canal + KDD is very similar to Calico + KDD. I was wondering if it is really necessary to be that way, and maybe Canal + etcd just never got updated... |
# No IP address needed. | ||
- name: IP | ||
value: "" | ||
{% else %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 'else' is for the if include.network == 'calico'
on line 112. It is quite difficult to track that down since these if statements aren't indented.
Since I don't think jekyll has a way for us to indent the if/else logic, perhaps we should avoid nested if
statements and long if/else conditions when possible, instead opting to end them and explitly starting a new if
with its exact conditions. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've indented nested logic and used {%-
to prevent the nesting whitespace from showing up in the final rendered file.
74740cf
to
61bce5c
Compare
@@ -0,0 +1,19 @@ | |||
# This NetworkPolicy allows pods egress access the to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason this is in manifests/
instead of manifests/app-layer-policy
?
Same for the other few manifests here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea
61bce5c
to
67fc77f
Compare
{%- endif %} | ||
{%- if include.network == "calico" %} | ||
# Configure the {{site.prodname}} backend to use. | ||
calico_backend: "bird" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not super important, but this is smushing with typha_service_name in the kdd manifest:
data:
# To enable Typha, set this to "calico-typha" *and* set a n
# below. We recommend using Typha if you have more than 50
# essential.
typha_service_name: "none"
# Configure the Calico backend to use.
calico_backend: "bird"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never mind, forget i mentioned this. there's a few places i'm seeing this, but we can fix it later.
namespace: kube-system | ||
data: | ||
# Configure this with the location of your etcd cluster. | ||
etcd_endpoints: "https://127.0.0.1:2379" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interestingly, looks like canal etcd used https
instead of http
. I wouldn't have thought that https
would work...
kind: DaemonSet | ||
apiVersion: extensions/v1beta1 | ||
metadata: | ||
name: canal-node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like the name of the daemonset changes to canal
(instead of canal-node
) in the new manifests. This would break upgrades for existing users applying our manifests directly...
hostNetwork: true | ||
tolerations: | ||
# Make sure canal node can be scheduled on all nodes. | ||
- effect: NoSchedule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we lost this toleration in the new canal manifest. Not sure what our stance is on running kube-controllers on master...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Casey's stance is
¯\_(ツ)_/¯
# The default IPv4 pool to create on startup if none exists. Pod IPs will be | ||
# chosen from this range. Changing this value after installation will have | ||
# no effect. This should fall within `--cluster-cidr`. | ||
- name: CALICO_IPV4POOL_CIDR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pool is still needed when net=none, as felix uses it to identify container traffic. So this needs to be moved into its own if statement where include.network == "calico" || include.network == "none"
- name: CALICO_IPV4POOL_CIDR | ||
value: "192.168.0.0/16" | ||
# Enable IPIP | ||
- name: CALICO_IPV4POOL_IPIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we've dropped this field in the new system. which feels right. but just pointing out for the record 👍
Ok I've manually gone through all the diffs and pointed out all the major differences I found. I've also attached the bash script I used to generate local manifests for comparisons, in case anyone else wants to compare them. (uploaded as .txt since github doesn't like .sh. just rename it). |
- apiGroups: [""] | ||
resources: ["endpoints", "pods", "services"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: [""] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this block and the previous block could be combined, since they share the exact same verbs and apiGroups:
- apiGroups: [""]
resources: ["endpoints", "pods", "services", "namespaces", "nodes", "secrets"]
verbs: ["get", "list", "watch"]
metadata: | ||
name: istio-sidecar-injector-istio-system | ||
rules: | ||
- apiGroups: ["*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be [""]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not modify the istio.yaml
since it's mostly taken from the Istio project directly, so us fixing it up is going to make merges difficult in the future.
- apiGroups: [""] | ||
resources: ["serviceaccounts"] | ||
verbs: ["get", "watch", "list"] | ||
- apiGroups: [""] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be combined with the previous group as well
- name: istio-certs | ||
secret: | ||
optional: true | ||
{% raw %}{{ if eq .Spec.ServiceAccountName "" }}secretName: istio.default{{ else }}secretName: {{ printf "istio.%s" .Spec.ServiceAccountName }}{{ end }}{% endraw %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this raw
is needed at all. It's currently rendering like this, which doesn't seem right:
secret:
optional: true
{{ if eq .Spec.ServiceAccountName "" }}secretName: istio.default{{ else }}secretName: {{ printf "istio.%s" .Spec.ServiceAccountName }}{{ end }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is supported my mind is going to explode. Does kubectl support templating of the manifests themselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, kubectl
doesn't but the pod that consumes this configmap is itself a kind of templating engine. That's why this configmap has template tags in it that need to be escaped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh, i didn't notice this was just technically a string inside a configmap. phew. Though i kind of wish it did work that way 😄
So we can dismiss the original comment, it's fine as is.
1c1ffad
to
e0634b1
Compare
Signed-off-by: Spike Curtis <[email protected]>
e0634b1
to
e67a23f
Compare
* Most upstream changes were buried in calico#1884 which switched from non-templated manifests to templating * projectcalico/calico#1884 * projectcalico/calico#1853 * projectcalico/calico#2069 * projectcalico/calico#2032 * projectcalico/calico#1841 * projectcalico/calico#1770
* Most upstream changes were buried in calico#1884 which switched from non-templated manifests to templating * projectcalico/calico#1884 * projectcalico/calico#1853 * projectcalico/calico#2069 * projectcalico/calico#2032 * projectcalico/calico#1841 * projectcalico/calico#1770
* Most upstream changes were buried in calico#1884 which switched from non-templated manifests to templating * projectcalico/calico#1884 * projectcalico/calico#1853 * projectcalico/calico#2069 * projectcalico/calico#2032 * projectcalico/calico#1841 * projectcalico/calico#1770
* Most upstream changes were buried in calico#1884 which switched from non-templated manifests to templating * projectcalico/calico#1884 * projectcalico/calico#1853 * projectcalico/calico#2069 * projectcalico/calico#2032 * projectcalico/calico#1841 * projectcalico/calico#1770
* Most upstream changes were buried in calico#1884 which switched from non-templated manifests to templating * projectcalico/calico#1884 * projectcalico/calico#1853 * projectcalico/calico#2069 * projectcalico/calico#2032 * projectcalico/calico#1841 * projectcalico/calico#1770
* Most upstream changes were buried in calico#1884 which switched from non-templated manifests to templating * projectcalico/calico#1884 * projectcalico/calico#1853 * projectcalico/calico#2069 * projectcalico/calico#2032 * projectcalico/calico#1841 * projectcalico/calico#1770
* Most upstream changes were buried in calico#1884 which switched from non-templated manifests to templating * projectcalico/calico#1884 * projectcalico/calico#1853 * projectcalico/calico#2069 * projectcalico/calico#2032 * projectcalico/calico#1841 * projectcalico/calico#1770
* Most upstream changes were buried in calico#1884 which switched from non-templated manifests to templating * projectcalico/calico#1884 * projectcalico/calico#1853 * projectcalico/calico#2069 * projectcalico/calico#2032 * projectcalico/calico#1841 * projectcalico/calico#1770
* Most upstream changes were buried in calico#1884 which switched from non-templated manifests to templating * projectcalico/calico#1884 * projectcalico/calico#1853 * projectcalico/calico#2069 * projectcalico/calico#2032 * projectcalico/calico#1841 * projectcalico/calico#1770
* Most upstream changes were buried in calico#1884 which switched from non-templated manifests to templating * projectcalico/calico#1884 * projectcalico/calico#1853 * projectcalico/calico#2069 * projectcalico/calico#2032 * projectcalico/calico#1841 * projectcalico/calico#1770
Description
Reworks generation of various
calico.yaml
andcanal.yaml
manifests to be generated with Jekyll's templating system.Todos
Release Note