Skip to content

Commit 1ace9cf

Browse files
committed
feat: Multus config
1 parent 808932b commit 1ace9cf

File tree

6 files changed

+463
-0
lines changed

6 files changed

+463
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Default values for multus.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
# Image configuration
6+
image:
7+
repository: ghcr.io/k8snetworkplumbingwg/multus-cni
8+
tag: "" # If empty, will use Chart.AppVersion + suffix
9+
suffix: "-thick" # Default suffix (can be overridden)
10+
pullPolicy: IfNotPresent
11+
12+
# Image pull secrets
13+
imagePullSecrets: []
14+
15+
# Service account configuration
16+
serviceAccount:
17+
create: true
18+
name: multus
19+
annotations: {}
20+
21+
# Pod security context
22+
podSecurityContext:
23+
privileged: true
24+
25+
# Container security context
26+
securityContext:
27+
privileged: true
28+
capabilities:
29+
add:
30+
- NET_ADMIN
31+
- SYS_ADMIN
32+
33+
# Priority class
34+
priorityClassName: system-node-critical
35+
36+
# Pod network configuration
37+
hostNetwork: true
38+
hostPID: true
39+
40+
# Pod lifecycle configuration
41+
terminationGracePeriodSeconds: 10
42+
43+
# Update strategy
44+
updateStrategy:
45+
type: RollingUpdate
46+
rollingUpdate:
47+
maxUnavailable: 1
48+
49+
# Tolerations
50+
tolerations:
51+
- operator: Exists
52+
effect: NoSchedule
53+
- operator: Exists
54+
effect: NoExecute
55+
56+
# Node selector
57+
nodeSelector: {}
58+
59+
# Affinity
60+
affinity: {}
61+
62+
# Pod annotations
63+
podAnnotations: {}
64+
65+
# Pod labels
66+
podLabels: {}
67+
68+
# Resource limits and requests
69+
resources:
70+
limits:
71+
cpu: 100m
72+
memory: 128Mi
73+
requests:
74+
cpu: 100m
75+
memory: 128Mi
76+
77+
# Multus daemon configuration
78+
daemonConfig:
79+
chrootDir: "/hostroot"
80+
cniVersion: "0.3.1"
81+
logLevel: "verbose"
82+
logToStderr: true
83+
readinessIndicatorFile: ""
84+
cniConfigDir: "/host/etc/cni/net.d"
85+
multusAutoconfigDir: "/host/etc/cni/net.d"
86+
multusConfigFile: "auto"
87+
socketDir: "/host/run/multus/"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2024 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: kustomize.config.k8s.io/v1beta1
5+
kind: Kustomization
6+
7+
metadata:
8+
name: multus
9+
10+
sortOptions:
11+
order: fifo
12+
13+
# Multus is deployed via the Shared Multus Helper Package in handlers,
14+
# not through the helm-config.yaml bundle. Commenting out to avoid
15+
# file:// path issues during Docker builds.
16+
# helmCharts:
17+
# - name: multus
18+
# repo: file:///Users/raj.surve/DKP/charts/staging
19+
# releaseName: multus
20+
# version: 0.1.0
21+
# includeCRDs: true
22+
# skipTests: true
23+
# namespace: kube-system
24+
# valuesFile: helm-values.yaml
25+
26+
namespace: kube-system
27+

pkg/handlers/lifecycle/cni/calico/handler.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
commonhandlers "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers"
1919
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers/lifecycle"
2020
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/variables"
21+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/lifecycle/cni/multus"
2122
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/lifecycle/config"
2223
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options"
2324
)
@@ -188,5 +189,13 @@ func (c *CalicoCNI) apply(
188189
return
189190
}
190191

192+
// Deploy Multus alongside Calico after successful Calico deployment
193+
multusDeployer := multus.NewMultusDeployer(c.client, c.helmChartInfoGetter)
194+
if err := multusDeployer.DeployWithCNI(ctx, cluster, multus.CNITypeCalico, c.config.DefaultsNamespace(), log); err != nil {
195+
log.Error(err, "failed to deploy Multus alongside Calico")
196+
// Don't fail the entire deployment if Multus fails, just log the error
197+
log.Info("Calico deployed successfully but Multus deployment failed")
198+
}
199+
191200
resp.SetStatus(runtimehooksv1.ResponseStatusSuccess)
192201
}

pkg/handlers/lifecycle/cni/cilium/handler.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/handlers/lifecycle"
2727
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/capi/clustertopology/variables"
2828
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/lifecycle/addons"
29+
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/lifecycle/cni/multus"
2930
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/lifecycle/config"
3031
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options"
3132
handlersutils "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/utils"
@@ -246,6 +247,14 @@ func (c *CiliumCNI) apply(
246247
return
247248
}
248249

250+
// Deploy Multus alongside Cilium after successful Cilium deployment
251+
multusDeployer := multus.NewMultusDeployer(c.client, c.helmChartInfoGetter)
252+
if err := multusDeployer.DeployWithCNI(ctx, cluster, multus.CNITypeCilium, targetNamespace, log); err != nil {
253+
log.Error(err, "failed to deploy Multus alongside Cilium")
254+
// Don't fail the entire deployment if Multus fails, just log the error
255+
log.Info("Cilium deployed successfully but Multus deployment failed")
256+
}
257+
249258
resp.SetStatus(runtimehooksv1.ResponseStatusSuccess)
250259
}
251260

0 commit comments

Comments
 (0)