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

bug 1834925: vsphere: check if .Infra.Status and .Infra.Status.PlatformStatus is nil #1728

Merged
merged 1 commit into from
May 14, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0755
path: "/etc/NetworkManager/dispatcher.d/40-mdns-hostname"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
#!/bin/bash
Expand All @@ -24,3 +26,5 @@ contents:
esac
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/systemd/system/crio.service.d/20-stream-address.conf"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
[Service]
Expand All @@ -14,3 +16,5 @@ contents:
$CRIO_METRICS_OPTIONS
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/NetworkManager/conf.d/99-kni.conf"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
[main]
Expand All @@ -12,3 +14,5 @@ contents:
ipv6.dhcp-duid=ll
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
4 changes: 4 additions & 0 deletions templates/common/vsphere/files/vsphere-coredns-corefile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/kubernetes/static-pod-resources/coredns/Corefile.tmpl"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
. {
Expand All @@ -25,3 +27,5 @@ contents:
}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
4 changes: 4 additions & 0 deletions templates/common/vsphere/files/vsphere-coredns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/kubernetes/manifests/coredns.yaml"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
kind: Pod
Expand Down Expand Up @@ -121,3 +123,5 @@ contents:
status: {}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
4 changes: 4 additions & 0 deletions templates/common/vsphere/files/vsphere-hostname.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0755
path: "/usr/local/bin/vsphere-hostname.sh"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
#!/usr/bin/env bash
Expand All @@ -15,4 +17,6 @@ contents:
fi
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}

4 changes: 4 additions & 0 deletions templates/common/vsphere/files/vsphere-keepalived.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/kubernetes/manifests/keepalived.yaml"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
kind: Pod
Expand Down Expand Up @@ -122,3 +124,5 @@ contents:
status: {}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
4 changes: 4 additions & 0 deletions templates/common/vsphere/files/vsphere-mdns-publisher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/kubernetes/manifests/mdns-publisher.yaml"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
kind: Pod
Expand Down Expand Up @@ -106,3 +108,5 @@ contents:
status: {}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0755
path: "/etc/NetworkManager/dispatcher.d/30-resolv-prepender"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
#!/bin/bash
Expand Down Expand Up @@ -33,3 +35,5 @@ contents:
esac
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ mode: 0644
path: "/etc/dhcp/dhclient.conf"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
supersede domain-search "{{ .EtcdDiscoveryDomain }}";
prepend domain-name-servers {{ .Infra.Status.PlatformStatus.VSphere.NodeDNSIP }};
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/kubernetes/static-pod-resources/haproxy/haproxy.cfg.tmpl"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
defaults
Expand Down Expand Up @@ -42,3 +44,5 @@ contents:
{{- end }}`}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
4 changes: 4 additions & 0 deletions templates/master/00-master/vsphere/files/vsphere-haproxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/kubernetes/manifests/haproxy.yaml"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
kind: Pod
Expand Down Expand Up @@ -142,3 +144,5 @@ contents:
status: {}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/kubernetes/static-pod-resources/keepalived/keepalived.conf.tmpl"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
vrrp_script chk_ocp {
Expand Down Expand Up @@ -56,3 +58,5 @@ contents:
}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/kubernetes/static-pod-resources/mdns/config.hcl.tmpl"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
bind_address = "{{`{{ .NonVirtualIP }}`}}"
Expand All @@ -27,3 +29,5 @@ contents:
}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
4 changes: 4 additions & 0 deletions templates/master/01-master-kubelet/vsphere/units/kubelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ contents: |
--container-runtime-endpoint=/var/run/crio/crio.sock \
--runtime-cgroups=/system.slice/crio.service \
--node-labels=node-role.kubernetes.io/master,node.openshift.io/os_id=${ID} \
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
--node-ip="${KUBELET_NODE_IP}" \
--address="${KUBELET_NODE_IP}" \
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
--minimum-container-ttl-duration=6m0s \
--cloud-provider={{cloudProvider .}} \
--volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0755
path: "/etc/NetworkManager/dispatcher.d/30-resolv-prepender"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
#!/bin/bash
Expand Down Expand Up @@ -33,3 +35,5 @@ contents:
esac
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ mode: 0644
path: "/etc/dhcp/dhclient.conf"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
supersede domain-search "{{ .EtcdDiscoveryDomain }}";
prepend domain-name-servers {{ .Infra.Status.PlatformStatus.VSphere.NodeDNSIP }};
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/kubernetes/static-pod-resources/keepalived/keepalived.conf.tmpl"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
# TODO: Improve this check. The port is assumed to be alive.
Expand Down Expand Up @@ -32,3 +34,5 @@ contents:
}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mode: 0644
path: "/etc/kubernetes/static-pod-resources/mdns/config.hcl.tmpl"
contents:
inline: |
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
bind_address = "{{`{{ .NonVirtualIP }}`}}"
Expand All @@ -18,3 +20,5 @@ contents:
}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
4 changes: 4 additions & 0 deletions templates/worker/01-worker-kubelet/vsphere/units/kubelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ contents: |
--container-runtime-endpoint=/var/run/crio/crio.sock \
--runtime-cgroups=/system.slice/crio.service \
--node-labels=node-role.kubernetes.io/worker,node.openshift.io/os_id=${ID} \
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
--node-ip="${KUBELET_NODE_IP}" \
--address="${KUBELET_NODE_IP}" \
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
--minimum-container-ttl-duration=6m0s \
--volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \
Expand Down