Skip to content

Commit

Permalink
IPPool CRD NV-IPAM
Browse files Browse the repository at this point in the history
NV-IPAM updates:

- Add support for IPPool CRD
- Deprecate the configmap
- Update templates with latest yamls configuration
- Update documentation
- Upgrade to v0.1.0

Signed-off-by: Fred Rolland <frolland@nvidia.com>
  • Loading branch information
rollandf committed Sep 21, 2023
1 parent b53f9d7 commit cd81508
Show file tree
Hide file tree
Showing 17 changed files with 294 additions and 157 deletions.
84 changes: 1 addition & 83 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,7 @@ spec:
nvIpam:
image: nvidia-k8s-ipam
repository: ghcr.io/mellanox
version: v0.0.3
config: '{
"pools": {
"my-pool": {"subnet": "192.168.0.0/24", "perNodeBlockSize": 100, "gateway": "192.168.0.1"}
}
}'
version: v0.1.0
```

Can be found at: `example/crs/mellanox.com_v1alpha1_nicclusterpolicy_cr-nvidia-ipam.yaml`
Expand Down Expand Up @@ -493,83 +488,6 @@ Specifying configuration either via Helm values when installing NVIDIA
network operator, or by specifying them when directly creating NicClusterPolicy CR.
These configurations eventually trigger the creation of a ConfigMap object in K8s.

As an example, NVIDIA K8s IPAM plugin configuration is specified either via:

__Helm values:__

```yaml
deployCR: true
nvIpam:
deploy: true
image: nvidia-k8s-ipam
repository: ghcr.io/mellanox
version: v0.0.3
config: |-
{
"pools": {
"rdma-pool": {"subnet": "192.168.0.0/16", "perNodeBlockSize": 100, "gateway": "192.168.0.1"}
}
}
```

__NicClusterPolicy CR:__

```yaml
apiVersion: mellanox.com/v1alpha1
kind: NicClusterPolicy
metadata:
name: nic-cluster-policy
spec:
nvIpam:
image: nvidia-k8s-ipam
repository: ghcr.io/mellanox
version: v0.0.3
config: '{
"pools": {
"my-pool": {"subnet": "192.168.0.0/16", "perNodeBlockSize": 100, "gateway": "192.168.0.1"}
}
}'
```

The configuration is then processed by the operator, eventually rendering and creating a _ConfigMap_, `nvidia-k8s-ipam-config`, within the
namespace the operator was deployed. It contains the configuration for _nvidia k8s IPAM plugin_.

For some advanced use-cases, it is desirable to provide such configurations at a later time.
(e.g if network configuration is not known during Network Operator deployment time)

To support this, it is possible to explicitly set such configuration to `nil` in Helm values
or omit the `config` field of the relevant component while creating NicClusterPolicy CR.
This will prevent Network Operator from
creating such ConfigMaps, allowing the user to provide its own.

Example (omitting nvidia k8s ipam config):

__Helm values:__

```yaml
deployCR: true
nvIpam:
deploy: true
image: nvidia-k8s-ipam
repository: ghcr.io/mellanox
version: v0.0.3
config: null
```

__NicClusterPolicy CR:__

```yaml
apiVersion: mellanox.com/v1alpha1
kind: NicClusterPolicy
metadata:
name: nic-cluster-policy
spec:
nvIpam:
image: nvidia-k8s-ipam
repository: ghcr.io/mellanox
version: v0.0.3
```

> __Note__: It is the responsibility of the user to delete any existing configurations (ConfigMaps) if
> they were already created by the Network Operator as well as deleting his own configuration when they
> are no longer required.
17 changes: 17 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,23 @@ rules:
- get
- list
- watch
- apiGroups:
- nv-ipam.nvidia.com
resources:
- ippools
verbs:
- create
- get
- list
- watch
- apiGroups:
- nv-ipam.nvidia.com
resources:
- ippools/status
verbs:
- get
- patch
- update
- apiGroups:
- policy
resources:
Expand Down
2 changes: 2 additions & 0 deletions controllers/nicclusterpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ type NicClusterPolicyReconciler struct {
// +kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=batch,resources=cronjobs,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=config.openshift.io,resources=proxies,verbs=get;list;watch
// +kubebuilder:rbac:groups=nv-ipam.nvidia.com,resources=ippools,verbs=get;list;watch;create;
// +kubebuilder:rbac:groups=nv-ipam.nvidia.com,resources=ippools/status,verbs=get;update;patch;

// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
Expand Down
4 changes: 2 additions & 2 deletions deployment/network-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,9 @@ optionally deployed components:
| `nvIpam.deploy` | bool | `false` | Deploy NVIDIA IPAM Plugin |
| `nvIpam.image` | string | `nvidia-k8s-ipam` | NVIDIA IPAM Plugin image name |
| `nvIpam.repository` | string | `ghcr.io/mellanox` | NVIDIA IPAM Plugin image repository |
| `nvIpam.version` | string | `v0.0.3` | NVIDIA IPAM Plugin image version |
| `nvIpam.version` | string | `v0.1.0` | NVIDIA IPAM Plugin image version |
| `nvIpam.imagePullSecrets` | list | `[]` | An optional list of references to secrets to use for pulling any of the Plugin image |
| `nvIpam.config` | string | `"{"pools": {"rdma-pool": {"subnet": "192.168.0.0/16", "perNodeBlockSize": 100, "gateway": "192.168.0.1"}}}"` | Network pool configuration as described in [nvidia-k8s-ipam](https://github.com/Mellanox/nvidia-k8s-ipam), the default defines a single IP Pool named `"rdma-pool"`|
| `nvIpam.config` | string | Deprecated | This field is ignored. Configuration is done by using IPPool CRD |

## Deployment Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,5 @@ spec:
repository: {{ .Values.nvIpam.repository }}
version: {{ .Values.nvIpam.version }}
imagePullSecrets: {{ include "network-operator.nvIpam.imagePullSecrets" . }}
{{- if .Values.nvIpam.config | empty | not }}
config: {{ .Values.nvIpam.config | quote }}
{{- end }}
{{- end }}
{{ end }}
17 changes: 17 additions & 0 deletions deployment/network-operator/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,23 @@ rules:
- get
- list
- watch
- apiGroups:
- nv-ipam.nvidia.com
resources:
- ippools
verbs:
- create
- get
- list
- watch
- apiGroups:
- nv-ipam.nvidia.com
resources:
- ippools/status
verbs:
- get
- patch
- update
- apiGroups:
- policy
resources:
Expand Down
9 changes: 1 addition & 8 deletions deployment/network-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,8 @@ nvIpam:
deploy: false
image: nvidia-k8s-ipam
repository: ghcr.io/mellanox
version: v0.0.3
version: v0.1.0
# imagePullSecrets: []
# network pool configuration as described in https://github.com/Mellanox/nvidia-k8s-ipam
config: |-
{
"pools": {
"rdma-pool": {"subnet": "192.168.0.0/16", "perNodeBlockSize": 100, "gateway": "192.168.0.1"}
}
}

secondaryNetwork:
deploy: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,4 @@ spec:
nvIpam:
image: nvidia-k8s-ipam
repository: ghcr.io/mellanox
version: v0.0.3
config: '{
"pools": {
"my-pool": {"subnet": "192.168.0.0/16", "perNodeBlockSize": 100, "gateway": "192.168.0.1"}
}
}'
version: v0.1.0
2 changes: 1 addition & 1 deletion hack/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ IpamPlugin:
nvIpam:
image: nvidia-k8s-ipam
repository: ghcr.io/mellanox
version: v0.0.3
version: v0.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,3 @@ spec:
image: {{ .NvIPAM.Image }}
repository: {{ .NvIPAM.Repository }}
version: {{ .NvIPAM.Version }}
config: '{
"pools": {
"my-pool": {"subnet": "192.168.0.0/16", "perNodeBlockSize": 100, "gateway": "192.168.0.1"}
}
}'
7 changes: 0 additions & 7 deletions hack/templates/values/values.template
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,6 @@ nvIpam:
repository: {{ .NvIPAM.Repository }}
version: {{ .NvIPAM.Version }}
# imagePullSecrets: []
# network pool configuration as described in https://github.com/Mellanox/nvidia-k8s-ipam
config: |-
{
"pools": {
"rdma-pool": {"subnet": "192.168.0.0/16", "perNodeBlockSize": 100, "gateway": "192.168.0.1"}
}
}

secondaryNetwork:
deploy: true
Expand Down
Loading

0 comments on commit cd81508

Please sign in to comment.