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

add additional networks #80

Merged
merged 11 commits into from
Jan 5, 2023
Merged
52 changes: 34 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,41 +186,57 @@ 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"
# If set to true it do not add the default network ID from
# the yawol-cloud-controller to the additionalNetworks.
yawol.stackit.cloud/skipCloudControllerDefaultNetworkID: "false"
# Overwrites the projectID which is set by the secret.
# If not set the settings from the secret binding will be used.
# This field is immutable and can not be changed after the service is created.
yawol.stackit.cloud/projectID: "OS-ProjectID"
# 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
60 changes: 54 additions & 6 deletions api/v1beta1/loadbalancer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@ 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"
// ServiceSkipCloudControllerDefaultNetworkID if set to true it do not add the default network ID from
// the yawol-cloud-controller to the additionalNetworks
ServiceSkipCloudControllerDefaultNetworkID = "yawol.stackit.cloud/skipCloudControllerDefaultNetworkID"
// ServiceDefaultProjectID overwrites the projectID which is set by the secret.
// If not set the settings from the secret binding will be used.
ServiceDefaultProjectID = "yawol.stackit.cloud/projectID"
// 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 +51,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,33 +174,62 @@ 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"`
// Flavor defines openstack flavor for the LoadBalancer. Uses a default if not defined.
// +optional
Flavor *OpenstackFlavorRef `json:"flavor,omitempty"`
dergeberl marked this conversation as resolved.
Show resolved Hide resolved
// Image defines openstack image for the LoadBalancer. Uses a default if not defined.
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
Image *OpenstackImageRef `json:"image,omitempty"`
AdditionalNetworks []LoadBalancerAdditionalNetwork `json:"additionalNetworks"`
// Flavor defines openstack flavor for the LoadBalancer.
Flavor OpenstackFlavorRef `json:"flavor"`
// Image defines openstack image for the LoadBalancer.
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"`
// ProjectID defines an openstack project ID which will be used instead of the project from the secret ref.
// If not set the project from the secret ref will be used.
// +optional
ProjectID *string `json:"projectID"`
}

// 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.
// +optional
ImageID *string `json:"imageID,omitempty"`
// NOT IMPLEMENTED ONLY ImageID is supported.
// ImageName is the name of the image used for requesting virtual machines.
// ImageName is only used if ImageID is not defined.
// +optional
ImageName *string `json:"imageName,omitempty"`
// NOT IMPLEMENTED ONLY ImageID is supported.
// ImageSearch is a search string to find the image used for requesting virtual machines.
// Search will be performed in metadata of the images.
// ImageSearch is only used if ImageName and ImageID are not defined.
Expand All @@ -210,10 +253,12 @@ type OpenstackFlavorRef struct {
// FlavorID is the flavor ID used for requesting virtual machines.
// +optional
FlavorID *string `json:"flavorID,omitempty"`
// NOT IMPLEMENTED ONLY FlavorID is supported.
// FlavorName is the name of the flavor used for requesting virtual machines.
// FlavorName is only used if FlavorID is not defined.
// +optional
FlavorName *string `json:"flavorName,omitempty"`
// NOT IMPLEMENTED ONLY FlavorID is supported.
// FlavorSearch is a search string to find the flavor used for requesting virtual machines.
// Search will be performed in metadata of the flavors.
// FlavorSearch is only used if FlavorName and FlavorID are not defined.
Expand Down Expand Up @@ -262,6 +307,9 @@ type LoadBalancerStatus struct {
// PortName is the current openstack name from the virtual Port.
// +optional
PortName *string `json:"portName,omitempty"`
// PortIP is the IP from the openstack virtual Port.
// +optional
PortIP *string `json:"portIP,omitempty"`
// ServerGroupID is the current sever group ID
// +optional
ServerGroupID *string `json:"serverGroupID,omitempty"`
Expand Down
11 changes: 11 additions & 0 deletions api/v1beta1/loadbalancermachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type LoadBalancerMachineSpec struct {
// PortID defines the openstack ID of the port attached to the FloatingIP.
PortID string `json:"portID"`
// ServerGroupID defines the openstack ID of the openstack server group.
// +optional
ServerGroupID string `json:"serverGroupID"`
// LoadBalancerRef defines a reference to the LoadBalancer Object.
LoadBalancerRef LoadBalancerRef `json:"loadBalancerRef"`
Expand Down Expand Up @@ -68,9 +69,19 @@ 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"`
// DefaultPortName contains the default openstack port Name for a LoadBalancerMachine.
// +optional
DefaultPortName *string `json:"defaultPortName,omitempty"`
// DefaultPortIP contains the default openstack port IP for a LoadBalancerMachine.
// +optional
DefaultPortIP *string `json:"defaultPortIP,omitempty"`
// ServiceAccountName contains the namespacedName from the ServiceAccount for a LoadBalancerMachine.
// +optional
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
Expand Down
76 changes: 67 additions & 9 deletions api/v1beta1/zz_generated.deepcopy.go

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

Loading