Skip to content

feat: Define ServiceLoadBalancer Configuration API #778

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

Merged
merged 5 commits into from
Jul 3, 2024
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
21 changes: 21 additions & 0 deletions api/v1alpha1/addon_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,25 @@ type ServiceLoadBalancer struct {
// +kubebuilder:validation:Enum=MetalLB
// +kubebuilder:validation:Required
Provider string `json:"provider"`

// Configuration for the chosen ServiceLoadBalancer provider.
// +kubebuilder:validation:Optional
Configuration *ServiceLoadBalancerConfiguration `json:"configuration,omitempty"`
}

type ServiceLoadBalancerConfiguration struct {
// AddressRanges is a list of IPv4 address ranges the
// provider uses to choose an address for a load balancer.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
AddressRanges []AddressRange `json:"addressRanges"`
}

// AddressRange defines an IPv4 range.
type AddressRange struct {
// +kubebuilder:validation:Format=ipv4
Start string `json:"start"`

// +kubebuilder:validation:Format=ipv4
End string `json:"end"`
}
25 changes: 25 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_awsclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,31 @@ spec:
type: object
serviceLoadBalancer:
properties:
configuration:
description: Configuration for the chosen ServiceLoadBalancer provider.
properties:
addressRanges:
description: |-
AddressRanges is a list of IPv4 address ranges the
provider uses to choose an address for a load balancer.
items:
description: AddressRange defines an IPv4 range.
properties:
end:
format: ipv4
type: string
start:
format: ipv4
type: string
required:
- end
- start
type: object
minItems: 1
type: array
required:
- addressRanges
type: object
provider:
description: |-
The LoadBalancer-type Service provider to deploy. Not required in infrastructures where
Expand Down
25 changes: 25 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_dockerclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,31 @@ spec:
type: object
serviceLoadBalancer:
properties:
configuration:
description: Configuration for the chosen ServiceLoadBalancer provider.
properties:
addressRanges:
description: |-
AddressRanges is a list of IPv4 address ranges the
provider uses to choose an address for a load balancer.
items:
description: AddressRange defines an IPv4 range.
properties:
end:
format: ipv4
type: string
start:
format: ipv4
type: string
required:
- end
- start
type: object
minItems: 1
type: array
required:
- addressRanges
type: object
provider:
description: |-
The LoadBalancer-type Service provider to deploy. Not required in infrastructures where
Expand Down
25 changes: 25 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_nutanixclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,31 @@ spec:
type: object
serviceLoadBalancer:
properties:
configuration:
description: Configuration for the chosen ServiceLoadBalancer provider.
properties:
addressRanges:
description: |-
AddressRanges is a list of IPv4 address ranges the
provider uses to choose an address for a load balancer.
items:
description: AddressRange defines an IPv4 range.
properties:
end:
format: ipv4
type: string
start:
format: ipv4
type: string
required:
- end
- start
type: object
minItems: 1
type: array
required:
- addressRanges
type: object
provider:
description: |-
The LoadBalancer-type Service provider to deploy. Not required in infrastructures where
Expand Down
42 changes: 41 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

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

31 changes: 29 additions & 2 deletions docs/content/addons/serviceloadbalancer.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ The Service Load Balancer is the component that backs this Kubernetes Service, e
a Virtual IP, creating a machine that runs load balancer software, by delegating to APIs, such as
the underlying infrastructure, or a hardware load balancer.

The Service Load Balancer can choose the Virtual IP from a pre-defined address range. You can use
CAREN to configure one or more IPv4 ranges. For additional options, configure the Service Load
Balancer yourself after it is deployed.

CAREN currently supports the following Service Load Balancers:

- [MetalLB]

## Example
## Examples

To enable deployment of MetalLB on a cluster, specify the following values:

Expand All @@ -33,7 +37,30 @@ spec:
provider: MetalLB
```

See [MetalLB documentation] for details on configuration.
To enable MetalLB, and configure two address IPv4 ranges, specify the following values:

```yaml
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: <NAME>
spec:
topology:
variables:
- name: clusterConfig
value:
addons:
serviceLoadBalancer:
provider: MetalLB
configuration:
addressRanges:
- start: 10.100.1.1
end: 10.100.1.20
- start: 10.100.1.51
end: 10.100.1.70
```

See [MetalLB documentation] for more configuration details.

[external load balancer]: https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/
[MetalLB]: https://metallb.org
Expand Down
Loading