Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions bindata/v3.11.0/kube-controller-manager/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ metadata:
kube-controller-manager: "true"
revision: "REVISION"
spec:
initContainers:
- name: wait-for-host-port
image: ${IMAGE}
imagePullPolicy: IfNotPresent
command: ['/usr/bin/timeout', '100', "/bin/bash", "-c"] # 60 sec for graceful termination, 35 for minimum-termination-duration
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sttts I've copied 100 here, if you know any reason this should be shorter lemme know

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can. We don't have graceful termination for kube-controller-manager. 10 or at most 30 secs would be a good number.

args:
- |
echo -n "Waiting for port :10257 to be released."
while [ -n "$(lsof -ni :10257)" ]; do
echo -n "."
sleep 1
done
containers:
- name: kube-controller-manager-REVISION
image: ${IMAGE}
Expand Down
16 changes: 11 additions & 5 deletions pkg/operator/targetconfigcontroller/targetconfigcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,27 @@ func manageKubeControllerManagerConfig(client corev1client.ConfigMapsGetter, rec

func managePod(client corev1client.ConfigMapsGetter, recorder events.Recorder, operatorConfig *operatorv1.KubeControllerManager, imagePullSpec string) (*corev1.ConfigMap, bool, error) {
required := resourceread.ReadPodV1OrDie(v311_00_assets.MustAsset("v3.11.0/kube-controller-manager/pod.yaml"))
// TODO: If the image pull spec is not specified, the "${IMAGE}" will be used as value and the pod will fail to start.
if len(imagePullSpec) > 0 {
required.Spec.Containers[0].Image = imagePullSpec
if len(required.Spec.InitContainers) > 0 {
required.Spec.InitContainers[0].Image = imagePullSpec
}
}
var v int
switch operatorConfig.Spec.LogLevel {
case operatorv1.Normal:
required.Spec.Containers[0].Args = append(required.Spec.Containers[0].Args, fmt.Sprintf("-v=%d", 2))
v = 2
case operatorv1.Debug:
required.Spec.Containers[0].Args = append(required.Spec.Containers[0].Args, fmt.Sprintf("-v=%d", 4))
v = 4
case operatorv1.Trace:
required.Spec.Containers[0].Args = append(required.Spec.Containers[0].Args, fmt.Sprintf("-v=%d", 6))
v = 6
case operatorv1.TraceAll:
required.Spec.Containers[0].Args = append(required.Spec.Containers[0].Args, fmt.Sprintf("-v=%d", 8))
v = 8
default:
required.Spec.Containers[0].Args = append(required.Spec.Containers[0].Args, fmt.Sprintf("-v=%d", 2))
v = 2
}
required.Spec.Containers[0].Args = append(required.Spec.Containers[0].Args, fmt.Sprintf("-v=%d", v))

configMap := resourceread.ReadConfigMapV1OrDie(v311_00_assets.MustAsset("v3.11.0/kube-controller-manager/pod-cm.yaml"))
configMap.Data["pod.yaml"] = resourceread.WritePodV1OrDie(required)
Expand Down
12 changes: 12 additions & 0 deletions pkg/operator/v311_00_assets/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.