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
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ require (
github.com/vincent-petithory/dataurl v0.0.0-20160330182126-9a301d65acbb
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
k8s.io/api v0.19.0
k8s.io/api v0.19.2
k8s.io/apiextensions-apiserver v0.19.0
k8s.io/apimachinery v0.19.0
k8s.io/apimachinery v0.19.2
k8s.io/client-go v0.19.0
k8s.io/code-generator v0.19.0
k8s.io/code-generator v0.19.2
k8s.io/kubectl v0.0.0-20201023045331-0a68e0d30fe9
k8s.io/kubelet v0.19.0
)
Expand All @@ -68,7 +68,7 @@ replace (
github.com/godbus/dbus => github.com/godbus/dbus v0.0.0-20190623212516-8a1682060722
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.4.1
github.com/opencontainers/runtime-spec => github.com/opencontainers/runtime-spec v0.1.2-0.20190408193819-a1b50f621a48
github.com/openshift/api => github.com/openshift/api v0.0.0-20200829102639-8a3a835f1acf
github.com/openshift/api => github.com/openshift/api v0.0.0-20201028190007-969b2d302160
github.com/openshift/cluster-api => github.com/openshift/cluster-api v0.0.0-20191129101638-b09907ac6668
github.com/securego/gosec => github.com/securego/gosec v0.0.0-20190709033609-4b59c948083c
k8s.io/api => k8s.io/api v0.19.0
Expand Down
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,11 @@ github.com/opencontainers/runtime-spec v0.1.2-0.20190408193819-a1b50f621a48 h1:7
github.com/opencontainers/runtime-spec v0.1.2-0.20190408193819-a1b50f621a48/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/opencontainers/selinux v1.5.2 h1:F6DgIsjgBIcDksLW4D5RG9bXok6oqZ3nvMwj4ZoFu/Q=
github.com/opencontainers/selinux v1.5.2/go.mod h1:yTcKuYAh6R95iDpefGLQaPaRwJFwyzAJufJyiTt7s0g=
github.com/openshift/api v0.0.0-20200829102639-8a3a835f1acf h1:KP/v5AGCaq1Sbe6QrlFGZM1fHBswiHuniMTC4/hgbVw=
github.com/openshift/api v0.0.0-20200829102639-8a3a835f1acf/go.mod h1:M3xexPhgM8DISzzRpuFUy+jfPjQPIcs9yqEYj17mXV8=
github.com/openshift/api v0.0.0-20201028190007-969b2d302160 h1:gZseakCZtiFHa0R4Uh6rIXSzlNtWeqj7RGAbmniWSpI=
github.com/openshift/api v0.0.0-20201028190007-969b2d302160/go.mod h1:RDvBcRQMGLa3aNuDuejVBbTEQj/2i14NXdpOLqbNBvM=
github.com/openshift/build-machinery-go v0.0.0-20200211121458-5e3d6e570160/go.mod h1:1CkcsT3aVebzRBzVTSbiKSkJMsC/CASqxesfqEMfJEc=
github.com/openshift/build-machinery-go v0.0.0-20200819073603-48aa266c95f7/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
github.com/openshift/build-machinery-go v0.0.0-20200917070002-f171684f77ab/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
github.com/openshift/client-go v0.0.0-20200827190008-3062137373b5 h1:E6WhVL5p3rfjtc+o+jVG/29Aclnf3XIF7akxXvadwR0=
github.com/openshift/client-go v0.0.0-20200827190008-3062137373b5/go.mod h1:5rGmrkQ8DJEUXA+AR3rEjfH+HFyg4/apY9iCQFgvPfE=
github.com/openshift/library-go v0.0.0-20191003152030-97c62d8a2901 h1:UQkY3zDJG4MMVzS7VFsyACxs/haMJ2aHNR/jXzWhScs=
Expand Down
22 changes: 21 additions & 1 deletion manifests/controllerconfig.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,34 @@ spec:
as a static pod to serve those hostnames to the nodes
in the cluster.
type: string
kubevirt:
description: OpenShift contains settings specific to the
kubevirt infrastructure provider.
type: object
properties:
apiServerInternalIP:
description: apiServerInternalIP is an IP address to
contact the Kubernetes API server that can be used
by components inside the cluster, like kubelets using
the infrastructure rather than Kubernetes networking.
It is the IP that the Infrastructure.status.apiServerInternalURI
points to. It is the IP for a self-hosted load balancer
in front of the API servers.
type: string
ingressIP:
description: ingressIP is an external IP which routes
to the default ingress controller. The IP is a suitable
target of a wildcard DNS record used to resolve default
route host names.
type: string
type:
description: type is the underlying infrastructure provider
for the cluster. This value controls whether infrastructure
automation such as service load balancers, dynamic volume
provisioning, machine creation and deletion, and other
integrations are enabled. If None, no infrastructure automation
is enabled. Allowed values are "AWS", "Azure", "BareMetal",
"GCP", "Libvirt", "OpenStack", "VSphere", "oVirt", and
"GCP", "Libvirt", "OpenStack", "VSphere", "oVirt", "KubeVirt" and
"None". Individual components may not support all platforms,
and must handle unrecognized platforms as None if they
do not support that platform.
Expand Down
12 changes: 9 additions & 3 deletions pkg/controller/template/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func platformStringFromControllerConfigSpec(ic *mcfgv1.ControllerConfigSpec) (st
return "", fmt.Errorf("cannot generate MachineConfigs when no platformStatus.type is set")
case platformBase:
return "", fmt.Errorf("platform _base unsupported")
case configv1.AWSPlatformType, configv1.AzurePlatformType, configv1.BareMetalPlatformType, configv1.GCPPlatformType, configv1.OpenStackPlatformType, configv1.LibvirtPlatformType, configv1.OvirtPlatformType, configv1.VSpherePlatformType, configv1.NonePlatformType:
case configv1.AWSPlatformType, configv1.AzurePlatformType, configv1.BareMetalPlatformType, configv1.GCPPlatformType, configv1.OpenStackPlatformType, configv1.LibvirtPlatformType, configv1.OvirtPlatformType, configv1.VSpherePlatformType, configv1.KubevirtPlatformType, configv1.NonePlatformType:
return strings.ToLower(string(ic.Infra.Status.PlatformStatus.Type)), nil
default:
// platformNone is used for a non-empty, but currently unsupported platform.
Expand Down Expand Up @@ -379,6 +379,8 @@ func onPremPlatformShortName(cfg RenderConfig) interface{} {
return "openstack"
case configv1.VSpherePlatformType:
return "vsphere"
case configv1.KubevirtPlatformType:
return "kubevirt"
default:
return ""
}
Expand All @@ -390,7 +392,7 @@ func onPremPlatformShortName(cfg RenderConfig) interface{} {
func onPremPlatformKeepalivedEnableUnicast(cfg RenderConfig) (interface{}, error) {
if cfg.Infra.Status.PlatformStatus != nil {
switch cfg.Infra.Status.PlatformStatus.Type {
case configv1.BareMetalPlatformType:
case configv1.BareMetalPlatformType, configv1.KubevirtPlatformType:
return "yes", nil
default:
return "no", nil
Expand All @@ -409,6 +411,8 @@ func onPremPlatformIngressIP(cfg RenderConfig) (interface{}, error) {
return cfg.Infra.Status.PlatformStatus.Ovirt.IngressIP, nil
case configv1.OpenStackPlatformType:
return cfg.Infra.Status.PlatformStatus.OpenStack.IngressIP, nil
case configv1.KubevirtPlatformType:
return cfg.Infra.Status.PlatformStatus.Kubevirt.IngressIP, nil
case configv1.VSpherePlatformType:
if cfg.Infra.Status.PlatformStatus.VSphere != nil {
return cfg.Infra.Status.PlatformStatus.VSphere.IngressIP, nil
Expand Down Expand Up @@ -440,6 +444,8 @@ func onPremPlatformAPIServerInternalIP(cfg RenderConfig) (interface{}, error) {
// VSphere UPI doesn't populate VSphere field. So it's not an error,
// and there is also no data
return nil, nil
case configv1.KubevirtPlatformType:
return cfg.Infra.Status.PlatformStatus.Kubevirt.APIServerInternalIP, nil
default:
return nil, fmt.Errorf("invalid platform for API Server Internal IP")
}
Expand All @@ -466,7 +472,7 @@ func existsDir(path string) (bool, error) {

func onPremPlatform(platformString configv1.PlatformType) bool {
switch platformString {
case configv1.BareMetalPlatformType, configv1.OvirtPlatformType, configv1.OpenStackPlatformType, configv1.VSpherePlatformType:
case configv1.BareMetalPlatformType, configv1.OvirtPlatformType, configv1.OpenStackPlatformType, configv1.VSpherePlatformType, configv1.KubevirtPlatformType:
return true
default:
return false
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/template/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func TestCloudProvider(t *testing.T) {
}, {
platform: configv1.LibvirtPlatformType,
res: "",
}, {
platform: configv1.KubevirtPlatformType,
res: "",
}, {
platform: configv1.NonePlatformType,
res: "",
Expand Down Expand Up @@ -197,6 +200,7 @@ var (
"libvirt": "./test_data/controller_config_libvirt.yaml",
"none": "./test_data/controller_config_none.yaml",
"vsphere": "./test_data/controller_config_vsphere.yaml",
"kubevirt": "./test_data/controller_config_kubevirt.yaml",
}
)

Expand Down
35 changes: 35 additions & 0 deletions pkg/controller/template/test_data/controller_config_kubevirt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: "machineconfigurations.openshift.io/v1"
kind: "ControllerConfig"
spec:
clusterDNSIP: "10.3.0.10"
cloudProviderConfig: |
testing
multi-line cloud config
[test]
option = dummy
etcdInitialCount: 3
etcdCAData: ZHVtbXkgZXRjZC1jYQo=
rootCAData: ZHVtbXkgcm9vdC1jYQo=
pullSecret:
data: ZHVtbXkgZXRjZC1jYQo=
images:
etcd: image/etcd:1
setupEtcdEnv: image/setupEtcdEnv:1
infraImage: image/infraImage:1
kubeClientAgentImage: image/kubeClientAgentImage:1
infra:
apiVersion: config.openshift.io/v1
kind: Infrastructure
status:
apiServerInternalURI: https://api-int.my-test-cluster.installer.team.coreos.systems:6443
apiServerURL: https://api.my-test-cluster.installer.team.coreos.systems:6443
etcdDiscoveryDomain: my-test-cluster.installer.team.coreos.systems
infrastructureName: my-test-cluster
platformStatus:
type: "KubeVirt"
kubevirt:
apiServerInternalIP: 10.0.0.1
ingressIP: 10.0.0.2
dns:
spec:
baseDomain: my-test-cluster.installer.team.coreos.systems
22 changes: 21 additions & 1 deletion pkg/operator/assets/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions pkg/operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,28 @@ func appendManifestsByPlatform(manifests []manifest, infra configv1.Infrastructu
},
)
}

if infra.Status.PlatformStatus.Kubevirt != nil {
manifests = append(manifests,
manifest{
name: "manifests/on-prem/coredns.yaml",
filename: "kubevirt/manifests/coredns.yaml",
},
manifest{
name: "manifests/on-prem/coredns-corefile.tmpl",
filename: "kubevirt/static-pod-resources/coredns/Corefile.tmpl",
},
manifest{
name: "manifests/on-prem/keepalived.yaml",
filename: "kubevirt/manifests/keepalived.yaml",
},
manifest{
name: "manifests/on-prem/keepalived.conf.tmpl",
filename: "kubevirt/static-pod-resources/keepalived/keepalived.conf.tmpl",
},
)
}

if infra.Status.PlatformStatus.VSphere != nil && infra.Status.PlatformStatus.VSphere.APIServerInternalIP != "" {
manifests = append(manifests,
manifest{
Expand Down
6 changes: 6 additions & 0 deletions pkg/operator/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ func onPremPlatformShortName(cfg mcfgv1.ControllerConfigSpec) interface{} {
return "openstack"
case configv1.VSpherePlatformType:
return "vsphere"
case configv1.KubevirtPlatformType:
return "kubevirt"
default:
return ""
}
Expand All @@ -190,6 +192,8 @@ func onPremPlatformIngressIP(cfg mcfgv1.ControllerConfigSpec) (interface{}, erro
return cfg.Infra.Status.PlatformStatus.OpenStack.IngressIP, nil
case configv1.VSpherePlatformType:
return cfg.Infra.Status.PlatformStatus.VSphere.IngressIP, nil
case configv1.KubevirtPlatformType:
return cfg.Infra.Status.PlatformStatus.Kubevirt.IngressIP, nil
default:
return nil, fmt.Errorf("invalid platform for Ingress IP")
}
Expand All @@ -209,6 +213,8 @@ func onPremPlatformAPIServerInternalIP(cfg mcfgv1.ControllerConfigSpec) (interfa
return cfg.Infra.Status.PlatformStatus.OpenStack.APIServerInternalIP, nil
case configv1.VSpherePlatformType:
return cfg.Infra.Status.PlatformStatus.VSphere.APIServerInternalIP, nil
case configv1.KubevirtPlatformType:
return cfg.Infra.Status.PlatformStatus.Kubevirt.APIServerInternalIP, nil
default:
return nil, fmt.Errorf("invalid platform for API Server Internal IP")
}
Expand Down
16 changes: 16 additions & 0 deletions templates/common/kubevirt/files/kubevirt-coredns-db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
mode: 0644
path: "/etc/coredns/node-dns-db"
contents:
inline: |
$ORIGIN {{ .Infra.Status.EtcdDiscoveryDomain }}.
@ 3600 IN SOA host.{{ .Infra.Status.EtcdDiscoveryDomain }}. hostmaster (
2017042752 ; serial
7200 ; refresh (2 hours)
3600 ; retry (1 hour)
1209600 ; expire (2 weeks)
3600 ; minimum (1 hour)
)
api-int IN A {{ .Infra.Status.PlatformStatus.Kubevirt.APIServerInternalIP }}
api IN A {{ .Infra.Status.PlatformStatus.Kubevirt.APIServerInternalIP }}

*.apps IN A {{ .Infra.Status.PlatformStatus.Kubevirt.IngressIP }}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading