Skip to content

Commit f9d98d6

Browse files
Merge pull request #2028 from ardaguclu/ocpbugs-56691
OCPBUGS-56691: Rely on overall available disk space of the mounted volume
2 parents 5377cad + 1e410d6 commit f9d98d6

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

pkg/cli/admin/mustgather/mustgather.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ var (
8484
volumeUsageCheckerScript = `
8585
echo "volume percentage checker started....."
8686
while true; do
87-
disk_usage=$(du -s "%s" | awk '{print $1}')
88-
disk_space=$(df -P "%s" | awk 'NR==2 {print $2}')
89-
usage_percentage=$(( (disk_usage * 100) / disk_space ))
87+
usage_percentage=$(df -P "%s" | awk 'NR==2 {print $5}' | sed 's/%%//')
9088
echo "volume usage percentage $usage_percentage"
9189
if [ "$usage_percentage" -gt "%d" ]; then
9290
echo "Disk usage exceeds the volume percentage of %d for mounted directory. Exiting..."
@@ -143,7 +141,7 @@ func NewMustGatherOptions(streams genericiooptions.IOStreams) *MustGatherOptions
143141
SourceDir: "/must-gather/",
144142
IOStreams: streams,
145143
Timeout: 10 * time.Minute,
146-
VolumePercentage: 30,
144+
VolumePercentage: 50,
147145
}
148146
opts.LogOut = opts.newPrefixWriter(streams.Out, "[must-gather ] OUT", false, true)
149147
opts.RawOut = opts.newPrefixWriter(streams.Out, "", false, false)
@@ -469,7 +467,7 @@ func (o *MustGatherOptions) Run() error {
469467
}
470468
var hasMaster bool
471469
for _, node := range nodes.Items {
472-
if _, ok := node.Labels["node-role.kubernetes.io/master"]; ok {
470+
if _, ok := node.Labels["node-role.kubernetes.io/control-plane"]; ok {
473471
hasMaster = true
474472
break
475473
}
@@ -931,7 +929,7 @@ func (o *MustGatherOptions) newPod(node, image string, hasMaster bool) *corev1.P
931929
corev1.LabelOSStable: "linux",
932930
}
933931
if node == "" && hasMaster {
934-
nodeSelector["node-role.kubernetes.io/master"] = ""
932+
nodeSelector["node-role.kubernetes.io/control-plane"] = ""
935933
}
936934

937935
executedCommand := "/usr/bin/gather"
@@ -940,7 +938,7 @@ func (o *MustGatherOptions) newPod(node, image string, hasMaster bool) *corev1.P
940938
}
941939

942940
cleanedSourceDir := path.Clean(o.SourceDir)
943-
volumeUsageChecker := fmt.Sprintf(volumeUsageCheckerScript, cleanedSourceDir, cleanedSourceDir, o.VolumePercentage, o.VolumePercentage, executedCommand)
941+
volumeUsageChecker := fmt.Sprintf(volumeUsageCheckerScript, cleanedSourceDir, o.VolumePercentage, o.VolumePercentage, executedCommand)
944942

945943
ret := &corev1.Pod{
946944
ObjectMeta: metav1.ObjectMeta{

0 commit comments

Comments
 (0)