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
14 changes: 12 additions & 2 deletions pkg/controller/template/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,12 @@ func onPremPlatformIngressIP(cfg RenderConfig) (interface{}, error) {
case configv1.OpenStackPlatformType:
return cfg.Infra.Status.PlatformStatus.OpenStack.IngressIP, nil
case configv1.VSpherePlatformType:
return cfg.Infra.Status.PlatformStatus.VSphere.IngressIP, nil
if cfg.Infra.Status.PlatformStatus.VSphere != nil {
return cfg.Infra.Status.PlatformStatus.VSphere.IngressIP, nil
}
// VSphere UPI doesn't populate VSphere field. So it's not an error,
// and there is also no data
return nil, nil
default:
return nil, fmt.Errorf("invalid platform for Ingress IP")
}
Expand All @@ -429,7 +434,12 @@ func onPremPlatformAPIServerInternalIP(cfg RenderConfig) (interface{}, error) {
case configv1.OpenStackPlatformType:
return cfg.Infra.Status.PlatformStatus.OpenStack.APIServerInternalIP, nil
case configv1.VSpherePlatformType:
return cfg.Infra.Status.PlatformStatus.VSphere.APIServerInternalIP, nil
if cfg.Infra.Status.PlatformStatus.VSphere != nil {
return cfg.Infra.Status.PlatformStatus.VSphere.APIServerInternalIP, nil
}
// VSphere UPI doesn't populate VSphere field. So it's not an error,
// and there is also no data
return nil, nil
default:
return nil, fmt.Errorf("invalid platform for API Server Internal IP")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mode: 0755
path: "/etc/NetworkManager/dispatcher.d/40-mdns-hostname"
contents:
inline: |
{{ if (onPremPlatformAPIServerInternalIP .) -}}
#!/bin/bash
STATUS=$2
case "$STATUS" in
Expand All @@ -19,3 +20,4 @@ contents:
*)
;;
esac
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ mode: 0644
path: "/etc/NetworkManager/conf.d/99-{{ onPremPlatformShortName . }}.conf"
contents:
inline: |
{{ if (onPremPlatformAPIServerInternalIP .) -}}
[main]
rc-manager=unmanaged
[connection]
ipv6.dhcp-duid=ll
ipv6.dhcp-iaid=mac
[keyfile]
path=/etc/NetworkManager/system-connections-merged
{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mode: 0755
path: "/etc/NetworkManager/dispatcher.d/30-resolv-prepender"
contents:
inline: |
{{ if (onPremPlatformAPIServerInternalIP .) -}}
#!/bin/bash
set -eo pipefail
IFACE=$1
Expand Down Expand Up @@ -63,3 +64,4 @@ contents:
*)
;;
esac
{{ end -}}
2 changes: 2 additions & 0 deletions templates/common/on-prem/files/coredns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mode: 0644
path: "/etc/kubernetes/manifests/coredns.yaml"
contents:
inline: |
{{ if (onPremPlatformAPIServerInternalIP .) -}}
kind: Pod
apiVersion: v1
metadata:
Expand Down Expand Up @@ -116,3 +117,4 @@ contents:
- operator: Exists
priorityClassName: system-node-critical
status: {}
{{ end -}}
2 changes: 2 additions & 0 deletions templates/common/on-prem/files/keepalived.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mode: 0644
path: "/etc/kubernetes/manifests/keepalived.yaml"
contents:
inline: |
{{ if (onPremPlatformAPIServerInternalIP .) -}}
kind: Pod
apiVersion: v1
metadata:
Expand Down Expand Up @@ -167,3 +168,4 @@ contents:
- operator: Exists
priorityClassName: system-node-critical
status: {}
{{ end -}}
2 changes: 2 additions & 0 deletions templates/common/on-prem/files/mdns-publisher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mode: 0644
path: "/etc/kubernetes/manifests/mdns-publisher.yaml"
contents:
inline: |
{{ if (onPremPlatformAPIServerInternalIP .) -}}
kind: Pod
apiVersion: v1
metadata:
Expand Down Expand Up @@ -101,3 +102,4 @@ contents:
- operator: Exists
priorityClassName: system-node-critical
status: {}
{{ end -}}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: nodeip-configuration.service
enabled: true
contents: |
{{ if (onPremPlatformAPIServerInternalIP .) -}}
[Unit]
Description=Writes IP address configuration so that kubelet and crio services select a valid node IP
# This only applies to VIP managing environments where the kubelet and crio IP
Expand Down Expand Up @@ -44,4 +45,4 @@ contents: |

[Install]
WantedBy=multi-user.target

{{ end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ mode: 0644
path: "/etc/systemd/system/crio.service.d/20-stream-address.conf"
contents:
inline: |
{{ if .Infra -}}
{{ if .Infra.Status -}}
{{ if .Infra.Status.PlatformStatus -}}
{{ if .Infra.Status.PlatformStatus.VSphere -}}
{{ if .Infra.Status.PlatformStatus.VSphere.APIServerInternalIP -}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we need to replace this with the simpler conditional used in other templates? {{ if (onPremPlatformAPIServerInternalIP .) -}}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reference to the PlatformStatus in that file. Are you saying you don't want it at all?

{{ if (onPremPlatformAPIServerInternalIP .) -}}
[Service]
ExecStart=
ExecStart=/usr/bin/crio \
Expand All @@ -15,7 +11,3 @@ contents:
$CRIO_NETWORK_OPTIONS \
$CRIO_METRICS_OPTIONS
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
2 changes: 2 additions & 0 deletions templates/master/00-master/on-prem/files/haproxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mode: 0644
path: "/etc/kubernetes/manifests/haproxy.yaml"
contents:
inline: |
{{ if (onPremPlatformAPIServerInternalIP .) -}}
kind: Pod
apiVersion: v1
metadata:
Expand Down Expand Up @@ -144,3 +145,4 @@ contents:
- operator: Exists
priorityClassName: system-node-critical
status: {}
{{ end -}}