fix(init): allow custom image for kubeadm (#212)
This commit is contained in:
parent
ca9719cd72
commit
0bbd8a4dd2
@ -153,6 +153,14 @@ func (k *Kubeadm) ConditionFunc(data *userdata.UserData) conditions.ConditionFun
|
||||
// Start implements the Service interface.
|
||||
// nolint: dupl
|
||||
func (k *Kubeadm) Start(data *userdata.UserData) error {
|
||||
// Set the image.
|
||||
var image string
|
||||
if data.Services.Kubeadm != nil && data.Services.Kubeadm.Image != "" {
|
||||
image = data.Services.Kubeadm.Image
|
||||
} else {
|
||||
image = constants.KubernetesImage
|
||||
}
|
||||
|
||||
// We only wan't to run kubeadm if it hasn't been ran already.
|
||||
if _, err := os.Stat("/var/etc/kubernetes/kubelet.conf"); !os.IsNotExist(err) {
|
||||
return nil
|
||||
@ -189,7 +197,7 @@ func (k *Kubeadm) Start(data *userdata.UserData) error {
|
||||
return r.Run(
|
||||
data,
|
||||
args,
|
||||
runner.WithContainerImage(constants.KubernetesImage),
|
||||
runner.WithContainerImage(image),
|
||||
runner.WithOCISpecOpts(
|
||||
containerd.WithMemoryLimit(int64(1000000*512)),
|
||||
containerd.WithRootfsPropagation("slave"),
|
||||
|
@ -84,6 +84,7 @@ type Kubelet struct {
|
||||
|
||||
// Kubeadm describes the set of configuration options available for kubeadm.
|
||||
type Kubeadm struct {
|
||||
Image string `yaml:"image,omitempty"`
|
||||
Configuration runtime.Object `yaml:"configuration"`
|
||||
bootstrap bool
|
||||
controlPlane bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user