Skip to content

Commit

Permalink
pool member type auto doc and il fix
Browse files Browse the repository at this point in the history
  • Loading branch information
charanm08 committed Feb 9, 2024
1 parent ead65b5 commit c172170
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 11 deletions.
116 changes: 106 additions & 10 deletions docs/config_examples/PoolType-Auto/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,122 @@

## Pool Member Type - auto
If deployment is configured with the auto mode, CIS will auto learn the service type and populate the bigip pool members based on the service types

If CIS is configured with the "auto" mode, CIS will learn the respective service type of the CIS monitored resources and populate the bigip pool members based on the service types<br>
In other words, CIS considers the pool-mode as "cluster" when the respective service type is "clusterIP" and considers the pool-mode as "nodeport" when the respective service type are "NodePort" and "LoadBalancer"<br>
"auto" pool-mode can be considered as the combination of "nodeport" and "cluster". It adjusts the modes automatically based on the service Type.
## Configuration
```
args:
--pool-member-type=auto
```

# Supported Services
CIS in auto mode will auto learn the service types and process the pool members. Below service types are supported
CIS in auto mode will learn the service types and process the pool members. Below service types are supported
with the respective pool member types

| CIS version | Service Type | Pool Members | VXLan Required |
|-------------|--------------------------|-------------|-----------------------------------------|
| 2.16+ | ClusterIP | Pod IPs | Yes(If static routing Mode not enabled) |
| 2.16+ | NodePort | Node IP's | N/A |
| 2.16+ | LoadBalancer | Node IP's | N/A |
| CIS version | Service Type | Pool Members | VXLan Required |
|-------------|--------------|-----------------------------------------------|-----------------------------------------|
| 2.16+ | ClusterIP | Pod IPs (Same as CIS "cluster" pool-mode) | Yes(If static routing Mode not enabled) |
| 2.16+ | Headless | Pod IPs (Same as CIS "cluster" pool-mode) | Yes(If static routing Mode not enabled) |
| 2.16+ | NodePort | Node IP's (Same as CIS "nodeport" pool-mode) | N/A |
| 2.16+ | LoadBalancer | Node IP's (Same as CIS "nodeport" pool-mode) | N/A |


**Note:**

* In auto pool mode & static routing mode disabled, to enable traffic to cluster type services(pods), vXlan config is required
* For Headless service - Service Type will be ClusterIP. So pod IPs will be configured on the BIG IP
* For the combination of auto pool mode enabled & static routing mode disabled, VxLAN Config is required to enable traffic to cluster type services(pods)
* For Headless service - service type will be ClusterIP. So pod IP will be configured on the BIG IP
* pool-member-type=auto is supported only with CRD's and NextGen


**Example:**

Let's assume we have 2 services. One is of type ClusterIP and other is of type NodePort
When we run the CIS in the auto mode we will see below results on the BIGIP.


## Service - 1
```
apiVersion: v1
kind: Service
metadata:
labels:
app: pytest-svc-1
name: pytest-svc-1
namespace: default
spec:
clusterIP: 10.110.147.19
clusterIPs:
- 10.110.147.19
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: pytest-svc-1-8344
port: 8344
protocol: TCP
targetPort: 1344
selector:
app: pytest-svc-1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
```

## Service - 2
```
apiVersion: v1
kind: Service
metadata:
labels:
app: svc-1
name: svc-1
namespace: default
spec:
clusterIP: 10.100.246.74
clusterIPs:
- 10.100.246.74
externalTrafficPolicy: Cluster
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: svc-1-80
nodePort: 30837
port: 8080
protocol: TCP
targetPort: 80
selector:
app: svc-1
sessionAffinity: None
type: NodePort
status:
loadBalancer: {}
```

## Pools on BGIP

![architecture](images/pools.png)



## pytest-svc-1 Pool Members on BIGIP

![architecture](images/pool-1.png)

**Note:**

* Service - pytest-svc-1 is of type ClusterIP, CIS will populate pool with the pod IP




## svc-1 Pool Members on BIGIP
![architecture](images/pool-2.png)

**Note:**

* Service - svc-1 is of type NodePort, CIS will populate pool with the Node IP
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion pkg/controller/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1986,6 +1986,19 @@ func (ctlr *Controller) updatePoolMembersForService(svcKey MultiClusterServiceKe
_ = ctlr.processTransportServers(virtual, false)
}
return
case IngressLink:
var item interface{}
inf, _ := ctlr.getNamespacedCRInformer(poolId.rsKey.namespace)
item, _, _ = inf.ilInformer.GetIndexer().GetByKey(poolId.rsKey.namespace + "/" + poolId.rsKey.name)
if item == nil {
// This case won't arise
continue
}
il, found := item.(*cisapiv1.IngressLink)
if found {
_ = ctlr.processIngressLink(il, false)
}
return
}
}
ctlr.updatePoolMembersForResources(&pool)
Expand Down Expand Up @@ -3274,7 +3287,7 @@ func (ctlr *Controller) processIngressLink(
return nil
}
targetPort := nginxMonitorPort
if ctlr.PoolMemberType == NodePort {
if ctlr.PoolMemberType == NodePort || (ctlr.PoolMemberType == Auto && svc.Spec.Type != v1.ServiceTypeClusterIP) {
targetPort = getNodeport(svc, nginxMonitorPort)
if targetPort == 0 {
log.Errorf("Nodeport not found for nginx monitor port: %v", nginxMonitorPort)
Expand Down

0 comments on commit c172170

Please sign in to comment.