#!/bin/sh

ifname=`/usr/bin/grep host_interface /etc/criwpard/criwpard.conf | /usr/bin/cut -d\" -f4`
[ -z "$ifname" ] && exit 1
ipaddr=`/usr/sbin/lsattr -El $ifname -a netaddr -F value`
[ -z "$ipaddr" ] && exit 1

export GOMAXPROCS=3
exec /opt/freeware/bin/kubelet \
  --bootstrap-kubeconfig=/etc/cfc/kubelet/kubelet-bootstrap-config \
  --kubeconfig=/etc/cfc/kubelet/kubelet-config \
  --cert-dir=/etc/cfc/kubelet \
  --config=/etc/cfc/kubelet/kubelet-service-config \
  --dynamic-config-dir=/etc/cfc/kubelet/kubelet-dynamic-config \
  --network-plugin=cni \
  --hostname-override=$ipaddr \
  --node-ip=$ipaddr \
  --node-labels=node-role.kubernetes.io/worker=true \
  --keep-terminated-pod-volumes=false \
  \
  --container-runtime=remote \
  --container-runtime-endpoint=unix:///var/run/criwpard.sock \
  --runtime-request-timeout=10m \
  --register-with-taints=ibm.com/aix=true:NoSchedule \
  --v=2
