Skip to content

Commit

Permalink
wip: add additional networks to lbm controller and yawol-cloud-contro…
Browse files Browse the repository at this point in the history
…ller
  • Loading branch information
dergeberl committed Dec 12, 2022
1 parent 5caaf26 commit 0fac0d0
Show file tree
Hide file tree
Showing 21 changed files with 754 additions and 118 deletions.
45 changes: 27 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,41 +186,50 @@ kind: Service
metadata:
name: loadbalancer
annotations:
# override the default OpenStack image ID
# Override the default OpenStack image ID.
yawol.stackit.cloud/imageId: "OS-imageId"
# override the default OpenStack machine flavor
# Override the default OpenStack machine flavor.
yawol.stackit.cloud/flavorId: "OS-flavorId"
# override the default OpenStack availability zone
# Overwrites the default openstack network for the loadbalancer.
# If this is set to a different network ID than defined as default in the yawol-cloud-controller
# the default from the yawol-cloud-controller will be added to the additionalNetworks.
yawol.stackit.cloud/defaultNetworkID: "OS-networkID"
# Overwrites the openstack floating network for the loadbalancer.
yawol.stackit.cloud/floatingNetworkID: "OS-floatingNetID"
# Override the default OpenStack availability zone.
yawol.stackit.cloud/availabilityZone: "OS-AZ"
# specify if this should be an internal LoadBalancer
# Specify if this should be an internal LoadBalancer .
yawol.stackit.cloud/internalLB: "false"
# run yawollet in debug mode
# Run yawollet in debug mode.
yawol.stackit.cloud/debug: "false"
# reference the name of the SSH key provided to OpenStack for debugging
# Reference the name of the SSH key provided to OpenStack for debugging .
yawol.stackit.cloud/debugsshkey: "OS-keyName"
# allows filtering services in cloud-controller
# Allows filtering services in cloud-controller.
yawol.stackit.cloud/className: "test"
# specify the number of LoadBalancer machines to deploy (default 1)
# Specify the number of LoadBalancer machines to deploy (default 1).
yawol.stackit.cloud/replicas: "3"
# specify an existing floating IP for yawol to use
# Specify an existing floating IP for yawol to use.
yawol.stackit.cloud/existingFloatingIP: "193.148.175.46"
# enable/disable envoy support for proxy protocol
# Enable/disable envoy support for proxy protocol.
yawol.stackit.cloud/tcpProxyProtocol: "false"
# defines proxy protocol ports (comma separated list)
# Defines proxy protocol ports (comma separated list).
yawol.stackit.cloud/tcpProxyProtocolPortsFilter: "80,443"
# enables log forwarding
# Enables log forwarding.
yawol.stackit.cloud/logForward: "true"
# defines loki URL for the log forwarding
# Defines loki URL for the log forwarding.
yawol.stackit.cloud/logForwardLokiURL: "http://example.com:3100/loki/api/v1/push"
# defines the TCP idle Timeout as duration, default is 1h
# make sure there is a valid unit (like "s", "m", "h"), otherwise this option is ignored
# Defines the TCP idle Timeout as duration, default is 1h.
# Make sure there is a valid unit (like "s", "m", "h"), otherwise this option is ignored.
yawol.stackit.cloud/tcpIdleTimeout: "5m30s"
# defines the UDP idle Timeout as duration, default is 1m
# make sure there is a valid unit (like "s", "m", "h"), otherwise this option is ignored
# Defines the UDP idle Timeout as duration, default is 1m.
# Make sure there is a valid unit (like "s", "m", "h"), otherwise this option is ignored.
yawol.stackit.cloud/udpIdleTimeout: "5m"
# can be 'affinity', 'anti-affinity' 'soft-affinity', 'soft-anti-affinity' depending on the OpenStack Infrastructure.
# Defines the openstack server group policy for a LoadBalancer.
# Can be 'affinity', 'anti-affinity' 'soft-affinity', 'soft-anti-affinity' depending on the OpenStack Infrastructure.
# If not set openstack server group is disabled.
yawol.stackit.cloud/serverGroupPolicy: anti-affinity
# Defines additional openstack networks for the loadbalancer (comma separated list).
yawol.stackit.cloud/additionalNetworks: "OS-networkID1,OS-networkID2"
```

See [our example service](example-setup/yawol-cloud-controller/service.yaml)
Expand Down
41 changes: 37 additions & 4 deletions api/v1beta1/loadbalancer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ const (
ServiceImageID = "yawol.stackit.cloud/imageId"
// ServiceFlavorID overwrite default flavorID
ServiceFlavorID = "yawol.stackit.cloud/flavorId"
// AvailabilityZoneID set availability zone for specific service
// ServiceDefaultNetworkID overwrites the default openstack network for the loadbalancer
// If this is set to a different network ID than defined as default in the yawol-cloud-controller
// the default from the yawol-cloud-controller will be added to the additionalNetworks
ServiceDefaultNetworkID = "yawol.stackit.cloud/defaultNetworkID"
// ServiceFloatingNetworkID overwrites the openstack floating network for the loadbalancer
ServiceFloatingNetworkID = "yawol.stackit.cloud/floatingNetworkID"
// ServiceAvailabilityZone set availability zone for specific service
ServiceAvailabilityZone = "yawol.stackit.cloud/availabilityZone"
// ServiceInternalLoadbalancer sets the internal flag in LB objects
ServiceInternalLoadbalancer = "yawol.stackit.cloud/internalLB"
Expand Down Expand Up @@ -39,6 +45,8 @@ const (
ServiceLogForwardLokiURL = "yawol.stackit.cloud/logForwardLokiURL"
// ServiceServerGroupPolicy set openstack server group policy for a LoadBalancer
ServiceServerGroupPolicy = "yawol.stackit.cloud/serverGroupPolicy"
// ServiceAdditionalNetworks adds additional openstack networks for the loadbalancer (comma separated list)
ServiceAdditionalNetworks = "yawol.stackit.cloud/additionalNetworks"
)

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -160,24 +168,49 @@ type LoadBalancerEndpoint struct {

// LoadBalancerInfrastructure defines infrastructure defaults for the LoadBalancer
type LoadBalancerInfrastructure struct {
// Deprecated: use defaultNetwork instead
// FloatingNetID defines a openstack ID for the floatingNet.
// +optional
FloatingNetID *string `json:"floatingNetID,omitempty"`
// Deprecated: use defaultNetwork instead
// NetworkID defines a openstack ID for the network.
NetworkID string `json:"networkID"`
// +optional
NetworkID string `json:"networkID,omitempty"`
// DefaultNetwork defines the default/listener network for the Loadbalancer.
// +optional
// TODO Remove optional when Deprecations are removed
DefaultNetwork LoadBalancerDefaultNetwork `json:"defaultNetwork"`
// AdditionalNetworks defines additional networks that will be added to the LoadBalancerMachines.
// +optional
AdditionalNetworks []LoadBalancerAdditionalNetwork `json:"additionalNetworks"`
// Flavor defines openstack flavor for the LoadBalancer. Uses a default if not defined.
// +optional
Flavor *OpenstackFlavorRef `json:"flavor,omitempty"`
Flavor *OpenstackFlavorRef `json:"flavor"`
// Image defines openstack image for the LoadBalancer. Uses a default if not defined.
// +optional
Image *OpenstackImageRef `json:"image,omitempty"`
Image *OpenstackImageRef `json:"image"`
// AvailabilityZone defines the openstack availability zone for the LoadBalancer.
// +optional
AvailabilityZone string `json:"availabilityZone"`
// AuthSecretRef defines a secretRef for the openstack secret.
AuthSecretRef corev1.SecretReference `json:"authSecretRef"`
}

// LoadBalancerAdditionalNetwork defines additional networks for the LoadBalancer
type LoadBalancerAdditionalNetwork struct {
// NetworkID defines an openstack ID for the network.
NetworkID string `json:"networkID"`
}

// LoadBalancerDefaultNetwork defines the default/listener network for the Loadbalancer
type LoadBalancerDefaultNetwork struct {
// FloatingNetID defines an openstack ID for the floatingNet.
// +optional
FloatingNetID *string `json:"floatingNetID,omitempty"`
// NetworkID defines an openstack ID for the network.
NetworkID string `json:"networkID"`
}

// OpenstackImageRef defines a reference to a Openstack image.
type OpenstackImageRef struct {
// ImageID is the image ID used for requesting virtual machines.
Expand Down
7 changes: 7 additions & 0 deletions api/v1beta1/loadbalancermachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,16 @@ type LoadBalancerMachineStatus struct {
// ServerID contains the openstack server ID for a LoadBalancerMachine.
// +optional
ServerID *string `json:"serverID,omitempty"`
// Deprecated: use defaultPortID instead
// PortID contains the openstack port ID for a LoadBalancerMachine.
// +optional
PortID *string `json:"portID,omitempty"`
// DefaultPortID contains the default openstack port ID for a LoadBalancerMachine.
// +optional
DefaultPortID *string `json:"defaultPortID,omitempty"`
// DefaultPortID contains the default openstack port ID for a LoadBalancerMachine.
// +optional
DefaultPortName *string `json:"defaultPortName,omitempty"`
// ServiceAccountName contains the namespacedName from the ServiceAccount for a LoadBalancerMachine.
// +optional
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
Expand Down
51 changes: 51 additions & 0 deletions api/v1beta1/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 @@ -57,6 +57,20 @@ spec:
infrastructure:
description: Infrastructure defines parameters for the Infrastructure.
properties:
additionalNetworks:
description: AdditionalNetworks defines additional networks that
will be added to the LoadBalancerMachines.
items:
description: LoadBalancerAdditionalNetwork defines additional
networks for the LoadBalancer
properties:
networkID:
description: NetworkID defines an openstack ID for the network.
type: string
required:
- networkID
type: object
type: array
authSecretRef:
description: AuthSecretRef defines a secretRef for the openstack
secret.
Expand All @@ -75,6 +89,21 @@ spec:
description: AvailabilityZone defines the openstack availability
zone for the LoadBalancer.
type: string
defaultNetwork:
description: DefaultNetwork defines the default/listener network
for the Loadbalancer. TODO Remove optional when Deprecations
are removed
properties:
floatingNetID:
description: FloatingNetID defines an openstack ID for the
floatingNet.
type: string
networkID:
description: NetworkID defines an openstack ID for the network.
type: string
required:
- networkID
type: object
flavor:
description: Flavor defines openstack flavor for the LoadBalancer.
Uses a default if not defined.
Expand All @@ -96,7 +125,8 @@ spec:
type: string
type: object
floatingNetID:
description: FloatingNetID defines a openstack ID for the floatingNet.
description: 'Deprecated: use defaultNetwork instead FloatingNetID
defines a openstack ID for the floatingNet.'
type: string
image:
description: Image defines openstack image for the LoadBalancer.
Expand All @@ -119,11 +149,11 @@ spec:
type: string
type: object
networkID:
description: NetworkID defines a openstack ID for the network.
description: 'Deprecated: use defaultNetwork instead NetworkID
defines a openstack ID for the network.'
type: string
required:
- authSecretRef
- networkID
type: object
loadBalancerRef:
description: LoadBalancerRef defines a reference to the LoadBalancer
Expand Down Expand Up @@ -195,6 +225,14 @@ spec:
description: CreationTimestamp contains the creation timestamp a LoadBalancerMachine.
format: date-time
type: string
defaultPortID:
description: DefaultPortID contains the default openstack port ID
for a LoadBalancerMachine.
type: string
defaultPortName:
description: DefaultPortID contains the default openstack port ID
for a LoadBalancerMachine.
type: string
lastOpenstackReconcile:
description: LastOpenstackReconcile contains the timestamp of the
last openstack reconciliation.
Expand Down Expand Up @@ -223,7 +261,8 @@ spec:
type: object
type: array
portID:
description: PortID contains the openstack port ID for a LoadBalancerMachine.
description: 'Deprecated: use defaultPortID instead PortID contains
the openstack port ID for a LoadBalancerMachine.'
type: string
roleBindingName:
description: RoleBindingName contains the namespacedName from the
Expand Down
Loading

0 comments on commit 0fac0d0

Please sign in to comment.