Skip to content

Commit

Permalink
feat: sentinel-command without nsenter by default
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Kotzbauer <[email protected]>
  • Loading branch information
ckotzbauer committed Aug 4, 2023
1 parent 16dc5e3 commit 617d3cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/kured/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,14 @@ func root(cmd *cobra.Command, args []string) {
// To run those commands as it was the host, we'll use nsenter
// Relies on hostPID:true and privileged:true to enter host mount space
// PID set to 1, until we have a better discovery mechanism.
hostSentinelCommand := buildHostCommand(1, sentinelCommand)
hostRestartCommand := buildHostCommand(1, restartCommand)

// Only wrap sentinel-command with nsenter, if a custom-command was configured, otherwise use the host-path mount
hostSentinelCommand := sentinelCommand
if rebootSentinelCommand != "" {
hostSentinelCommand = buildHostCommand(1, sentinelCommand)
}

go rebootAsRequired(nodeID, hostRestartCommand, hostSentinelCommand, window, lockTTL, lockReleaseDelay)
go maintainRebootRequiredMetric(nodeID, hostSentinelCommand)

Expand Down
8 changes: 8 additions & 0 deletions kured-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ spec:
effect: NoSchedule
hostPID: true # Facilitate entering the host mount namespace via init
restartPolicy: Always
volumes:
- name: sentinel
hostPath:
path: /var/run
containers:
- name: kured
# If you find yourself here wondering why there is no
Expand All @@ -48,6 +52,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- mountPath: /var/run
name: sentinel
readOnly: true
command:
- /usr/bin/kured
# - --force-reboot=false
Expand Down

0 comments on commit 617d3cd

Please sign in to comment.