Skip to content

Commit

Permalink
improve cluster template
Browse files Browse the repository at this point in the history
  • Loading branch information
farodin91 committed Nov 10, 2023
1 parent bfe0c38 commit a38aa1a
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 37 deletions.
8 changes: 5 additions & 3 deletions api/v1alpha1/ionoscloudcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ type IONOSCloudClusterSpec struct {
Location Location `json:"location"`

// +kubebuilder:validation:MinLength=1
IdentityName string `json:"identityName"`
IdentityName string `json:"identityName"`
// +optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
Lans []IONOSLanSpec `json:"lans,omitempty"`
LoadBalancer IONOSLoadBalancerSpec `json:"loadBalancer,omitempty"`
// +optional
Lans []IONOSLanSpec `json:"lans,omitempty"`
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
55 changes: 28 additions & 27 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

0 comments on commit a38aa1a

Please sign in to comment.