Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve cluster template for clusterclass #33

Merged
merged 1 commit into from
Nov 10, 2023
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
11 changes: 7 additions & 4 deletions api/v1alpha1/ionoscloudcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,13 @@ type IONOSCloudClusterSpec struct {
Location Location `json:"location"`

// +kubebuilder:validation:MinLength=1
IdentityName string `json:"identityName"`
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
Lans []IONOSLanSpec `json:"lans,omitempty"`
LoadBalancer *IONOSLoadBalancerSpec `json:"loadBalancer,omitempty"`
IdentityName string `json:"identityName"`
// +optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
// +optional
Lans []IONOSLanSpec `json:"lans,omitempty"`
// +optional
LoadBalancer *IONOSLoadBalancerSpec `json:"loadBalancer,omitempty"`

// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="DataCenterID is immutable"
DataCenterID string `json:"dataCenterID,omitempty"`
Expand Down
7 changes: 1 addition & 6 deletions api/v1alpha1/ionoscloudclustertemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ type IONOSCloudClusterTemplateSpec struct {
}

type IONOSCloudClusterTemplateResource struct {
Spec IONOSCloudClusterTemplateClusterSpec `json:"spec"`
}

type IONOSCloudClusterTemplateClusterSpec struct {
// +kubebuilder:validation:MinLength=1
IdentityName string `json:"identityName"`
Spec IONOSCloudClusterSpec `json:"spec"`
}

// +kubebuilder:object:root=true
Expand Down
21 changes: 3 additions & 18 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ spec:
- message: PublicLanID is immutable
rule: self == oldSelf
required:
- controlPlaneEndpoint
- identityName
- location
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,120 @@ spec:
template:
properties:
spec:
description: IONOSCloudClusterSpec defines the desired state of
IONOSCloudCluster
properties:
controlPlaneEndpoint:
description: APIEndpoint represents a reachable Kubernetes
API endpoint.
properties:
host:
description: The hostname on which the API server is serving.
type: string
port:
description: The port on which the API server is serving.
format: int32
type: integer
required:
- host
- port
type: object
dataCenterID:
type: string
x-kubernetes-validations:
- message: DataCenterID is immutable
rule: self == oldSelf
identityName:
minLength: 1
type: string
internetLanID:
format: int32
type: integer
x-kubernetes-validations:
- message: InternetLanID is immutable
rule: self == oldSelf
lans:
items:
properties:
lanID:
format: int32
type: integer
name:
type: string
public:
type: boolean
required:
- name
- public
type: object
type: array
loadBalancer:
properties:
id:
type: string
listenerLanRef:
properties:
name:
type: string
required:
- name
type: object
targetLanRef:
properties:
name:
type: string
required:
- name
type: object
required:
- listenerLanRef
- targetLanRef
type: object
loadBalancerID:
type: string
x-kubernetes-validations:
- message: LoadBalancerID is immutable
rule: self == oldSelf
location:
enum:
- es/vlt
- fr/par
- de/txl
- de/fra
- gb-lhr
- us-ewr
- us-las
type: string
x-kubernetes-validations:
- message: Location is immutable
rule: self == oldSelf
privateLanID:
format: int32
type: integer
x-kubernetes-validations:
- message: PrivateLanID is immutable
rule: self == oldSelf
publicLanID:
format: int32
type: integer
x-kubernetes-validations:
- message: PublicLanID is immutable
rule: self == oldSelf
required:
- identityName
- location
type: object
x-kubernetes-validations:
- message: DataCenterID is required once set
rule: '!has(oldSelf.dataCenterID) || has(self.dataCenterID)'
- message: LoadBalancerID is required once set
rule: '!has(oldSelf.loadBalancerID) || has(self.loadBalancerID)'
- message: PublicLanID is required once set
rule: '!has(oldSelf.publicLanID) || has(self.publicLanID)'
- message: InternetLanID is required once set
rule: '!has(oldSelf.internetLanID) || has(self.internetLanID)'
- message: PrivateLanID is required once set
rule: '!has(oldSelf.privateLanID) || has(self.privateLanID)'
required:
- spec
type: object
Expand Down
Loading