Skip to content

Commit

Permalink
"External" platform type
Browse files Browse the repository at this point in the history
  • Loading branch information
lobziik committed Dec 7, 2022
1 parent f2fbb1d commit 4264c92
Show file tree
Hide file tree
Showing 9 changed files with 297 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,27 @@ spec:
equinixMetal:
description: EquinixMetal contains settings specific to the Equinix Metal infrastructure provider.
type: object
external:
description: ExternalPlatformType represent generic infrastructure provider. Provider-specific components should be supplemented separately.
type: object
properties:
cloudControllerManager:
description: CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI)
type: object
properties:
state:
description: "State determines whether or not an external Cloud Controller Manager is expected to be presented in the cluster. For engaging an external Cloud Controller Manager, certain flags are expected to be set to the kubelets. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager \n When set to \"External\", the respective operator (machine config operator) should set `--cloud-provider=external` flag to the kubelet. When omitted or disabled, no `cloud-provider` flag should be set."
type: string
enum:
- External
- None
providerName:
description: ProviderName holds the arbitrary string represented cloud provider name, expected to be set at the installation time. Intended to serve only for informational purposes and not expected to be used for decision-making.
type: string
default: Unknown
x-kubernetes-validations:
- rule: oldSelf == 'Unknown' || self == oldSelf
message: provider name cannot be changed once set
gcp:
description: GCP contains settings specific to the Google Cloud Platform infrastructure provider.
type: object
Expand Down Expand Up @@ -200,6 +221,7 @@ spec:
- PowerVS
- AlibabaCloud
- Nutanix
- External
vsphere:
description: VSphere contains settings specific to the VSphere infrastructure provider.
type: object
Expand Down Expand Up @@ -254,6 +276,7 @@ spec:
- PowerVS
- AlibabaCloud
- Nutanix
- External
platformStatus:
description: platformStatus holds status information specific to the underlying infrastructure provider.
type: object
Expand Down Expand Up @@ -401,6 +424,9 @@ spec:
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
external:
description: External contains settings specific to the generic External infrastructure provider.
type: object
gcp:
description: GCP contains settings specific to the Google Cloud Platform infrastructure provider.
type: object
Expand Down Expand Up @@ -576,6 +602,7 @@ spec:
- PowerVS
- AlibabaCloud
- Nutanix
- External
vsphere:
description: VSphere contains settings specific to the VSphere infrastructure provider.
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,27 @@ spec:
equinixMetal:
description: EquinixMetal contains settings specific to the Equinix Metal infrastructure provider.
type: object
external:
description: ExternalPlatformType represent generic infrastructure provider. Provider-specific components should be supplemented separately.
properties:
cloudControllerManager:
description: CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI)
properties:
state:
description: "State determines whether or not an external Cloud Controller Manager is expected to be presented in the cluster. For engaging an external Cloud Controller Manager, certain flags are expected to be set to the kubelets. https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager \n When set to \"External\", the respective operator (machine config operator) should set `--cloud-provider=external` flag to the kubelet. When omitted or disabled, no `cloud-provider` flag should be set."
enum:
- External
- None
type: string
type: object
providerName:
default: Unknown
description: ProviderName holds the arbitrary string represented cloud provider name, expected to be set at the installation time. Intended to serve only for informational purposes and not expected to be used for decision-making.
type: string
x-kubernetes-validations:
- message: provider name cannot be changed once set
rule: oldSelf == 'Unknown' || self == oldSelf
type: object
gcp:
description: GCP contains settings specific to the Google Cloud Platform infrastructure provider.
type: object
Expand Down Expand Up @@ -194,6 +215,7 @@ spec:
- PowerVS
- AlibabaCloud
- Nutanix
- External
type: string
vsphere:
description: VSphere contains settings specific to the VSphere infrastructure provider.
Expand Down Expand Up @@ -401,6 +423,7 @@ spec:
- PowerVS
- AlibabaCloud
- Nutanix
- External
type: string
platformStatus:
description: platformStatus holds status information specific to the underlying infrastructure provider.
Expand Down Expand Up @@ -548,6 +571,9 @@ spec:
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
external:
description: External contains settings specific to the generic External infrastructure provider.
type: object
gcp:
description: GCP contains settings specific to the Google Cloud Platform infrastructure provider.
properties:
Expand Down Expand Up @@ -722,6 +748,7 @@ spec:
- PowerVS
- AlibabaCloud
- Nutanix
- External
type: string
vsphere:
description: VSphere contains settings specific to the VSphere infrastructure provider.
Expand Down
1 change: 1 addition & 0 deletions config/v1/0000_10_config-operator_01_ingress.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ spec:
- PowerVS
- AlibabaCloud
- Nutanix
- External
requiredHSTSPolicies:
description: "requiredHSTSPolicies specifies HSTS policies that are required to be set on newly created or updated routes matching the domainPattern/s and namespaceSelector/s that are specified in the policy. Each requiredHSTSPolicy must have at least a domainPattern and a maxAge to validate a route HSTS Policy route annotation, and affect route admission. \n A candidate route is checked for HSTS Policies if it has the HSTS Policy route annotation: \"haproxy.router.openshift.io/hsts_header\" E.g. haproxy.router.openshift.io/hsts_header: max-age=31536000;preload;includeSubDomains \n - For each candidate route, if it matches a requiredHSTSPolicy domainPattern and optional namespaceSelector, then the maxAge, preloadPolicy, and includeSubdomainsPolicy must be valid to be admitted. Otherwise, the route is rejected. - The first match, by domainPattern and optional namespaceSelector, in the ordering of the RequiredHSTSPolicies determines the route's admission status. - If the candidate route doesn't match any requiredHSTSPolicy domainPattern and optional namespaceSelector, then it may use any HSTS Policy annotation. \n The HSTS policy configuration may be changed after routes have already been created. An update to a previously admitted route may then fail if the updated route does not conform to the updated HSTS policy configuration. However, changing the HSTS policy configuration will not cause a route that is already admitted to stop working. \n Note that if there are no RequiredHSTSPolicies, any HSTS Policy annotation on the route is valid."
type: array
Expand Down
44 changes: 44 additions & 0 deletions config/v1/stable.infrastructure.testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,47 @@ tests:
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
onUpdate:
- name: Should be able to change External ProviderName from unknown to something else
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: External
external:
providerName: Unknown
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: External
external:
providerName: M&PCloud
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: External
external:
providerName: M&PCloud
- name: Should not be able to change External ProviderName once it was set
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: External
external:
providerName: M&PCloud
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec:
platformSpec:
type: External
external:
providerName: SomeOtherCoolProviderName
expectedError: " spec.platformSpec.external.providerName: Invalid value: \"string\": provider name cannot be changed once set"
56 changes: 55 additions & 1 deletion config/v1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const (
)

// PlatformType is a specific supported infrastructure provider.
// +kubebuilder:validation:Enum="";AWS;Azure;BareMetal;GCP;Libvirt;OpenStack;None;VSphere;oVirt;IBMCloud;KubeVirt;EquinixMetal;PowerVS;AlibabaCloud;Nutanix
// +kubebuilder:validation:Enum="";AWS;Azure;BareMetal;GCP;Libvirt;OpenStack;None;VSphere;oVirt;IBMCloud;KubeVirt;EquinixMetal;PowerVS;AlibabaCloud;Nutanix;External
type PlatformType string

const (
Expand Down Expand Up @@ -172,6 +172,9 @@ const (

// NutanixPlatformType represents Nutanix infrastructure.
NutanixPlatformType PlatformType = "Nutanix"

// ExternalPlatformType represent generic infrastructure provider. Provider-specific components should be supplemented separately.
ExternalPlatformType PlatformType = "External"
)

// IBMCloudProviderType is a specific supported IBM Cloud provider cluster type
Expand All @@ -189,6 +192,45 @@ const (
IBMCloudProviderTypeUPI IBMCloudProviderType = "UPI"
)

type CloudControllerManagerState string

const (
// Cloud Controller Manager is enabled and expected to be supplied.
// Signaling that kubelets and other CCM consumers should use --cloud-provider=external.
CloudControllerManagerExternal CloudControllerManagerState = "External"

// Cloud Controller Manager is enabled and expected to be supplied.
// Signaling that kubelets and other CCM consumers should not set --cloud-provider flag.
CloudControllerManagerNone CloudControllerManagerState = "None"
)

type CloudControllerManagerSettings struct {
// State determines whether or not an external Cloud Controller Manager is expected to
// be presented in the cluster.
// For engaging an external Cloud Controller Manager, certain flags are expected to be set to the kubelets.
// https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/#running-cloud-controller-manager
//
// When set to "External", the respective operator (machine config operator) should set `--cloud-provider=external` flag to the kubelet.
// When omitted or disabled, no `cloud-provider` flag should be set.
// +kubebuilder:validation:Enum=External;None
// +optional
State CloudControllerManagerState `json:"state,omitempty"`
}

// ExternalPlatformSpec holds the desired state for the generic External infrastructure provider.
type ExternalPlatformSpec struct {
// ProviderName holds the arbitrary string represented cloud provider name, expected to be set at the installation time.
// Intended to serve only for informational purposes and not expected to be used for decision-making.
// +kubebuilder:default:="Unknown"
// +default="Unknown"
// +kubebuilder:validation:XValidation:rule="oldSelf == 'Unknown' || self == oldSelf",message="provider name cannot be changed once set"
// +optional
ProviderName string `json:"providerName,omitempty"`
// CloudControllerManager contains settings specific to the external Cloud Controller Manager (a.k.a. CCM or CPI)
// +optional
CloudControllerManager CloudControllerManagerSettings `json:"cloudControllerManager"`
}

// PlatformSpec holds the desired state specific to the underlying infrastructure provider
// of the current cluster. Since these are used at spec-level for the underlying cluster, it
// is supposed that only one of the spec structs is set.
Expand Down Expand Up @@ -256,8 +298,16 @@ type PlatformSpec struct {
// Nutanix contains settings specific to the Nutanix infrastructure provider.
// +optional
Nutanix *NutanixPlatformSpec `json:"nutanix,omitempty"`

// ExternalPlatformType represent generic infrastructure provider.
// Provider-specific components should be supplemented separately.
// +optional
External *ExternalPlatformSpec `json:"external,omitempty"`
}

// ExternalPlatformStatus holds the current status of the generic External infrastructure provider.
type ExternalPlatformStatus struct{}

// PlatformStatus holds the current status specific to the underlying infrastructure provider
// of the current cluster. Since these are used at status-level for the underlying cluster, it
// is supposed that only one of the status structs is set.
Expand Down Expand Up @@ -326,6 +376,10 @@ type PlatformStatus struct {
// Nutanix contains settings specific to the Nutanix infrastructure provider.
// +optional
Nutanix *NutanixPlatformStatus `json:"nutanix,omitempty"`

// External contains settings specific to the generic External infrastructure provider.
// +optional
External *ExternalPlatformStatus `json:"external,omitempty"`
}

// AWSServiceEndpoint store the configuration of a custom url to
Expand Down
28 changes: 28 additions & 0 deletions config/v1/zz_generated.swagger_doc_generated.go

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

1 change: 1 addition & 0 deletions machine/v1/0000_10_controlplanemachineset.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ spec:
- PowerVS
- AlibabaCloud
- Nutanix
- External
x-kubernetes-validations:
- rule: 'has(self.platform) && self.platform == ''AWS'' ? has(self.aws) : !has(self.aws)'
message: aws configuration is required when platform is AWS, and forbidden otherwise
Expand Down

0 comments on commit 4264c92

Please sign in to comment.