AB#2544 add upgrade agent for automatic version updates (#745)

This commit is contained in:
Moritz Sanft 2022-12-25 18:49:45 +01:00 committed by GitHub
parent cff735b0ee
commit 9859b30c4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 715 additions and 24 deletions

View file

@ -31,6 +31,7 @@ import (
"github.com/edgelesssys/constellation/v2/internal/crypto"
"github.com/edgelesssys/constellation/v2/internal/file"
"github.com/edgelesssys/constellation/v2/internal/installer"
"github.com/edgelesssys/constellation/v2/internal/logger"
"github.com/edgelesssys/constellation/v2/internal/versions"
"github.com/spf13/afero"
@ -40,9 +41,7 @@ import (
const (
// kubeletStartTimeout is the maximum time given to the kubelet service to (re)start.
kubeletStartTimeout = 10 * time.Minute
// crdTimeout is the maximum time given to the CRDs to be created.
crdTimeout = 30 * time.Second
executablePerm = 0o544
kubeletServicePath = "/usr/lib/systemd/system/kubelet.service"
)
@ -56,7 +55,7 @@ type Client interface {
AnnotateNode(ctx context.Context, nodeName, annotationKey, annotationValue string) error
}
type installer interface {
type componentsInstaller interface {
Install(
ctx context.Context, kubernetesComponent versions.ComponentVersion,
) error
@ -64,14 +63,14 @@ type installer interface {
// KubernetesUtil provides low level management of the kubernetes cluster.
type KubernetesUtil struct {
inst installer
inst componentsInstaller
file file.Handler
}
// NewKubernetesUtil creates a new KubernetesUtil.
func NewKubernetesUtil() *KubernetesUtil {
return &KubernetesUtil{
inst: newOSInstaller(),
inst: installer.NewOSInstaller(),
file: file.NewHandler(afero.NewOsFs()),
}
}