Skip to content

Commit

Permalink
Add a Kine fix when rke2 restart apiserver
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Savian <[email protected]>

Remove unnecessary socket code

Signed-off-by: Vitor Savian <[email protected]>
  • Loading branch information
vitorsavian committed May 20, 2024
1 parent 3e0fb75 commit 7f1fbe0
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions pkg/podexecutor/staticpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,19 +317,17 @@ func (s *StaticPodConfig) APIServer(_ context.Context, etcdReady <-chan struct{}
files = append(files, etcdNameFile(s.DataDir))
}

sockets := []string{}
if s.ExternalDatabase {
sockets = append(sockets, kineSock(s.DataDir))
}

dirs := onlyExisting(ssldirs)
if auditLogFile != "" && auditLogFile != "-" {
dirs = append(dirs, filepath.Dir(auditLogFile))
excludeFiles = append(excludeFiles, auditLogFile)
}

// Need to mount the entire server file to when use kine it does not delay when
// kine refresh the socket
// encryption config is refreshed by the secrets-encryption controller
// so we mount the directory to allow the pod to see the updates
dirs = append(dirs, filepath.Join(s.DataDir, "server/cred"))
dirs = append(dirs, filepath.Join(s.DataDir, "server"))
excludeFiles = append(excludeFiles, filepath.Join(s.DataDir, "server/cred/encryption-config.json"))

apiServerArgs := staticpod.Args{
Expand All @@ -345,7 +343,6 @@ func (s *StaticPodConfig) APIServer(_ context.Context, etcdReady <-chan struct{}
ExtraEnv: s.ControlPlaneEnv.KubeAPIServer,
ExtraMounts: s.ControlPlaneMounts.KubeAPIServer,
ProbeConfs: s.ControlPlaneProbeConfs.KubeAPIServer,
Sockets: sockets,
Files: files,
ExcludeFiles: excludeFiles,
HealthExec: []string{
Expand Down Expand Up @@ -389,11 +386,6 @@ func (s *StaticPodConfig) Scheduler(_ context.Context, apiReady <-chan struct{},
files = append(files, etcdNameFile(s.DataDir))
}

sockets := []string{}
if s.ExternalDatabase {
sockets = append(sockets, kineSock(s.DataDir))
}

args = append(permitPortSharingFlag, args...)
return after(apiReady, func() error {
return staticpod.Run(s.ManifestsDir, staticpod.Args{
Expand All @@ -411,7 +403,6 @@ func (s *StaticPodConfig) Scheduler(_ context.Context, apiReady <-chan struct{},
ExtraMounts: s.ControlPlaneMounts.KubeScheduler,
ProbeConfs: s.ControlPlaneProbeConfs.KubeScheduler,
Files: files,
Sockets: sockets,
})
})
}
Expand Down Expand Up @@ -461,11 +452,6 @@ func (s *StaticPodConfig) ControllerManager(_ context.Context, apiReady <-chan s
files = append(files, etcdNameFile(s.DataDir))
}

sockets := []string{}
if s.ExternalDatabase {
sockets = append(sockets, kineSock(s.DataDir))
}

return after(apiReady, func() error {
extraArgs := []string{
"--flex-volume-plugin-dir=/var/lib/kubelet/volumeplugins",
Expand All @@ -488,7 +474,6 @@ func (s *StaticPodConfig) ControllerManager(_ context.Context, apiReady <-chan s
ExtraMounts: s.ControlPlaneMounts.KubeControllerManager,
ProbeConfs: s.ControlPlaneProbeConfs.KubeControllerManager,
Files: files,
Sockets: sockets,
})
})
}
Expand Down

0 comments on commit 7f1fbe0

Please sign in to comment.