Skip to content

Commit

Permalink
Improvement: Cleanup of flags, handle --resolv-conf flag deprecation (#…
Browse files Browse the repository at this point in the history
…329)

Signed-off-by: archups <[email protected]>
  • Loading branch information
archups authored Nov 21, 2023
1 parent f1e9ab1 commit cfc41fb
Show file tree
Hide file tree
Showing 22 changed files with 45 additions and 143 deletions.
7 changes: 2 additions & 5 deletions deploy/osps/default/osp-amzn2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ spec:
ExecStartPre=/bin/bash /opt/disable-swap.sh
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand Down Expand Up @@ -618,11 +618,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
Expand Down
7 changes: 2 additions & 5 deletions deploy/osps/default/osp-centos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ spec:
ExecStartPre=/bin/bash /opt/disable-swap.sh
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand Down Expand Up @@ -656,11 +656,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
Expand Down
15 changes: 3 additions & 12 deletions deploy/osps/default/osp-flatcar-cloud-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo -e "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
Expand Down Expand Up @@ -539,7 +536,7 @@ spec:
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand Down Expand Up @@ -574,13 +571,6 @@ spec:
[Install]
WantedBy=multi-user.target
- path: /etc/systemd/system/kubelet.service.d/extras.conf
content:
inline:
data: |
[Service]
Environment="KUBELET_EXTRA_ARGS=--resolv-conf=/run/systemd/resolve/resolv.conf"
- path: /opt/bin/setup_kernel_for_kubelet.sh
permissions: 755
content:
Expand Down Expand Up @@ -717,6 +707,7 @@ spec:
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
volumePluginDir: /var/lib/kubelet/volumeplugins
volumeStatsAggPeriod: 0s
resolvConf: /run/systemd/resolve/resolv.conf
- path: /etc/systemd/system/kubelet-healthcheck.service
permissions: 644
Expand Down
15 changes: 3 additions & 12 deletions deploy/osps/default/osp-flatcar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo -e "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
Expand Down Expand Up @@ -598,7 +595,7 @@ spec:
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand Down Expand Up @@ -633,13 +630,6 @@ spec:
[Install]
WantedBy=multi-user.target
- path: /etc/systemd/system/kubelet.service.d/extras.conf
content:
inline:
data: |
[Service]
Environment="KUBELET_EXTRA_ARGS=--resolv-conf=/run/systemd/resolve/resolv.conf"
- path: /etc/kubernetes/cloud-config
permissions: 600
content:
Expand Down Expand Up @@ -759,6 +749,7 @@ spec:
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
volumePluginDir: /var/lib/kubelet/volumeplugins
volumeStatsAggPeriod: 0s
resolvConf: /run/systemd/resolve/resolv.conf
- path: /etc/systemd/system/kubelet-healthcheck.service
permissions: 644
Expand Down
7 changes: 2 additions & 5 deletions deploy/osps/default/osp-rhel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ spec:
ExecStartPre=/bin/bash /opt/disable-swap.sh
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand Down Expand Up @@ -659,11 +659,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
Expand Down
7 changes: 2 additions & 5 deletions deploy/osps/default/osp-rockylinux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ spec:
ExecStartPre=/bin/bash /opt/disable-swap.sh
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand Down Expand Up @@ -663,11 +663,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
Expand Down
16 changes: 3 additions & 13 deletions deploy/osps/default/osp-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ spec:
ExecStartPre=/bin/bash /opt/disable-swap.sh
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand Down Expand Up @@ -600,14 +600,6 @@ spec:
[Install]
WantedBy=multi-user.target
- path: /etc/systemd/system/kubelet.service.d/extras.conf
content:
inline:
encoding: b64
data: |
[Service]
Environment="KUBELET_EXTRA_ARGS=--resolv-conf=/run/systemd/resolve/resolv.conf"
- path: /etc/kubernetes/cloud-config
permissions: 600
content:
Expand Down Expand Up @@ -673,11 +665,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
Expand Down Expand Up @@ -827,6 +816,7 @@ spec:
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
volumePluginDir: /var/lib/kubelet/volumeplugins
volumeStatsAggPeriod: 0s
resolvConf: /run/systemd/resolve/resolv.conf
- path: /etc/systemd/system/kubelet-healthcheck.service
permissions: 644
Expand Down
15 changes: 3 additions & 12 deletions pkg/controllers/osc/testdata/osc-flatcar-aws-containerd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo -e "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
path: /opt/bin/setup_net_env.sh
Expand Down Expand Up @@ -424,7 +421,7 @@ spec:
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand All @@ -440,13 +437,6 @@ spec:
WantedBy=multi-user.target
path: /etc/systemd/system/kubelet.service
permissions: 644
- content:
inline:
data: |
[Service]
Environment="KUBELET_EXTRA_ARGS=--resolv-conf=/run/systemd/resolve/resolv.conf"
path: /etc/systemd/system/kubelet.service.d/extras.conf
permissions: 644
- content:
inline:
data: |+
Expand Down Expand Up @@ -534,6 +524,7 @@ spec:
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
volumePluginDir: /var/lib/kubelet/volumeplugins
volumeStatsAggPeriod: 0s
resolvConf: /run/systemd/resolve/resolv.conf
path: /etc/kubernetes/kubelet.conf
permissions: 644
- content:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ spec:
ExecStartPre=/bin/bash /opt/disable-swap.sh
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand All @@ -409,14 +409,6 @@ spec:
encoding: b64
path: /etc/systemd/system/kubelet.service
permissions: 644
- content:
inline:
data: |
[Service]
Environment="KUBELET_EXTRA_ARGS=--resolv-conf=/run/systemd/resolve/resolv.conf"
encoding: b64
path: /etc/systemd/system/kubelet.service.d/extras.conf
permissions: 644
- content:
inline:
data: |+
Expand Down Expand Up @@ -457,11 +449,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
encoding: b64
Expand Down Expand Up @@ -596,6 +585,7 @@ spec:
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
volumePluginDir: /var/lib/kubelet/volumeplugins
volumeStatsAggPeriod: 0s
resolvConf: /run/systemd/resolve/resolv.conf
encoding: b64
path: /etc/kubernetes/kubelet.conf
permissions: 644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ spec:
ExecStartPre=/bin/bash /opt/disable-swap.sh
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand Down Expand Up @@ -487,11 +487,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
encoding: b64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ spec:
ExecStartPre=/bin/bash /opt/disable-swap.sh
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand Down Expand Up @@ -464,11 +464,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
encoding: b64
Expand Down
16 changes: 3 additions & 13 deletions pkg/controllers/osc/testdata/osc-ubuntu-aws-containerd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ spec:
ExecStartPre=/bin/bash /opt/disable-swap.sh
ExecStartPre=/bin/bash /opt/load-kernel-modules.sh
ExecStartPre=/bin/bash /opt/bin/setup_net_env.sh
ExecStart=/opt/bin/kubelet $KUBELET_EXTRA_ARGS \
ExecStart=/opt/bin/kubelet \
--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--config=/etc/kubernetes/kubelet.conf \
Expand All @@ -409,14 +409,6 @@ spec:
encoding: b64
path: /etc/systemd/system/kubelet.service
permissions: 644
- content:
inline:
data: |
[Service]
Environment="KUBELET_EXTRA_ARGS=--resolv-conf=/run/systemd/resolve/resolv.conf"
encoding: b64
path: /etc/systemd/system/kubelet.service.d/extras.conf
permissions: 644
- content:
inline:
data: |+
Expand Down Expand Up @@ -457,11 +449,8 @@ spec:
if grep -q coreos /etc/os-release
then
echo "KUBELET_NODE_IP=${DEFAULT_IFC_IP}\nKUBELET_HOSTNAME=${FULL_HOSTNAME}" > /etc/kubernetes/nodeip.conf
elif [ ! -d /etc/systemd/system/kubelet.service.d ]
then
echodate "Can't find kubelet service extras directory"
exit 1
else
mkdir -p /etc/systemd/system/kubelet.service.d
echo -e "[Service]\nEnvironment=\"KUBELET_NODE_IP=${DEFAULT_IFC_IP}\"\nEnvironment=\"KUBELET_HOSTNAME=${FULL_HOSTNAME}\"" > /etc/systemd/system/kubelet.service.d/nodeip.conf
fi
encoding: b64
Expand Down Expand Up @@ -600,6 +589,7 @@ spec:
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305
volumePluginDir: /var/lib/kubelet/volumeplugins
volumeStatsAggPeriod: 0s
resolvConf: /run/systemd/resolve/resolv.conf
encoding: b64
path: /etc/kubernetes/kubelet.conf
permissions: 644
Expand Down
Loading

0 comments on commit cfc41fb

Please sign in to comment.