noironetworks/aci-containers

unable to assign LoadBalancerIP to service of type LoadBalancer

enrico2828 opened this issue · 0 comments

We are runnning OpenShift 4.10 on baremetal servers with the Cisco ACI CNI plugin version 5.2.3.4 and ACI 5.2(5c). We want to create a service of type “LoadBalancer” and assign an IP address to it. However, the specification is ignored and a random IP addess is assigned.

HOW TO REPRODUCE
Create a deployment with Nginx. Expose through a service of type loadbalancer. Explicitly set LoadBalancerIP.

---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx-green
  name: nginx-green
  namespace: na-nettest-nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx-green
  strategy: {}
  template:
    metadata:
      labels:
        app: nginx-green
    spec:
      containers:
      - image: nginxinc/nginx-unprivileged:1.23-alpine-slim
        name: nginx-unprivileged
        resources: {}
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: nginx-green
  name: nginx-green
  namespace: na-nettest-nginx
spec:
  loadBalancerIP: 10.168.122.55
  type: LoadBalancer
  ports:
  - name: "8080"
    port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app: nginx-green

EXPECTED RESULT
A service is created that exposes the nginx pod on IP 10.168.122.55.

ACTUAL RESULT
A random IP is chosen by ACI, in this case 10.168.122.25 (see status.loadBalancer.ingress)

oc get svc nginx-green -o yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"nginx-green"},"name":"nginx-green","namespace":"na-nettest-nginx"},"spec":{"loadBalancerIP":"10.168.122.55","ports":[{"name":"8080","port":8080,"protocol":"TCP","targetPort":8080}],"selector":{"app":"nginx-green"},"type":"LoadBalancer"}}
  creationTimestamp: "2023-02-03T11:18:43Z"
  labels:
    app: nginx-green
  name: nginx-green
  namespace: na-nettest-nginx
  resourceVersion: "228488801"
  uid: 659b6662-72c6-4745-a869-eb8a97d9620a
spec:
  allocateLoadBalancerNodePorts: true
  clusterIP: 10.122.215.232
  clusterIPs:
  - 10.122.215.232
  externalTrafficPolicy: Cluster
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  loadBalancerIP: 10.168.122.55
  ports:
  - name: "8080"
    nodePort: 30768
    port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app: nginx-green
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer:
    ingress:
    - ip: 10.168.122.25