From 70f1d7247aa2b5e33761d10bf2e9b64e2841632c Mon Sep 17 00:00:00 2001 From: dima Date: Fri, 31 Mar 2017 17:05:22 +0200 Subject: [PATCH 1/2] added weave 1.9.4. used default template. https://github.com/kubernetes/kops/issues/2180 --- .../addons/networking.weave/v1.9.4.yaml | 118 ++++++++++++++++++ .../pkg/fi/cloudup/bootstrapchannelbuilder.go | 2 +- 2 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 upup/models/cloudup/resources/addons/networking.weave/v1.9.4.yaml diff --git a/upup/models/cloudup/resources/addons/networking.weave/v1.9.4.yaml b/upup/models/cloudup/resources/addons/networking.weave/v1.9.4.yaml new file mode 100644 index 0000000000..e01fadc503 --- /dev/null +++ b/upup/models/cloudup/resources/addons/networking.weave/v1.9.4.yaml @@ -0,0 +1,118 @@ +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + name: weave-net +rules: +- apiGroups: + - "" + resources: + - pods + - namespaces + - nodes + verbs: + - get + - list + - watch +- apiGroups: + - extensions + resources: + - networkpolicies + verbs: + - get + - list + - watch +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: weave-net + namespace: kube-system +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + name: weave-net +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: weave-net +subjects: +- kind: ServiceAccount + name: weave-net + namespace: kube-system +--- +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: weave-net + namespace: kube-system +spec: + template: + metadata: + labels: + name: weave-net + spec: + hostNetwork: true + hostPID: true + containers: + - name: weave + image: weaveworks/weave-kube:1.9.4 + command: + - /home/weave/launch.sh + livenessProbe: + initialDelaySeconds: 30 + httpGet: + host: 127.0.0.1 + path: /status + port: 6784 + securityContext: + privileged: true + volumeMounts: + - name: weavedb + mountPath: /weavedb + - name: cni-bin + mountPath: /host/opt + - name: cni-bin2 + mountPath: /host/home + - name: cni-conf + mountPath: /host/etc + - name: dbus + mountPath: /host/var/lib/dbus + - name: lib-modules + mountPath: /lib/modules + resources: + requests: + cpu: 10m + - name: weave-npc + image: weaveworks/weave-npc:1.9.4 + resources: + requests: + cpu: 10m + securityContext: + privileged: true + restartPolicy: Always + tolerations: + - key: node-role.kubernetes.io/master + effect: NoSchedule + serviceAccountName: weave-net + securityContext: + seLinuxOptions: + type: spc_t + volumes: + - name: weavedb + emptyDir: {} + - name: cni-bin + hostPath: + path: /opt + - name: cni-bin2 + hostPath: + path: /home + - name: cni-conf + hostPath: + path: /etc + - name: dbus + hostPath: + path: /var/lib/dbus + - name: lib-modules + hostPath: + path: /lib/modules diff --git a/upup/pkg/fi/cloudup/bootstrapchannelbuilder.go b/upup/pkg/fi/cloudup/bootstrapchannelbuilder.go index 8684cc66fe..bf2b26a484 100644 --- a/upup/pkg/fi/cloudup/bootstrapchannelbuilder.go +++ b/upup/pkg/fi/cloudup/bootstrapchannelbuilder.go @@ -203,7 +203,7 @@ func (b *BootstrapChannelBuilder) buildManifest() (*channelsapi.Addons, map[stri if b.cluster.Spec.Networking.Weave != nil { key := "networking.weave" - version := "1.9.3" + version := "1.9.4" // TODO: Create configuration object for cni providers (maybe create it but orphan it)? location := key + "/v" + version + ".yaml" From 48c678fb7f87b9614d64305f11e47e487f25de47 Mon Sep 17 00:00:00 2001 From: dima Date: Sun, 2 Apr 2017 18:46:21 +0200 Subject: [PATCH 2/2] for different k8s version different weave --- upup/pkg/fi/cloudup/bootstrapchannelbuilder.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/upup/pkg/fi/cloudup/bootstrapchannelbuilder.go b/upup/pkg/fi/cloudup/bootstrapchannelbuilder.go index bf2b26a484..fc32a3ce0b 100644 --- a/upup/pkg/fi/cloudup/bootstrapchannelbuilder.go +++ b/upup/pkg/fi/cloudup/bootstrapchannelbuilder.go @@ -203,7 +203,13 @@ func (b *BootstrapChannelBuilder) buildManifest() (*channelsapi.Addons, map[stri if b.cluster.Spec.Networking.Weave != nil { key := "networking.weave" - version := "1.9.4" + var version string + switch { + case kv.Major == 1 && kv.Minor <= 5: + version = "1.9.3" + default: + version = "1.9.4" + } // TODO: Create configuration object for cni providers (maybe create it but orphan it)? location := key + "/v" + version + ".yaml"