Skip to content

Commit

Permalink
ovirt: Add ovirt platform
Browse files Browse the repository at this point in the history
oVirt is similar to baremetal platform, and needs the network setup
which is described in this doc https://github.com/openshift/installer/blob/master/docs/design/baremetal/networking-infrastructure.md

Fixes: #766
Signed-off-by: Roy Golan <rgolan@redhat.com>
  • Loading branch information
rgolangh committed Oct 17, 2019
1 parent 18c9e83 commit d3d4e5f
Show file tree
Hide file tree
Showing 24 changed files with 1,364 additions and 1 deletion.
12 changes: 12 additions & 0 deletions manifests/ovirt/coredns-corefile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
. {
errors
health :18080
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.Ovirt.APIServerInternalIP }} api-int.{{ .ControllerConfig.EtcdDiscoveryDomain }} api.{{ .ControllerConfig.EtcdDiscoveryDomain }}
fallthrough
}
}
88 changes: 88 additions & 0 deletions manifests/ovirt/coredns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
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.Ovirt.APIServerInternalIP }}"
- "--dns-vip"
- "{{ .ControllerConfig.Infra.Status.PlatformStatus.Ovirt.NodeDNSIP }}"
- "--ingress-vip"
- "{{ .ControllerConfig.Infra.Status.PlatformStatus.Ovirt.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"
volumeMounts:
- name: conf-dir
mountPath: "/etc/coredns"
readinessProbe:
httpGet:
path: /health
port: 18080
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 10
livenessProbe:
httpGet:
path: /health
port: 18080
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/ovirt/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 }}`}}
}
}
79 changes: 79 additions & 0 deletions manifests/ovirt/keepalived.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
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: {}
- 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.Ovirt.APIServerInternalIP }}"
- "--dns-vip"
- "{{ .ControllerConfig.Infra.Status.PlatformStatus.Ovirt.NodeDNSIP }}"
- "--ingress-vip"
- "{{ .ControllerConfig.Infra.Status.PlatformStatus.Ovirt.IngressIP }}"
- "/config"
- "--out-dir"
- "/etc/keepalived"
- "--cluster-config"
- "/opt/openshift/manifests/cluster-config.yaml"
resources: {}
volumeMounts:
- name: resource-dir
mountPath: "/config"
- name: kubeconfig
mountPath: "/etc/kubernetes/kubeconfig"
- name: conf-dir
mountPath: "/etc/keepalived"
- name: manifests
mountPath: "/opt/openshift/manifests"
imagePullPolicy: IfNotPresent
containers:
- name: keepalived
securityContext:
privileged: true
image: {{ .Images.KeepalivedBootstrap }}
env:
- name: NSS_SDB_USE_CACHE
value: "no"
command:
- /usr/sbin/keepalived
args:
- "-f"
- "/etc/keepalived/keepalived.conf"
- "--dont-fork"
- "--vrrp"
- "--log-detail"
- "--log-console"
volumeMounts:
- name: conf-dir
mountPath: "/etc/keepalived"
terminationMessagePolicy: FallbackToLogsOnError
imagePullPolicy: IfNotPresent
hostNetwork: true
tolerations:
- operator: Exists
priorityClassName: system-node-critical
status: {}
3 changes: 2 additions & 1 deletion pkg/controller/template/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const (
platformNone = "none"
platformVSphere = "vsphere"
platformBase = "_base"
platformOvirt = "ovirt"
)

// generateTemplateMachineConfigs returns MachineConfig objects from the templateDir and a config object
Expand Down Expand Up @@ -128,7 +129,7 @@ func platformFromControllerConfigSpec(ic *mcfgv1.ControllerConfigSpec) (string,
return "", fmt.Errorf("cannot generate MachineConfigs when no platform is set")
case platformBase:
return "", fmt.Errorf("platform _base unsupported")
case platformAWS, platformAzure, platformBaremetal, platformGCP, platformOpenStack, platformLibvirt, platformNone:
case platformAWS, platformAzure, platformBaremetal, platformGCP, platformOpenStack, platformLibvirt, platformOvirt, platformNone:
return ic.Platform, nil
default:
// platformNone is used for a non-empty, but currently unsupported platform.
Expand Down
21 changes: 21 additions & 0 deletions pkg/controller/template/test_data/controller_config_ovirt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: "machineconfigurations.openshift.io/v1"
kind: "ControllerConfig"
spec:
clusterDNSIP: "10.3.0.10"
cloudProviderConfig: |
testing
multi-line cloud config
[test]
option = dummy
etcdDiscoveryDomain: "my-test-cluster.example.org"
etcdInitialCount: 3
platform: "ovirt"
etcdCAData: OHVtbXkgZXRjZC1jYQo=
rootCAData: OHVtbXkgcm9vdC1jYQo=
pullSecret:
data: OHVtbXkgZXRjZC1jYQo=
images:
etcd: image/etcd:1
setupEtcdEnv: image/setupEtcdEnv:1
infraImage: image/infraImage:1
kubeClientAgentImage: image/kubeClientAgentImage:1
Loading

0 comments on commit d3d4e5f

Please sign in to comment.