Skip to content

Commit 1b710a4

Browse files
committed
kubeadm: modify how component volumes are printed
After the shift for init phases, GetStaticPodSpecs() from app/phases/controlplane/manifests.go gets called on each control-plane component sub-phase. This ends up calling the Printf from AddExtraHostPathMounts() in app/phases/controlplane/volumes.go multiple times printing the same volumes for different components. - Remove the Printf call from AddExtraHostPathMounts(). - Print all volumes for a component in CreateStaticPodFiles() using klog V(2). Perhaps in the future a bigger refactor is needed here were a single control-plane component spec can be requested instead of a map[string]v1.Pod.
1 parent ca23b07 commit 1b710a4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cmd/kubeadm/app/phases/controlplane/manifests.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ func CreateStaticPodFiles(manifestDir, kustomizeDir string, cfg *kubeadmapi.Clus
9999
return errors.Errorf("couldn't retrieve StaticPodSpec for %q", componentName)
100100
}
101101

102+
// print all volumes that are mounted
103+
for _, v := range spec.Spec.Volumes {
104+
klog.V(2).Infof("[control-plane] adding volume %q for component %q", v.Name, componentName)
105+
}
106+
102107
// if kustomizeDir is defined, customize the static pod manifest
103108
if kustomizeDir != "" {
104109
kustomizedSpec, err := staticpodutil.KustomizeStaticPod(&spec, kustomizeDir)

cmd/kubeadm/app/phases/controlplane/volumes.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ func (c *controlPlaneHostPathMounts) AddHostPathMounts(component string, vols []
144144
// paths in the case that a user specifies the same volume/volume mount name.
145145
func (c *controlPlaneHostPathMounts) AddExtraHostPathMounts(component string, extraVols []kubeadmapi.HostPathMount) {
146146
for _, extraVol := range extraVols {
147-
fmt.Printf("[control-plane] Adding extra host path mount %q to %q\n", extraVol.Name, component)
148147
hostPathType := extraVol.PathType
149148
c.NewHostPathMount(component, extraVol.Name, extraVol.HostPath, extraVol.MountPath, extraVol.ReadOnly, &hostPathType)
150149
}

0 commit comments

Comments
 (0)