Skip to content

Commit

Permalink
Fix log level.
Browse files Browse the repository at this point in the history
  • Loading branch information
payall4u committed Nov 29, 2023
1 parent f91585f commit 7be30c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions pkg/webhooks/pod/mutating.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (m *MutatingAdmission) Default(ctx context.Context, obj runtime.Object) err
return fmt.Errorf("expected a Pod but got a %T", obj)
}

klog.Infof("mutating started for pod %s/%s", pod.Namespace, pod.Name)
klog.V(2).Infof("Mutating started for pod %s/%s", pod.Namespace, pod.Name)

if m.Config == nil || !m.Config.QOSInitializer.Enable {
return nil
Expand All @@ -52,7 +52,7 @@ func (m *MutatingAdmission) Default(ctx context.Context, obj runtime.Object) err
}

if !ls.Matches(labels.Set(pod.Labels)) {
klog.Infof("injection skipped: webhook is not interested in the pod")
klog.V(2).Infof("Injection skipped: webhook is not interested in the pod")
return nil
}

Expand All @@ -66,26 +66,26 @@ func (m *MutatingAdmission) Default(ctx context.Context, obj runtime.Object) err
****************************************************************/
qos := util.MatchPodAndPodQOSSlice(pod, qosSlice)
if qos == nil {
klog.Infof("injection skipped: no podqos matched")
klog.V(2).Infof("Injection skipped: no podqos matched")
return nil
}

if qos.Spec.ResourceQOS.CPUQOS == nil ||
qos.Spec.ResourceQOS.CPUQOS.CPUPriority == nil ||
*qos.Spec.ResourceQOS.CPUQOS.CPUPriority == 0 {
klog.Infof("injection skipped: not a low CPUPriority pod, qos %s", qos.Name)
klog.V(2).Infof("Injection skipped: not a low CPUPriority pod, qos %s", qos.Name)
return nil
}
for _, container := range pod.Spec.InitContainers {
if container.Name == m.Config.QOSInitializer.InitContainerTemplate.Name {
klog.Infof("injection skipped: pod has initializerContainer already")
klog.V(2).Infof("Injection skipped: pod has initializerContainer already")
return nil
}
}

for _, volume := range pod.Spec.Volumes {
if volume.Name == m.Config.QOSInitializer.VolumeTemplate.Name {
klog.Infof("injection skipped: pod has initializerVolume already")
klog.V(2).Infof("Injection skipped: pod has initializerVolume already")
return nil
}
}
Expand All @@ -98,7 +98,7 @@ func (m *MutatingAdmission) Default(ctx context.Context, obj runtime.Object) err
pod.Spec.Volumes = append(pod.Spec.Volumes, *m.Config.QOSInitializer.VolumeTemplate)
}

klog.Infof("mutating completed for pod %s/%s", pod.Namespace, pod.Name)
klog.V(2).Infof("Mutating completed for pod %s/%s", pod.Namespace, pod.Name)

return nil
}
6 changes: 3 additions & 3 deletions tools/initializer/resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ data:
matchLabels:
app: nginx
initContainerTemplate:
name: qos-initializer-container
name: crane-qos-initializer
image: docker.io/gocrane/qos-init:v0.1.4
imagePullPolicy: IfNotPresent
args:
Expand All @@ -119,10 +119,10 @@ data:
cpu: 10m
memory: 10Mi
volumeMounts:
- name: qos-initializer-volume
- name: crane-qos-initializer-volume
mountPath: /etc/podinfo
volumeTemplate:
name: qos-initializer-volume
name: crane-qos-initializer-volume
downwardAPI:
items:
- path: "annotations"
Expand Down

0 comments on commit 7be30c9

Please sign in to comment.