mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #62110 from FengyunPan2/add-subnet-id-annotation
Automatic merge from submit-queue (batch tested with PRs 62142, 62137, 62150, 62110). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Add subnet-id annotation for openstack cloud provider Currently user only specify subnet-id in cloud.conf file. If user want to specify other subnet for some special services, the subnet-id annotation should be a good choice. **Release note**: ```release-note NONE ``` cc @sapham
This commit is contained in:
commit
827b3d77cd
@ -70,6 +70,7 @@ const (
|
||||
errorStatus = "ERROR"
|
||||
|
||||
ServiceAnnotationLoadBalancerFloatingNetworkID = "loadbalancer.openstack.org/floating-network-id"
|
||||
ServiceAnnotationLoadBalancerSubnetID = "loadbalancer.openstack.org/subnet-id"
|
||||
|
||||
// ServiceAnnotationLoadBalancerInternal is the annotation used on the service
|
||||
// to indicate that we want an internal loadbalancer service.
|
||||
@ -643,6 +644,7 @@ func (lbaas *LbaasV2) EnsureLoadBalancer(ctx context.Context, clusterName string
|
||||
return nil, fmt.Errorf("there are no available nodes for LoadBalancer service %s/%s", apiService.Namespace, apiService.Name)
|
||||
}
|
||||
|
||||
lbaas.opts.SubnetID = getStringFromServiceAnnotation(apiService, ServiceAnnotationLoadBalancerSubnetID, lbaas.opts.SubnetID)
|
||||
if len(lbaas.opts.SubnetID) == 0 {
|
||||
// Get SubnetID automatically.
|
||||
// The LB needs to be configured with instance addresses on the same subnet, so get SubnetID by one node.
|
||||
@ -1158,6 +1160,7 @@ func (lbaas *LbaasV2) UpdateLoadBalancer(ctx context.Context, clusterName string
|
||||
loadBalancerName := cloudprovider.GetLoadBalancerName(service)
|
||||
glog.V(4).Infof("UpdateLoadBalancer(%v, %v, %v)", clusterName, loadBalancerName, nodes)
|
||||
|
||||
lbaas.opts.SubnetID = getStringFromServiceAnnotation(service, ServiceAnnotationLoadBalancerSubnetID, lbaas.opts.SubnetID)
|
||||
if len(lbaas.opts.SubnetID) == 0 && len(nodes) > 0 {
|
||||
// Get SubnetID automatically.
|
||||
// The LB needs to be configured with instance addresses on the same subnet, so get SubnetID by one node.
|
||||
|
Loading…
Reference in New Issue
Block a user