Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Add logic to upgrade debian packages #337

Merged
merged 9 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from 6 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
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
# https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/
defaults: &defaults
docker:
- image: docker.io/weaveworks/wksctl-build:switch-away-from-quay-53c3c712-WIP
- image: docker.io/weaveworks/wksctl-build:go-1.14.1-431fabe9
environment:
GOPATH: /go/
SRCDIR: /src/github.com/weaveworks/wksctl
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
fi
unit-tests:
docker:
- image: docker.io/weaveworks/wksctl-build:switch-away-from-quay-53c3c712-WIP
- image: docker.io/weaveworks/wksctl-build:go-1.14.1-431fabe9
environment:
GOPATH: /go
SRCDIR: /src/github.com/weaveworks/wksctl
Expand Down Expand Up @@ -189,7 +189,7 @@ jobs:
#
integration-tests-gcp-centos:
docker:
- image: docker.io/weaveworks/wksctl-build:switch-away-from-quay-53c3c712-WIP
- image: docker.io/weaveworks/wksctl-build:go-1.14.1-431fabe9
environment:
GOPATH: /go/
SRCDIR: /src/github.com/weaveworks/wksctl
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
- run: "true"
integration-tests-gcp-ubuntu:
docker:
- image: docker.io/weaveworks/wksctl-build:switch-away-from-quay-53c3c712-WIP
- image: docker.io/weaveworks/wksctl-build:go-1.14.1-431fabe9
environment:
GOPATH: /go/
SRCDIR: /src/github.com/weaveworks/wksctl
Expand Down Expand Up @@ -261,7 +261,7 @@ jobs:
- run: "true"
integration-tests-gcp-rhel:
docker:
- image: docker.io/weaveworks/wksctl-build:switch-away-from-quay-53c3c712-WIP
- image: docker.io/weaveworks/wksctl-build:go-1.14.1-431fabe9
environment:
GOPATH: /go/
SRCDIR: /src/github.com/weaveworks/wksctl
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ pkg/apis/wksprovider/controller/manifests/manifests_vfsdata.go: $(MANIFESTS)
go generate ./pkg/apis/wksprovider/controller/manifests

CRDS=$(shell find pkg/apis/cluster-api/config/crds -name '*.yaml' -print)
pkg/apis/wksprovider/machine/os/crds_vfsdata.go: $(CRDS)
pkg/apis/wksprovider/machine/crds/crds_vfsdata.go: $(CRDS)
go generate ./pkg/apis/wksprovider/machine/crds

generated: pkg/addons/assets/assets_vfsdata.go pkg/apis/wksprovider/controller/manifests/manifests_vfsdata.go pkg/apis/wksprovider/machine/scripts/scripts_vfsdata.go pkg/apis/wksprovider/machine/os/crds_vfsdata.go
generated: pkg/addons/assets/assets_vfsdata.go pkg/apis/wksprovider/controller/manifests/manifests_vfsdata.go pkg/apis/wksprovider/machine/scripts/scripts_vfsdata.go pkg/apis/wksprovider/machine/crds/crds_vfsdata.go

cmd/wksctl/wksctl: $(DEPS) generated
cmd/wksctl/wksctl: cmd/wksctl/*.go
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/oleiade/reflections v1.0.0 // indirect
github.com/pelletier/go-toml v1.2.0
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.8.1
Expand Down
56 changes: 36 additions & 20 deletions pkg/apis/wksprovider/controller/wksctl/machine_actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,13 +594,41 @@ func (a *MachineActuator) clearUpdateCount(node *corev1.Node) error {
func (a *MachineActuator) kubeadmUpOrDowngrade(machine *clusterv1.Machine, node *corev1.Node, installer *os.OS,
k8sVersion, planKey, planJSON string, ntype nodeType) error {
b := plan.NewBuilder()
b.AddResource(
"upgrade:node-unlock-kubernetes",
&resource.Run{Script: object.String("yum versionlock delete 'kube*' || true")})
b.AddResource(
"upgrade:node-install-kubeadm",
&resource.RPM{Name: "kubeadm", Version: k8sVersion, DisableExcludes: "kubernetes"},
plan.DependOn("upgrade:node-unlock-kubernetes"))
//TODO add OS check and
switch installer.PkgType {
case resource.PkgTypeRPM, resource.PkgTypeRHEL:
b.AddResource(
"upgrade:node-unlock-kubernetes",
&resource.Run{Script: object.String("yum versionlock delete 'kube*' || true")})
b.AddResource(
"upgrade:node-kubelet",
&resource.RPM{Name: "kubelet", Version: k8sVersion, DisableExcludes: "kubernetes"},
plan.DependOn("upgrade:node-unlock-kubernetes"))
b.AddResource(
"upgrade:node-kubectl",
&resource.RPM{Name: "kubectl", Version: k8sVersion, DisableExcludes: "kubernetes"},
plan.DependOn("upgrade:node-kubelet"))
b.AddResource(
"upgrade:node-install-kubeadm",
&resource.RPM{Name: "kubeadm", Version: k8sVersion, DisableExcludes: "kubernetes"},
plan.DependOn("upgrade:node-kubectl"))
b.AddResource(
"upgrade:node-lock-kubernetes",
&resource.Run{Script: object.String("yum versionlock add 'kube*' || true")},
plan.DependOn("upgrade:node-install-kubeadm"))
case resource.PkgTypeDeb:
b.AddResource(
"upgrade:node-kubelet",
&resource.Deb{Name: "kubelet", Suffix: "=" + k8sVersion + "-00"})
b.AddResource(
"upgrade:node-kubectl",
&resource.Deb{Name: "kubectl", Suffix: "=" + k8sVersion + "-00"},
plan.DependOn("upgrade:node-kubelet"))
b.AddResource(
"upgrade:node-install-kubeadm",
&resource.Deb{Name: "kubeadm", Suffix: "=" + k8sVersion + "-00"},
plan.DependOn("upgrade:node-kubectl"))
}

//
// For secondary masters
Expand Down Expand Up @@ -629,22 +657,10 @@ func (a *MachineActuator) kubeadmUpOrDowngrade(machine *clusterv1.Machine, node
&resource.Run{Script: object.String(fmt.Sprintf("kubeadm upgrade node config --kubelet-version %s", k8sVersion))},
plan.DependOn("upgrade:node-install-kubeadm"))
}
b.AddResource(
"upgrade:node-kubelet",
&resource.RPM{Name: "kubelet", Version: k8sVersion, DisableExcludes: "kubernetes"},
plan.DependOn("upgrade:node-kubeadm-upgrade"))
b.AddResource(
"upgrade:node-restart-kubelet",
&resource.Run{Script: object.String("systemctl restart kubelet")},
plan.DependOn("upgrade:node-kubelet"))
b.AddResource(
"upgrade:node-kubectl",
&resource.RPM{Name: "kubectl", Version: k8sVersion, DisableExcludes: "kubernetes"},
plan.DependOn("upgrade:node-restart-kubelet"))
b.AddResource(
"upgrade:node-lock-kubernetes",
&resource.Run{Script: object.String("yum versionlock add 'kube*' || true")},
plan.DependOn("upgrade:node-kubectl"))
plan.DependOn("upgrade:node-kubeadm-upgrade"))

p, err := b.Plan()
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions pkg/apis/wksprovider/machine/crds/crds_vfsdata.go

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