Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions pkg/userdata/centos/testdata/kubelet-v1.10-aws.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#cloud-config
hostname: node1


ssh_pwauth: no

Expand Down Expand Up @@ -55,9 +55,7 @@ write_files:
systemctl restart systemd-modules-load.service
sysctl --system

# The normal way of setting it via cloud-init is broken:
# https://bugs.launchpad.net/cloud-init/+bug/1662542
hostnamectl set-hostname node1


yum install -y docker-1.13.1 \
ebtables \
Expand Down Expand Up @@ -137,7 +135,6 @@ write_files:
--authentication-token-webhook=true \
--cloud-provider=aws \
--cloud-config=/etc/kubernetes/cloud-config \
--hostname-override=node1 \
--read-only-port=0 \
--exit-on-lock-contention \
--lock-file=/tmp/kubelet.lock \
Expand Down
7 changes: 2 additions & 5 deletions pkg/userdata/centos/testdata/kubelet-v1.11-aws.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#cloud-config
hostname: node1


ssh_pwauth: no

Expand Down Expand Up @@ -55,9 +55,7 @@ write_files:
systemctl restart systemd-modules-load.service
sysctl --system

# The normal way of setting it via cloud-init is broken:
# https://bugs.launchpad.net/cloud-init/+bug/1662542
hostnamectl set-hostname node1


yum install -y docker-1.13.1 \
ebtables \
Expand Down Expand Up @@ -137,7 +135,6 @@ write_files:
--authentication-token-webhook=true \
--cloud-provider=aws \
--cloud-config=/etc/kubernetes/cloud-config \
--hostname-override=node1 \
--read-only-port=0 \
--exit-on-lock-contention \
--lock-file=/tmp/kubelet.lock \
Expand Down
7 changes: 2 additions & 5 deletions pkg/userdata/centos/testdata/kubelet-v1.12-aws.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#cloud-config
hostname: node1


ssh_pwauth: no

Expand Down Expand Up @@ -55,9 +55,7 @@ write_files:
systemctl restart systemd-modules-load.service
sysctl --system

# The normal way of setting it via cloud-init is broken:
# https://bugs.launchpad.net/cloud-init/+bug/1662542
hostnamectl set-hostname node1


yum install -y docker-1.13.1 \
ebtables \
Expand Down Expand Up @@ -136,7 +134,6 @@ write_files:
--authentication-token-webhook=true \
--cloud-provider=aws \
--cloud-config=/etc/kubernetes/cloud-config \
--hostname-override=node1 \
--read-only-port=0 \
--exit-on-lock-contention \
--lock-file=/tmp/kubelet.lock \
Expand Down
5 changes: 5 additions & 0 deletions pkg/userdata/centos/testdata/kubelet-v1.12-vsphere.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down Expand Up @@ -55,9 +58,11 @@ write_files:
systemctl restart systemd-modules-load.service
sysctl --system


# The normal way of setting it via cloud-init is broken:
# https://bugs.launchpad.net/cloud-init/+bug/1662542
hostnamectl set-hostname node1


yum install -y docker-1.13.1 \
ebtables \
Expand Down
7 changes: 2 additions & 5 deletions pkg/userdata/centos/testdata/kubelet-v1.9-aws.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#cloud-config
hostname: node1


ssh_pwauth: no

Expand Down Expand Up @@ -55,9 +55,7 @@ write_files:
systemctl restart systemd-modules-load.service
sysctl --system

# The normal way of setting it via cloud-init is broken:
# https://bugs.launchpad.net/cloud-init/+bug/1662542
hostnamectl set-hostname node1


yum install -y docker-1.13.1 \
ebtables \
Expand Down Expand Up @@ -137,7 +135,6 @@ write_files:
--authentication-token-webhook=true \
--cloud-provider=aws \
--cloud-config=/etc/kubernetes/cloud-config \
--hostname-override=node1 \
--read-only-port=0 \
--exit-on-lock-contention \
--lock-file=/tmp/kubelet.lock \
Expand Down
5 changes: 5 additions & 0 deletions pkg/userdata/centos/userdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ func (p Provider) UserData(
}

const ctTemplate = `#cloud-config
{{ if ne .CloudProvider "aws" }}
hostname: {{ .MachineSpec.Name }}
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name
{{ end }}

{{- if .OSConfig.DistUpgradeOnBoot }}
package_upgrade: true
Expand Down Expand Up @@ -181,9 +184,11 @@ write_files:
systemctl restart systemd-modules-load.service
sysctl --system

{{ if ne .CloudProvider "aws" }}
# The normal way of setting it via cloud-init is broken:
# https://bugs.launchpad.net/cloud-init/+bug/1662542
hostnamectl set-hostname {{ .MachineSpec.Name }}
{{ end }}

yum install -y docker-1.13.1 \
ebtables \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,6 @@
},
"mode": 420
},
{
"filesystem": "root",
"group": {},
"path": "/etc/hostname",
"user": {},
"contents": {
"source": "data:,node1",
"verification": {}
},
"mode": 384
},
{
"filesystem": "root",
"group": {
Expand Down Expand Up @@ -220,7 +209,7 @@
"name": "kubelet-healthcheck.service"
},
{
"contents": "[Unit]\nDescription=Kubernetes Kubelet\nRequires=docker.service\nAfter=docker.service\n[Service]\nTimeoutStartSec=5min\nEnvironment=KUBELET_IMAGE=docker://k8s.gcr.io/hyperkube-amd64:v1.9.2\nEnvironment=\"RKT_RUN_ARGS=--uuid-file-save=/var/cache/kubelet-pod.uuid \\\n --insecure-options=image \\\n --volume=resolv,kind=host,source=/etc/resolv.conf \\\n --mount volume=resolv,target=/etc/resolv.conf \\\n --volume cni-bin,kind=host,source=/opt/cni/bin \\\n --mount volume=cni-bin,target=/opt/cni/bin \\\n --volume cni-conf,kind=host,source=/etc/cni/net.d \\\n --mount volume=cni-conf,target=/etc/cni/net.d \\\n --volume etc-kubernetes,kind=host,source=/etc/kubernetes \\\n --mount volume=etc-kubernetes,target=/etc/kubernetes \\\n --volume var-log,kind=host,source=/var/log \\\n --mount volume=var-log,target=/var/log \\\n --volume var-lib-calico,kind=host,source=/var/lib/calico \\\n --mount volume=var-lib-calico,target=/var/lib/calico\"\nExecStartPre=/bin/mkdir -p /var/lib/calico\nExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests\nExecStartPre=/bin/mkdir -p /etc/cni/net.d\nExecStartPre=/bin/mkdir -p /opt/cni/bin\nExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/cache/kubelet-pod.uuid\nExecStartPre=-/bin/rm -rf /var/lib/rkt/cas/tmp/\nExecStart=/usr/lib/coreos/kubelet-wrapper \\\n --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \\\n --kubeconfig=/etc/kubernetes/kubelet.conf \\\n --pod-manifest-path=/etc/kubernetes/manifests \\\n --allow-privileged=true \\\n --network-plugin=cni \\\n --cni-conf-dir=/etc/cni/net.d \\\n --cni-bin-dir=/opt/cni/bin \\\n --authorization-mode=Webhook \\\n --client-ca-file=/etc/kubernetes/pki/ca.crt \\\n --cadvisor-port=0 \\\n --rotate-certificates=true \\\n --cert-dir=/etc/kubernetes/pki \\\n --authentication-token-webhook=true \\\n --cloud-provider=aws \\\n --cloud-config=/etc/kubernetes/cloud-config \\\n --hostname-override=node1 \\\n --read-only-port=0 \\\n --exit-on-lock-contention \\\n --lock-file=/tmp/kubelet.lock \\\n --anonymous-auth=false \\\n --protect-kernel-defaults=true \\\n --cluster-dns=10.10.10.10 \\\n --cluster-domain=cluster.local\nExecStop=-/usr/bin/rkt stop --uuid-file=/var/cache/kubelet-pod.uuid\nRestart=always\nRestartSec=10\n[Install]\nWantedBy=multi-user.target\n",
"contents": "[Unit]\nDescription=Kubernetes Kubelet\nRequires=docker.service\nAfter=docker.service\n[Service]\nTimeoutStartSec=5min\nEnvironment=KUBELET_IMAGE=docker://k8s.gcr.io/hyperkube-amd64:v1.9.2\nEnvironment=\"RKT_RUN_ARGS=--uuid-file-save=/var/cache/kubelet-pod.uuid \\\n --insecure-options=image \\\n --volume=resolv,kind=host,source=/etc/resolv.conf \\\n --mount volume=resolv,target=/etc/resolv.conf \\\n --volume cni-bin,kind=host,source=/opt/cni/bin \\\n --mount volume=cni-bin,target=/opt/cni/bin \\\n --volume cni-conf,kind=host,source=/etc/cni/net.d \\\n --mount volume=cni-conf,target=/etc/cni/net.d \\\n --volume etc-kubernetes,kind=host,source=/etc/kubernetes \\\n --mount volume=etc-kubernetes,target=/etc/kubernetes \\\n --volume var-log,kind=host,source=/var/log \\\n --mount volume=var-log,target=/var/log \\\n --volume var-lib-calico,kind=host,source=/var/lib/calico \\\n --mount volume=var-lib-calico,target=/var/lib/calico\"\nExecStartPre=/bin/mkdir -p /var/lib/calico\nExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests\nExecStartPre=/bin/mkdir -p /etc/cni/net.d\nExecStartPre=/bin/mkdir -p /opt/cni/bin\nExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/cache/kubelet-pod.uuid\nExecStartPre=-/bin/rm -rf /var/lib/rkt/cas/tmp/\nExecStart=/usr/lib/coreos/kubelet-wrapper \\\n --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \\\n --kubeconfig=/etc/kubernetes/kubelet.conf \\\n --pod-manifest-path=/etc/kubernetes/manifests \\\n --allow-privileged=true \\\n --network-plugin=cni \\\n --cni-conf-dir=/etc/cni/net.d \\\n --cni-bin-dir=/opt/cni/bin \\\n --authorization-mode=Webhook \\\n --client-ca-file=/etc/kubernetes/pki/ca.crt \\\n --cadvisor-port=0 \\\n --rotate-certificates=true \\\n --cert-dir=/etc/kubernetes/pki \\\n --authentication-token-webhook=true \\\n --cloud-provider=aws \\\n --cloud-config=/etc/kubernetes/cloud-config \\\n --read-only-port=0 \\\n --exit-on-lock-contention \\\n --lock-file=/tmp/kubelet.lock \\\n --anonymous-auth=false \\\n --protect-kernel-defaults=true \\\n --cluster-dns=10.10.10.10 \\\n --cluster-domain=cluster.local\nExecStop=-/usr/bin/rkt stop --uuid-file=/var/cache/kubelet-pod.uuid\nRestart=always\nRestartSec=10\n[Install]\nWantedBy=multi-user.target\n",
"enabled": true,
"name": "kubelet.service"
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/userdata/coreos/userdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,13 @@ storage:
yes
{{ end }}

{{ if ne .CloudProvider "aws" }}
- path: /etc/hostname
filesystem: root
mode: 0600
contents:
inline: '{{ .MachineSpec.Name }}'
{{- end }}

- path: /etc/ssh/sshd_config
filesystem: root
Expand Down
2 changes: 1 addition & 1 deletion pkg/userdata/helper/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (
--cloud-provider={{ .CloudProvider }} \
--cloud-config=/etc/kubernetes/cloud-config \
{{- end }}
{{- if .Hostname }}
{{- if and (.Hostname) (ne .CloudProvider "aws") }}
--hostname-override={{ .Hostname }} \
{{- end }}
--read-only-port=0 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
--authentication-token-webhook=true \
--cloud-provider=aws \
--cloud-config=/etc/kubernetes/cloud-config \
--hostname-override=some-test-node \
--read-only-port=0 \
--exit-on-lock-contention \
--lock-file=/tmp/kubelet.lock \
Expand Down
3 changes: 3 additions & 0 deletions pkg/userdata/ubuntu/testdata/dist-upgrade-on-boot.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down
3 changes: 3 additions & 0 deletions pkg/userdata/ubuntu/testdata/multiple-dns-servers.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down
3 changes: 3 additions & 0 deletions pkg/userdata/ubuntu/testdata/multiple-ssh-keys.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down
3 changes: 3 additions & 0 deletions pkg/userdata/ubuntu/testdata/openstack.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down
3 changes: 3 additions & 0 deletions pkg/userdata/ubuntu/testdata/version-1.10.10.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down
3 changes: 3 additions & 0 deletions pkg/userdata/ubuntu/testdata/version-1.11.3.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down
3 changes: 3 additions & 0 deletions pkg/userdata/ubuntu/testdata/version-1.12.1.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down
3 changes: 3 additions & 0 deletions pkg/userdata/ubuntu/testdata/version-1.9.10.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down
3 changes: 3 additions & 0 deletions pkg/userdata/ubuntu/testdata/vsphere.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#cloud-config

hostname: node1
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name


ssh_pwauth: no

Expand Down
3 changes: 3 additions & 0 deletions pkg/userdata/ubuntu/userdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ func (p Provider) UserData(
}

const ctTemplate = `#cloud-config
{{ if ne .CloudProvider "aws" }}
hostname: {{ .MachineSpec.Name }}
# Never set the hostname on AWS nodes. Kubernetes(kube-proxy) requires the hostname to be the private dns name
{{ end }}

ssh_pwauth: no

Expand Down