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: 8 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ aliases:
- Prashanth684
- clnperez
- mkumatag
nutanix-approvers:
- thunderboltsid
- yanhua121
- adiantum
nutanix-reviewers:
- thunderboltsid
- yanhua121
- adiantum
13 changes: 13 additions & 0 deletions install/0000_80_machine-config-operator_00_namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,16 @@ metadata:
workload.openshift.io/allowed: "management"
labels:
name: openshift-vsphere-infra
---
apiVersion: v1
kind: Namespace
metadata:
name: openshift-nutanix-infra
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
openshift.io/node-selector: ""
workload.openshift.io/allowed: "management"
labels:
name: openshift-nutanix-infra

35 changes: 33 additions & 2 deletions manifests/controllerconfig.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ spec:
description: Kubevirt contains settings specific to the
kubevirt infrastructure provider.
type: object
nutanix:
description:
Nutanix contains settings specific to the Nutanix
infrastructure provider.
type: object
openstack:
description: OpenStack contains settings specific to the
OpenStack infrastructure provider.
Expand All @@ -290,7 +295,7 @@ spec:
integrations are enabled. If None, no infrastructure
automation is enabled. Allowed values are "AlibabaCloud", "AWS",
"Azure", "BareMetal", "GCP", "Libvirt", "OpenStack", "VSphere",
"oVirt", "KubeVirt", "EquinixMetal", "PowerVS" and "None".
"oVirt", "KubeVirt", "EquinixMetal", "PowerVS", "Nutanix" and "None".
Individual components may not support all platforms, and must handle
unrecognized platforms as None if they do not support
that platform.
Expand All @@ -310,6 +315,7 @@ spec:
- KubeVirt
- EquinixMetal
- PowerVS
- Nutanix
type: string
vsphere:
description: VSphere contains settings specific to the
Expand Down Expand Up @@ -398,6 +404,7 @@ spec:
- KubeVirt
- EquinixMetal
- PowerVS
- Nutanix
type: string
platformStatus:
description: platformStatus holds status information specific
Expand Down Expand Up @@ -708,6 +715,29 @@ spec:
a future release.'
type: string
type: object
nutanix:
description:
Nutanix contains settings specific to the
Nutanix infrastructure provider.
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: object
powervs:
description: PowerVS contains settings specific to the
Power Systems Virtual Servers infrastructure provider.
Expand Down Expand Up @@ -762,7 +792,7 @@ spec:
integrations are enabled. If None, no infrastructure
automation is enabled. Allowed values are \"AlibabaCloud\",
\"AWS\", \"Azure\", \"BareMetal\", \"GCP\", \"Libvirt\",
\"OpenStack\", \"VSphere\", \"oVirt\", \"EquinixMetal\", \"PowerVS\"
\"OpenStack\", \"VSphere\", \"oVirt\", \"EquinixMetal\", \"PowerVS\", \"Nutanix\"
and \"None\". Individual components may not support all platforms,
and must handle unrecognized platforms as None if they
do not support that platform. \n This value will be
Expand All @@ -784,6 +814,7 @@ spec:
- KubeVirt
- EquinixMetal
- PowerVS
- Nutanix
type: string
vsphere:
description: VSphere contains settings specific to the
Expand Down
14 changes: 11 additions & 3 deletions pkg/controller/template/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,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.AlibabaCloudPlatformType, configv1.AzurePlatformType, configv1.BareMetalPlatformType, configv1.GCPPlatformType, configv1.OpenStackPlatformType, configv1.LibvirtPlatformType, configv1.OvirtPlatformType, configv1.VSpherePlatformType, configv1.KubevirtPlatformType, configv1.PowerVSPlatformType, configv1.NonePlatformType:
case configv1.AWSPlatformType, configv1.AlibabaCloudPlatformType, configv1.AzurePlatformType, configv1.BareMetalPlatformType, configv1.GCPPlatformType, configv1.OpenStackPlatformType, configv1.LibvirtPlatformType, configv1.OvirtPlatformType, configv1.VSpherePlatformType, configv1.KubevirtPlatformType, configv1.PowerVSPlatformType, configv1.NonePlatformType, configv1.NutanixPlatformType:
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 @@ -350,7 +350,7 @@ func cloudProvider(cfg RenderConfig) (interface{}, error) {
}

switch cfg.Infra.Status.PlatformStatus.Type {
case configv1.AWSPlatformType, configv1.AzurePlatformType, configv1.OpenStackPlatformType, configv1.VSpherePlatformType:
case configv1.AWSPlatformType, configv1.AzurePlatformType, configv1.OpenStackPlatformType, configv1.VSpherePlatformType, configv1.NutanixPlatformType:
return strings.ToLower(string(cfg.Infra.Status.PlatformStatus.Type)), nil
case configv1.GCPPlatformType:
return "gce", nil
Expand Down Expand Up @@ -416,6 +416,8 @@ func onPremPlatformShortName(cfg RenderConfig) interface{} {
return "vsphere"
case configv1.KubevirtPlatformType:
return "kubevirt"
case configv1.NutanixPlatformType:
return "nutanix"
default:
return ""
}
Expand All @@ -437,6 +439,7 @@ func onPremPlatformKeepalivedEnableUnicast(cfg RenderConfig) (interface{}, error
}
}

//nolint:dupl
func onPremPlatformIngressIP(cfg RenderConfig) (interface{}, error) {
if cfg.Infra.Status.PlatformStatus != nil {
switch cfg.Infra.Status.PlatformStatus.Type {
Expand All @@ -455,6 +458,8 @@ func onPremPlatformIngressIP(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.NutanixPlatformType:
return cfg.Infra.Status.PlatformStatus.Nutanix.IngressIP, nil
default:
return nil, fmt.Errorf("invalid platform for Ingress IP")
}
Expand All @@ -463,6 +468,7 @@ func onPremPlatformIngressIP(cfg RenderConfig) (interface{}, error) {
}
}

//nolint:dupl
func onPremPlatformAPIServerInternalIP(cfg RenderConfig) (interface{}, error) {
if cfg.Infra.Status.PlatformStatus != nil {
switch cfg.Infra.Status.PlatformStatus.Type {
Expand All @@ -481,6 +487,8 @@ func onPremPlatformAPIServerInternalIP(cfg RenderConfig) (interface{}, error) {
return nil, nil
case configv1.KubevirtPlatformType:
return cfg.Infra.Status.PlatformStatus.Kubevirt.APIServerInternalIP, nil
case configv1.NutanixPlatformType:
return cfg.Infra.Status.PlatformStatus.Nutanix.APIServerInternalIP, nil
default:
return nil, fmt.Errorf("invalid platform for API Server Internal IP")
}
Expand All @@ -507,7 +515,7 @@ func existsDir(path string) (bool, error) {

func onPremPlatform(platformString configv1.PlatformType) bool {
switch platformString {
case configv1.BareMetalPlatformType, configv1.OvirtPlatformType, configv1.OpenStackPlatformType, configv1.VSpherePlatformType, configv1.KubevirtPlatformType:
case configv1.BareMetalPlatformType, configv1.OvirtPlatformType, configv1.OpenStackPlatformType, configv1.VSpherePlatformType, configv1.KubevirtPlatformType, configv1.NutanixPlatformType:
return true
default:
return false
Expand Down
24 changes: 24 additions & 0 deletions pkg/controller/template/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func TestCloudProvider(t *testing.T) {
platform: configv1.OpenStackPlatformType,
featureGate: newFeatures("cluster", "CustomNoUpgrade", nil, []string{cloudprovider.ExternalCloudProviderFeature}),
res: "openstack",
}, {
platform: configv1.NutanixPlatformType,
featureGate: newFeatures("cluster", "CustomNoUpgrade", nil, []string{cloudprovider.ExternalCloudProviderFeature}),
res: "nutanix",
}, {
platform: configv1.AWSPlatformType,
res: "aws",
Expand Down Expand Up @@ -89,6 +93,9 @@ func TestCloudProvider(t *testing.T) {
}, {
platform: configv1.AlibabaCloudPlatformType,
res: "external",
}, {
platform: configv1.NutanixPlatformType,
res: "nutanix",
}}
for idx, c := range cases {
name := fmt.Sprintf("case #%d", idx)
Expand Down Expand Up @@ -213,6 +220,22 @@ func TestCloudConfigFlag(t *testing.T) {
`,
featureGate: newFeatures("cluster", "CustomNoUpgrade", nil, []string{cloudprovider.ExternalCloudProviderFeature}),
res: "--cloud-config=/etc/kubernetes/cloud.conf",
}, {
platform: configv1.NutanixPlatformType,
content: `
[dummy-config]
option = a
`,
featureGate: newFeatures("cluster", "CustomNoUpgrade", []string{cloudprovider.ExternalCloudProviderFeature}, nil),
res: "",
}, {
platform: configv1.NutanixPlatformType,
content: `
[dummy-config]
option = a
`,
featureGate: newFeatures("cluster", "CustomNoUpgrade", nil, []string{cloudprovider.ExternalCloudProviderFeature}),
res: "",
}}

for idx, c := range cases {
Expand Down Expand Up @@ -300,6 +323,7 @@ var (
"vsphere": "./test_data/controller_config_vsphere.yaml",
"kubevirt": "./test_data/controller_config_kubevirt.yaml",
"powervs": "./test_data/controller_config_powervs.yaml",
"nutanix": "./test_data/controller_config_nutanix.yaml",
}
)

Expand Down
36 changes: 36 additions & 0 deletions pkg/controller/template/test_data/controller_config_nutanix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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: "Nutanix"
nutanix:
apiServerInternalIP: 10.0.0.1
ingressIP: 10.0.0.2
nodeDNSIP: 10.0.0.3
dns:
spec:
baseDomain: my-test-cluster.installer.team.coreos.systems
21 changes: 21 additions & 0 deletions pkg/operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,27 @@ func appendManifestsByPlatform(manifests []manifest, infra configv1.Infrastructu
)
}

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

return manifests
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/operator/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ func onPremPlatformShortName(cfg mcfgv1.ControllerConfigSpec) interface{} {
return "vsphere"
case configv1.KubevirtPlatformType:
return "kubevirt"
case configv1.NutanixPlatformType:
return "nutanix"
default:
return ""
}
Expand All @@ -255,6 +257,7 @@ func onPremPlatformKeepalivedEnableUnicast(cfg mcfgv1.ControllerConfigSpec) (int
}
}

//nolint:dupl
func onPremPlatformIngressIP(cfg mcfgv1.ControllerConfigSpec) (interface{}, error) {
if cfg.Infra.Status.PlatformStatus != nil {
switch cfg.Infra.Status.PlatformStatus.Type {
Expand All @@ -268,6 +271,8 @@ func onPremPlatformIngressIP(cfg mcfgv1.ControllerConfigSpec) (interface{}, erro
return cfg.Infra.Status.PlatformStatus.VSphere.IngressIP, nil
case configv1.KubevirtPlatformType:
return cfg.Infra.Status.PlatformStatus.Kubevirt.IngressIP, nil
case configv1.NutanixPlatformType:
return cfg.Infra.Status.PlatformStatus.Nutanix.IngressIP, nil
default:
return nil, fmt.Errorf("invalid platform for Ingress IP")
}
Expand All @@ -276,6 +281,7 @@ func onPremPlatformIngressIP(cfg mcfgv1.ControllerConfigSpec) (interface{}, erro
}
}

//nolint:dupl
func onPremPlatformAPIServerInternalIP(cfg mcfgv1.ControllerConfigSpec) (interface{}, error) {
if cfg.Infra.Status.PlatformStatus != nil {
switch cfg.Infra.Status.PlatformStatus.Type {
Expand All @@ -289,6 +295,8 @@ func onPremPlatformAPIServerInternalIP(cfg mcfgv1.ControllerConfigSpec) (interfa
return cfg.Infra.Status.PlatformStatus.VSphere.APIServerInternalIP, nil
case configv1.KubevirtPlatformType:
return cfg.Infra.Status.PlatformStatus.Kubevirt.APIServerInternalIP, nil
case configv1.NutanixPlatformType:
return cfg.Infra.Status.PlatformStatus.Nutanix.APIServerInternalIP, nil
default:
return nil, fmt.Errorf("invalid platform for API Server Internal IP")
}
Expand Down
1 change: 1 addition & 0 deletions pkg/operator/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func (optr *Operator) syncRelatedObjects() error {
{Resource: "namespaces", Name: "openshift-openstack-infra"},
{Resource: "namespaces", Name: "openshift-ovirt-infra"},
{Resource: "namespaces", Name: "openshift-vsphere-infra"},
{Resource: "namespaces", Name: "openshift-nutanix-infra"},
}

if !equality.Semantic.DeepEqual(coCopy.Status.RelatedObjects, co.Status.RelatedObjects) {
Expand Down