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 c8259f3 commit 3e8bbbe
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 @@ -40,7 +40,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 _, exist := SystemNamespaces[pod.Namespace]; exist {
return nil
Expand All @@ -60,7 +60,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 @@ -74,26 +74,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 @@ -106,7 +106,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 @@ -104,7 +104,7 @@ data:
matchLabels:
app: nginx
initContainerTemplate:
name: qos-initializer-container
name: crane-qos-initializer
image: docker.io/gocrane/qos-init:v0.1.6
imagePullPolicy: IfNotPresent
args:
Expand All @@ -120,10 +120,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 3e8bbbe

Please sign in to comment.