Skip to content

Commit

Permalink
MGMT-16001: Sanitize reclaim daemonset name
Browse files Browse the repository at this point in the history
https://issues.redhat.com/browse/MGMT-16001
Recently there have been errors running the reclaim
agent when unbinding due to the daemonset's
container's name containing dots. This replaces
all dot characters `.` with underscore characters `_`.
  • Loading branch information
CrystalChun committed Oct 24, 2023
1 parent 8c966c0 commit 726d107
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion internal/controller/controllers/agent_reclaimer.go
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"

"github.com/kelseyhightower/envconfig"
authzv1 "github.com/openshift/api/authorization/v1"
Expand Down Expand Up @@ -235,7 +236,7 @@ func (r *agentReclaimer) createNextStepRunnerDaemonSet(ctx context.Context, c cl
})
}

name := fmt.Sprintf("%s-reclaim", nodeName)
name := fmt.Sprintf("%s-reclaim", strings.ReplaceAll(nodeName, ".", "_"))
var privileged bool = true
containers := []corev1.Container{{
Name: name,
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/controllers/agent_reclaimer_test.go
Expand Up @@ -290,10 +290,10 @@ var _ = Context("with a fake client", func() {
})
})

Describe("createNextStepRunnerDaemonSet", func() {
Describe("CC createNextStepRunnerDaemonSet", func() {
var (
nodeName = "node.example.com"
daemonSetName = "node.example.com-reclaim"
daemonSetName = "node_example_com-reclaim"
infraEnvID string
hostID string
nodeUID string
Expand Down

0 comments on commit 726d107

Please sign in to comment.