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
12 changes: 12 additions & 0 deletions manifests/openstack/coredns-corefile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
. {
errors
health
mdns {{ .ControllerConfig.EtcdDiscoveryDomain }} {{`{{.Cluster.MasterAmount}}`}} {{`{{.Cluster.Name}}`}}
forward . {{`{{- range $upstream := .DNSUpstreams}} {{$upstream}}{{- end}}`}}
cache 30
reload
hosts /etc/coredns/api-int.hosts {{ .ControllerConfig.EtcdDiscoveryDomain }} {
{{ .ControllerConfig.Infra.Status.PlatformStatus.OpenStack.APIServerInternalIP }} api-int.{{ .ControllerConfig.EtcdDiscoveryDomain }} api.{{ .ControllerConfig.EtcdDiscoveryDomain }}
fallthrough
}
}
92 changes: 92 additions & 0 deletions manifests/openstack/coredns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
kind: Pod
apiVersion: v1
metadata:
name: coredns
namespace: openshift-kni-infra
creationTimestamp:
deletionGracePeriodSeconds: 65
labels:
app: kni-infra-mdns
spec:
volumes:
- name: resource-dir
hostPath:
path: "/etc/kubernetes/static-pod-resources/coredns"
- name: kubeconfig
hostPath:
path: "/etc/kubernetes/kubeconfig"
- name: conf-dir
empty-dir: {}
- name: manifests
hostPath:
path: "/opt/openshift/manifests"
initContainers:
- name: render-config
image: {{ .Images.BaremetalRuntimeCfgBootstrap }}
command:
- runtimecfg
- render
- "/etc/kubernetes/kubeconfig"
- "--api-vip"
- "{{ .ControllerConfig.Infra.Status.PlatformStatus.OpenStack.APIServerInternalIP }}"
- "--dns-vip"
- "{{ .ControllerConfig.Infra.Status.PlatformStatus.OpenStack.NodeDNSIP }}"
- "--ingress-vip"
- "{{ .ControllerConfig.Infra.Status.PlatformStatus.OpenStack.IngressIP }}"
- "/config"
- "--out-dir"
- "/etc/coredns"
- "--cluster-config"
- "/opt/openshift/manifests/cluster-config.yaml"
resources: {}
volumeMounts:
- name: kubeconfig
mountPath: "/etc/kubernetes/kubeconfig"
- name: resource-dir
mountPath: "/config"
- name: conf-dir
mountPath: "/etc/coredns"
- name: manifests
mountPath: "/opt/openshift/manifests"
imagePullPolicy: IfNotPresent
containers:
- name: coredns
securityContext:
privileged: true
image: {{ .Images.CorednsBootstrap }}
args:
- "--conf"
- "/etc/coredns/Corefile"
resources:
requests:
cpu: 150m
memory: 1Gi
volumeMounts:
- name: conf-dir
mountPath: "/etc/coredns"
readinessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 10
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 60
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5
terminationMessagePolicy: FallbackToLogsOnError
hostNetwork: true
tolerations:
- operator: Exists
priorityClassName: system-node-critical
status: {}
35 changes: 35 additions & 0 deletions manifests/openstack/keepalived.conf.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Configuration template for Keepalived, which is used to manage the DNS and
# API VIPs.
#
# For more information, see installer/data/data/bootstrap/baremetal/README.md
# in the installer repo.

vrrp_instance {{`{{.Cluster.Name}}`}}_API {
state BACKUP
interface {{`{{.VRRPInterface}}`}}
virtual_router_id {{`{{.Cluster.APIVirtualRouterID }}`}}
priority 50
advert_int 1
authentication {
auth_type PASS
auth_pass {{`{{.Cluster.Name}}`}}_api_vip
}
virtual_ipaddress {
{{`{{ .Cluster.APIVIP }}`}}/{{`{{ .Cluster.VIPNetmask }}`}}
}
}

vrrp_instance {{`{{.Cluster.Name}}`}}_DNS {
state MASTER
interface {{`{{.VRRPInterface}}`}}
virtual_router_id {{`{{.Cluster.DNSVirtualRouterID }}`}}
priority 140
advert_int 1
authentication {
auth_type PASS
auth_pass {{`{{.Cluster.Name}}`}}_dns_vip
}
virtual_ipaddress {
{{`{{ .Cluster.DNSVIP }}`}}/{{`{{ .Cluster.VIPNetmask }}`}}
}
}
73 changes: 73 additions & 0 deletions manifests/openstack/keepalived.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
kind: Pod
apiVersion: v1
metadata:
name: keepalived
namespace: openshift-kni-infra
creationTimestamp:
deletionGracePeriodSeconds: 65
labels:
app: kni-infra-vrrp
spec:
volumes:
- name: resource-dir
hostPath:
path: "/etc/kubernetes/static-pod-resources/keepalived"
- name: kubeconfig
hostPath:
path: "/etc/kubernetes/kubeconfig"
- name: conf-dir
empty-dir: {}
initContainers:
- name: render-config
image: {{ .Images.BaremetalRuntimeCfgBootstrap }}
command:
- runtimecfg
- render
- "/etc/kubernetes/kubeconfig"
- "--api-vip"
- "{{ .ControllerConfig.Infra.Status.PlatformStatus.OpenStack.APIServerInternalIP }}"
- "--dns-vip"
- "{{ .ControllerConfig.Infra.Status.PlatformStatus.OpenStack.NodeDNSIP }}"
- "--ingress-vip"
- "{{ .ControllerConfig.Infra.Status.PlatformStatus.OpenStack.IngressIP }}"
- "/config"
- "--out-dir"
- "/etc/keepalived"
resources: {}
volumeMounts:
- name: resource-dir
mountPath: "/config"
- name: kubeconfig
mountPath: "/etc/kubernetes/kubeconfig"
- name: conf-dir
mountPath: "/etc/keepalived"
imagePullPolicy: IfNotPresent
containers:
- name: keepalived
securityContext:
privileged: true
image: {{ .Images.KeepalivedBootstrap }}
command:
- /usr/sbin/keepalived
args:
- "-f"
- "/etc/keepalived/keepalived.conf"
- "--dont-fork"
- "--vrrp"
- "--log-detail"
- "--log-console"
resources:
requests:
cpu: 150m
memory: 1Gi
volumeMounts:
- name: conf-dir
mountPath: "/etc/keepalived"
terminationMessagePolicy: FallbackToLogsOnError
imagePullPolicy: IfNotPresent
hostNetwork: true
tolerations:
- operator: Exists
priorityClassName: system-node-critical
status: {}
10 changes: 10 additions & 0 deletions pkg/controller/template/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ func generateMachineConfigForName(config *RenderConfig, role, name, templateDir,
platformDirs := []string{}
// Loop over templates/common which applies everywhere
for _, dir := range []string{platformBase, platform} {
// Bypass OpenStack template rendering until
// https://github.com/openshift/installer/pull/1959 merges
Copy link
Member

Choose a reason for hiding this comment

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

Hum...so if I understand this correctly, this PR is adding all of the code, and then we need to get the installer PR in first, then we'll do a PR to drop these conditionals?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes that's the intention. The installer PR depends on the changes there, but this PR depends on the changes in the installer PR so this let's us break that cycle.

The conditionals are isolated in a single commit we can revert afterwards.

if dir == platformOpenStack && config.ControllerConfigSpec.Infra.Status.PlatformStatus.OpenStack == nil {
continue
}
basePath := filepath.Join(templateDir, "common", dir)
exists, err := existsDir(basePath)
if err != nil {
Expand All @@ -192,6 +197,11 @@ func generateMachineConfigForName(config *RenderConfig, role, name, templateDir,
}
// And now over the target e.g. templates/master
for _, dir := range []string{platformBase, platform} {
// Bypass OpenStack template rendering until
// https://github.com/openshift/installer/pull/1959 merges
if dir == platformOpenStack && config.ControllerConfigSpec.Infra.Status.PlatformStatus.OpenStack == nil {
continue
}
platformPath := filepath.Join(path, dir)
exists, err := existsDir(platformPath)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ spec:
setupEtcdEnv: image/setupEtcdEnv:1
infraImage: image/infraImage:1
kubeClientAgentImage: image/kubeClientAgentImage:1
infra:
status:
platformStatus:
openstack:
apiServerInternalIP: 10.0.0.1
ingressIP: 10.0.0.2
nodeDNSIP: 10.0.0.3
Loading