Skip to content

Commit 23cc3e5

Browse files
authored
Add support for multiple namespaces (#157)
1 parent d260bf9 commit 23cc3e5

7 files changed

Lines changed: 98 additions & 29 deletions

File tree

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ The F5 IPAM Controller acts as an interface to CIS to provide an IP address from
3131

3232
**Deployment Options**
3333

34-
| PARAMETER | TYPE | REQUIRED | DESCRIPTION |
35-
| ------ | ------ | ------ | ------ |
36-
| orchestration | String | Required | The orchestration parameter holds the orchestration environment i.e. Kubernetes. |
37-
| ipam-provider | String | Required | ipam-provider parameter holds the IP provider that holds the ownership of providing IP addresses such as infoblox, f5-ip-provider. Default is *f5-ip-provider*. |
38-
| log-level | String | Optional | Log level parameter specify various logging level such as DEBUG, INFO, WARNING, ERROR, CRITICAL. |
34+
| PARAMETER | TYPE | REQUIRED | DESCRIPTION |
35+
|---------------|--------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
36+
| orchestration | String | Required | The orchestration parameter holds the orchestration environment i.e. Kubernetes. |
37+
| ipam-provider | String | Required | ipam-provider parameter holds the IP provider that holds the ownership of providing IP addresses such as infoblox, f5-ip-provider. Default is *f5-ip-provider*. |
38+
| log-level | String | Optional | Log level parameter specify various logging level such as DEBUG, INFO, WARNING, ERROR, CRITICAL. |
39+
| namespace | String | Optional | Kubernetes namespace(s) to watch. By default controller will watch only kube-system namespace. To specify multiple namespace, use multiple --namespace flags. |
3940

4041
**Deployment Options of Provider (f5-ip-provider)**
4142

@@ -45,16 +46,16 @@ The F5 IPAM Controller acts as an interface to CIS to provide an IP address from
4546

4647
**Deployment Options of Provider (infoblox)**
4748

48-
| PARAMETER | TYPE | REQUIRED | DESCRIPTION |
49-
| ------ | ------ | ------ | ------ |
50-
| infoblox-labels | String | Required | infoblox labels holds the mappings for infoblox's CIDR |
51-
| infoblox-grid-host | String | Required | URL (or IP Address) of Infoblox Grid Host |
52-
| infoblox-wapi-port | String | Optional | Port that the Infoblox Server listens on. Default is 443 |
53-
| infoblox-wapi-version | String | Required | Web API version of Infoblox
54-
| infoblox-username | String | Required | Username of Infoblox User |
55-
| infoblox-password | String | Required | Password of the given Infoblox User |
56-
| infoblox-netview | String | Required | Netview from which IP addresses needs to be allocated |
57-
| credentials-directory | String | Optional | Credentials can be mounted from k8s secrets |
49+
| PARAMETER | TYPE | REQUIRED | DESCRIPTION |
50+
|-----------------------|--------|----------|----------------------------------------------------------|
51+
| infoblox-labels | String | Required | infoblox labels holds the mappings for infoblox's CIDR |
52+
| infoblox-grid-host | String | Required | URL (or IP Address) of Infoblox Grid Host |
53+
| infoblox-wapi-port | String | Optional | Port that the Infoblox Server listens on. Default is 443 |
54+
| infoblox-wapi-version | String | Required | Web API version of Infoblox |
55+
| infoblox-username | String | Required | Username of Infoblox User |
56+
| infoblox-password | String | Required | Password of the given Infoblox User |
57+
| infoblox-netview | String | Required | Netview from which IP addresses needs to be allocated |
58+
| credentials-directory | String | Optional | Credentials can be mounted from k8s secrets |
5859

5960

6061
Note: On how to configure these Configuration Options, please refer to IPAM Deployment YAML example in below.

cmd/f5-ipam-controller/main.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ var (
3434
ibFlags *flag.FlagSet
3535

3636
// Global
37-
logLevel *string
38-
orch *string
39-
provider *string
37+
logLevel *string
38+
orch *string
39+
provider *string
40+
namespaces *[]string
4041

4142
// Default Provider
4243
iprange *string
@@ -77,7 +78,9 @@ func init() {
7778
"Required, orchestration that the controller is running in.")
7879
provider = globalFlags.String("ipam-provider", DefaultProvider,
7980
"Required, the IPAM system that the controller will interface with.")
80-
81+
namespaces = globalFlags.StringArray("namespace", []string{},
82+
"Optional, Kubernetes namespace(s) to watch."+
83+
"If left blank controller will watch only kube-system namespace")
8184
iprange = basicProvFlags.String("ip-range", "",
8285
"Optional, the Default Provider needs iprange to build pools of IP Addresses")
8386

@@ -239,7 +242,7 @@ func main() {
239242
}
240243
log.Infof("[INIT] Starting: F5 IPAM Controller - Version: %s, BuildInfo: %s", version, buildInfo)
241244

242-
orcr := orchestration.NewOrchestrator()
245+
orcr := orchestration.NewOrchestrator(*namespaces)
243246
if orcr == nil {
244247
log.Error("Unable to create IPAM Client")
245248
os.Exit(1)

docs/RELEASE-NOTES.rst

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
Release Notes for F5 IPAM Controller for Kubernetes & OpenShift
22
=======================================================================
33

4-
Next Release
4+
0.1.11
55
-------------
66

77
Added Functionality
88
```````````````````
9+
**What’s new:**
10+
* Support for namespace to watch the multiple namespaces for IPAM CRD
911

10-
Bug Fixes
11-
````````````
12+
0.1.10
13+
``````````````````````````
14+
15+
Vulnerability Fixes
16+
```````````````````
17+
CVE-2023-38545, CVE-2023-38546, CVE-2022-48337, CVE-2022-48338, CVE-2022-48339, CVE-2023-2491, CVE-2023-24329,
18+
CVE-2023-40217, CVE-2023-4527, CVE-2023-4806, CVE-2023-4813, CVE-2023-4911, CVE-2023-44487, CVE-2023-28617,
19+
CVE-2022-40897
20+
21+
22+
Known Issues
23+
`````````````
24+
CVE-2024-2961
1225

1326
0.1.9
1427
-------------
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Sample configuration for f5-ipam-controller with default provider. For persistent IP addresses upon restarts,
2+
# volume mounts are used. securityContext is used to change mount permissions to controller user.
3+
apiVersion: apps/v1
4+
kind: Deployment
5+
metadata:
6+
labels:
7+
name: f5-ipam-controller
8+
name: f5-ipam-controller
9+
namespace: kube-system
10+
spec:
11+
replicas: 1
12+
selector:
13+
matchLabels:
14+
app: f5-ipam-controller
15+
template:
16+
metadata:
17+
labels:
18+
app: f5-ipam-controller
19+
spec:
20+
containers:
21+
- args:
22+
- --orchestration
23+
- kubernetes
24+
- --ip-range
25+
- '{"Dev":"172.16.3.21-172.16.3.30","Test":"172.16.3.31-172.16.3.40","Production":"172.16.3.41-172.16.3.50",
26+
"Default":"172.16.3.51-172.16.3.60" } '
27+
- --log-level
28+
- DEBUG
29+
# Add multiple namespaces to the controller, By default controller will watch only kube-system namespace
30+
- --namespace=dev
31+
- --namespace=test
32+
command:
33+
- /app/bin/f5-ipam-controller
34+
image: f5networks/f5-ipam-controller:latest
35+
imagePullPolicy: IfNotPresent
36+
name: f5-ipam-controller
37+
terminationMessagePath: /dev/termination-log
38+
volumeMounts:
39+
- mountPath: /app/ipamdb
40+
name: samplevol
41+
securityContext:
42+
fsGroup: 1200
43+
runAsGroup: 1200
44+
runAsUser: 1200
45+
serviceAccount: ipam-ctlr
46+
serviceAccountName: ipam-ctlr
47+
volumes:
48+
- name: samplevol
49+
persistentVolumeClaim:
50+
claimName: pvc-local

next-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.10
1+
0.1.11

pkg/orchestration/kubernetes.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type ResourceMeta struct {
6767
namespace string
6868
}
6969

70-
func NewIPAMK8SClient() *K8sIPAMClient {
70+
func NewIPAMK8SClient(namespaces []string) *K8sIPAMClient {
7171
log.Debugf("Creating IPAM Kubernetes Client")
7272
config, err := rest.InClusterConfig()
7373
if err != nil {
@@ -85,11 +85,13 @@ func NewIPAMK8SClient() *K8sIPAMClient {
8585
UpdateFunc: func(oldObj, newObj interface{}) { k8sIPAMClient.enqueueUpdatedIPAM(oldObj, newObj) },
8686
DeleteFunc: func(obj interface{}) { k8sIPAMClient.enqueueDeletedIPAM(obj) },
8787
}
88-
88+
if len(namespaces) == 0 {
89+
namespaces = append(namespaces, DefaultNamespace)
90+
}
8991
ipamParams := ipammachinery.Params{
9092
Config: config,
9193
EventHandlers: eventHandlers,
92-
Namespaces: []string{DefaultNamespace},
94+
Namespaces: namespaces,
9395
}
9496

9597
ipamCli := ipammachinery.NewIPAMClient(ipamParams)

pkg/orchestration/orchestration.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ type Orchestrator interface {
3030
Stop()
3131
}
3232

33-
func NewOrchestrator() Orchestrator {
34-
return NewIPAMK8SClient()
33+
func NewOrchestrator(namespaces []string) Orchestrator {
34+
return NewIPAMK8SClient(namespaces)
3535
}

0 commit comments

Comments
 (0)