Skip to content

Commit

Permalink
Allow the BootstrapClient task to run after Protokube
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciprian Hacman committed Sep 11, 2020
1 parent c1e0991 commit 5a9a7b1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
9 changes: 8 additions & 1 deletion upup/pkg/fi/nodeup/nodetasks/bootstrap_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ var _ fi.HasName = &BootstrapClient{}
var _ fi.HasDependencies = &BootstrapClient{}

func (b *BootstrapClient) GetDependencies(tasks map[string]fi.Task) []fi.Task {
return nil
// BootstrapClient depends on the protokube service to ensure gossip DNS
var deps []fi.Task
for _, v := range tasks {
if svc, ok := v.(*Service); ok && svc.Name == protokubeService {
deps = append(deps, v)
}
}
return deps
}

func (b *BootstrapClient) GetName() *string {
Expand Down
5 changes: 0 additions & 5 deletions upup/pkg/fi/nodeup/nodetasks/load_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ import (
"k8s.io/kops/util/pkg/hashing"
)

const (
containerdService = "containerd.service"
dockerService = "docker.service"
)

// LoadImageTask is responsible for downloading a docker image
type LoadImageTask struct {
Name string
Expand Down
22 changes: 19 additions & 3 deletions upup/pkg/fi/nodeup/nodetasks/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ const (
flatcarSystemdSystemPath = "/etc/systemd/system"

containerosSystemdSystemPath = "/etc/systemd/system"

containerdService = "containerd.service"
dockerService = "docker.service"
kubeletService = "kubelet.service"
protokubeService = "protokube.service"
)

type Service struct {
Expand All @@ -67,11 +72,22 @@ func (p *Service) GetDependencies(tasks map[string]fi.Task) []fi.Task {
// LoadImageTask or IssueCert. If there are any LoadImageTasks (e.g. we're
// launching a custom Kubernetes build), they all depend on
// the "docker.service" Service task.
switch v.(type) {
case *File, *Package, *UpdatePackages, *UserTask, *GroupTask, *Chattr, *BindMount, *Archive:
switch v := v.(type) {
case *Package, *UpdatePackages, *UserTask, *GroupTask, *Chattr, *BindMount, *Archive:
deps = append(deps, v)
case *Service, *LoadImageTask, *IssueCert:
case *Service, *LoadImageTask, *IssueCert, *BootstrapClient:
// ignore
case *File:
// Skip adding kubeconfig files as dependencies for services other than kubelet
if strings.HasSuffix(v.Path, "/kubeconfig") && p.Name != kubeletService {
continue
}
deps = append(deps, v)
case *KubeConfig:
// Only add kubeconfigs as dependencies for kubelet
if p.Name == kubeletService {
deps = append(deps, v)
}
default:
klog.Warningf("Unhandled type %T in Service::GetDependencies: %v", v, v)
deps = append(deps, v)
Expand Down

0 comments on commit 5a9a7b1

Please sign in to comment.