Skip to content

Commit 7ced7dd

Browse files
authored
docs, thick plugin: align docs with new configuration reference (#1055)
* config, daemon: shim socket path is not needed The shim socket dir attribute is only required for the shim (cni configuration). Thus, it can be removed from the daemon configuration. Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com> * config, daemon: rename socket dir attribute Now the socketDir parameter no longer stutters. Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com> * docs, thick plugin: align docs with new configuration reference PR #1053 - [0] - changed the thick plugin configuration to happen exclusively via the user provided config map. This PR aligns the multus documentation with the existing code. [0] - k8snetworkplumbingwg/multus-cni#1053 Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com> --------- Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
1 parent 21f84c0 commit 7ced7dd

File tree

9 files changed

+54
-38
lines changed

9 files changed

+54
-38
lines changed

cmd/multus-daemon/main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func main() {
133133
configurationOptions = append(
134134
configurationOptions,
135135
config.WithCniConfigDir(multusConf.CniConfigDir),
136-
config.WithSocketDir(daemonConf.DaemonSocketDir))
136+
config.WithSocketDir(daemonConf.SocketDir))
137137

138138
var logOptionFuncs []config.LogOptionFunc
139139
if multusConf.LogMaxAge != defaultMultusLogMaxAge {
@@ -226,7 +226,7 @@ func startMultusDaemon(daemonConfig *types.ControllerNetConf, stopCh chan struct
226226
return fmt.Errorf("failed to run multus-daemon with root: %v, now running in uid: %s", err, user.Uid)
227227
}
228228

229-
if err := srv.FilesystemPreRequirements(daemonConfig.DaemonSocketDir); err != nil {
229+
if err := srv.FilesystemPreRequirements(daemonConfig.SocketDir); err != nil {
230230
return fmt.Errorf("failed to prepare the cni-socket for communicating with the shim: %w", err)
231231
}
232232

@@ -243,9 +243,9 @@ func startMultusDaemon(daemonConfig *types.ControllerNetConf, stopCh chan struct
243243
}, 0, stopCh)
244244
}
245245

246-
l, err := srv.GetListener(api.SocketPath(daemonConfig.DaemonSocketDir))
246+
l, err := srv.GetListener(api.SocketPath(daemonConfig.SocketDir))
247247
if err != nil {
248-
return fmt.Errorf("failed to start the CNI server using socket %s. Reason: %+v", api.SocketPath(daemonConfig.DaemonSocketDir), err)
248+
return fmt.Errorf("failed to start the CNI server using socket %s. Reason: %+v", api.SocketPath(daemonConfig.SocketDir), err)
249249
}
250250

251251
server.SetKeepAlivesEnabled(false)

deployments/multus-daemonset-thick.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ data:
117117
"logFile": "/tmp/multus.log",
118118
"binDir": "/opt/cni/bin",
119119
"cniDir": "/var/lib/cni/multus",
120-
"daemonSocketDir": "/host/run/multus/",
120+
"socketDir": "/host/run/multus/",
121121
"cniVersion": "0.3.1",
122122
"cniConfigDir": "/host/etc/cni/net.d",
123123
"multusConfigFile": "auto",

docs/thick-plugin.md

+43-22
Original file line numberDiff line numberDiff line change
@@ -53,38 +53,59 @@ kubectl apply -f deployments/multus-daemonset-thick.yml
5353

5454
### Command line parameters
5555

56-
Multus thick plugin variant accepts the same
57-
[entrypoint arguments](https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/docs/how-to-use.md#entrypoint-script-parameters)
58-
its thin counterpart allows - with the following exceptions:
59-
60-
- `additional-bin-dir`
61-
- `binDir`
62-
- `cleanup-config-on-exit`
63-
- `cniDir`
64-
- `multus-kubeconfig-file-host`
65-
- `rename-conf-file`
66-
- `skip-multus-binary-copy`
67-
68-
It is important to refer that these are command line parameters to the golang
69-
binary; as such, they should be passed using a single dash ("-") e.g.
70-
`-additional-bin-dir=/opt/multus/bin`, `-multus-log-level=debug`, etc.
71-
72-
Furthermore, it also accepts a new command line parameter, where the user
73-
specifies the path to the server configuration:
56+
The available command line parameters are:
7457

7558
- `config`: Defaults to `"/etc/cni/net.d/multus.d/daemon-config.json"`
76-
- `metricsPort`: Metrics port (of multus' metric exporter), default is disable
59+
- `version`: Prints the daemon config version and exits
7760

78-
### Server configuration
61+
### Server / Daemon configuration
7962

8063
The server configuration is encoded in JSON, and allows the following keys:
8164

8265
- `"chrootDir"`: Specify the directory which points to host root from the pod. See 'Chroot configuration' section for the details.
83-
- `"socketDir"`: Specify the location where the unix domain socket used for
84-
client/server communication will be located. Defaults to `"/run/multus"`.
66+
- `"socketDir"`: Specify the location where the unix domain socket used
67+
for client/server communication will be located. This is the location where the
68+
**Daemon** will read the configuration from. Defaults to `"/run/multus"`.
69+
- `"metricsPort"`: Metrics port (of multus' metric exporter); by default, no port
70+
is provided.
71+
- `"logFile"`: the path to where the daemon logs will be persisted.
72+
- `"logLevel"`: the logging level for the multus daemon logs.
73+
- `"logToStderr"`: enable this to have the daemon multus logs echoed to stderr
74+
as well. By default, it is disabled.
8575

8676
In addition, you can add any configuration which is in [configuration reference](https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/docs/configuration.md#multus-cni-configuration-reference). Server configuration override multus CNI configuration (e.g. `/etc/cni/net.d/00-multus.conf`)
8777

78+
Below you can see an example of the daemon configuration:
79+
```json
80+
{
81+
"chrootDir": "/hostroot",
82+
"confDir": "/host/etc/cni/net.d",
83+
"logToStderr": true,
84+
"logLevel": "verbose",
85+
"logFile": "/tmp/multus.log",
86+
"binDir": "/opt/cni/bin",
87+
"cniDir": "/var/lib/cni/multus",
88+
"socketDir": "/host/run/multus/",
89+
"cniVersion": "0.3.1",
90+
"cniConfigDir": "/host/etc/cni/net.d",
91+
"multusConfigFile": "auto",
92+
"multusAutoconfigDir": "/host/etc/cni/net.d"
93+
}
94+
```
95+
96+
### Client / Shim configuration
97+
98+
The multus shim configuration is encoded in JSON, and essentially is just a
99+
regular CNI configuration, usually available in `/etc/cni/net.d/00-multus.conf`.
100+
101+
It allows the following keys:
102+
103+
- `"cniVersion"`: the CNI version for the Multus CNI plugin.
104+
- `"logFile"`: the path to where the daemon logs will be persisted.
105+
- `"logLevel"`: the logging level for the multus daemon logs.
106+
- `"logToStderr"`: enable this to have the daemon multus logs echoed to stderr
107+
as well. By default, it is disabled.
108+
88109
#### Chroot configuration
89110

90111
In thick plugin case, delegate CNI plugin is executed by multus-daemon from Pod, hence if the delegate CNI requires resources in container host, for example unix socket or even file, then CNI plugin is failed to execute because multus-daemon runs in Pod. Multus-daemon supports "chrootDir" option which executes delegate CNI under chroot (to container host).

e2e/templates/multus-daemonset-thick.yml.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ data:
9090
"logFile": "/tmp/multus.log",
9191
"binDir": "/host/opt/cni/bin",
9292
"cniDir": "/var/lib/cni/multus",
93-
"daemonSocketDir": "/host/run/multus",
93+
"socketDir": "/host/run/multus",
9494
"cniVersion": "{{ CNI_VERSION }}",
9595
"cniConfigDir": "/host/etc/cni/net.d",
9696
"multusConfigFile": "auto",

pkg/server/api/shim.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type ShimNetConf struct {
3434
// types.NetConf
3535

3636
CNIVersion string `json:"cniVersion,omitempty"`
37-
MultusSocketDir string `json:"shimSocketDir"`
37+
MultusSocketDir string `json:"daemonSocketDir"`
3838
LogFile string `json:"logFile,omitempty"`
3939
LogLevel string `json:"logLevel,omitempty"`
4040
LogToStderr bool `json:"logToStderr,omitempty"`

pkg/server/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func NewCNIServer(daemonConfig *types.ControllerNetConf, serverConfig []byte) (*
143143
logging.Verbosef("server configured with chroot: %s", daemonConfig.ChrootDir)
144144
}
145145

146-
return newCNIServer(daemonConfig.DaemonSocketDir, kubeClient, exec, serverConfig)
146+
return newCNIServer(daemonConfig.SocketDir, kubeClient, exec, serverConfig)
147147
}
148148

149149
func newCNIServer(rundir string, kubeClient *k8s.ClientInfo, exec invoke.Exec, servConfig []byte) (*Server, error) {

pkg/server/thick_cni_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func referenceConfig(thickPluginSocketDir string) string {
285285
"cniVersion": "0.4.0",
286286
"name": "node-cni-network",
287287
"type": "multus",
288-
"shimSocketDir": "%s",
288+
"daemonSocketDir": "%s",
289289
"defaultnetworkfile": "/tmp/foo.multus.conf",
290290
"defaultnetworkwaitseconds": 3,
291291
"delegates": [{

pkg/types/conf.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ const (
428428
// LoadDaemonNetConf loads the configuration for the multus daemon
429429
func LoadDaemonNetConf(config []byte) (*ControllerNetConf, error) {
430430
daemonNetConf := &ControllerNetConf{
431-
DaemonSocketDir: DefaultMultusRunDir,
431+
SocketDir: DefaultMultusRunDir,
432432
}
433433
if err := json.Unmarshal(config, daemonNetConf); err != nil {
434434
return nil, fmt.Errorf("failed to unmarshall the daemon configuration: %w", err)

pkg/types/types.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,7 @@ type ControllerNetConf struct {
193193

194194
// Option to point to the path of the unix domain socket through which the
195195
// multus client / server communicate.
196-
DaemonSocketDir string `json:"daemonSocketDir"`
197-
198-
// Option to point to the path of the unix domain socket through which the
199-
// multus client / server communicate.
200-
// This attribute is only relevant for the client / shim.
201-
ShimSocketDir string `json:"shimSocketDir"`
196+
SocketDir string `json:"socketDir"`
202197

203198
ConfigFileContents []byte `json:"-"`
204199
}

0 commit comments

Comments
 (0)