mirror of
https://github.com/siderolabs/talos.git
synced 2025-09-14 02:11:10 +02:00
The gist is that `kubelet` service code only manages the container lifecycle, while `kubelet` configuration is managed now in the controllers and resources. New resources: * `secrets.Kubelet` contains Kubelet PKI derived directly from the machine configuration * `k8s.KubeletConfig` contains Kubelet non-secret config derived directly from the machine configuration * `k8s.NodeIPConfig` contains configuration on picking up Node IP for the kubelet (from machine configuration) * `k8s.NodeIP` contains actual Node IPs picked from the node addresses based on `NodeIPConfig` * `k8s.KubeletSpec` contains final `kubelet` container configuration, including merged arguments, KubeletConfig, etc. It is derived from `KubeletConfig`, `Nodename` and `NodeIP`. Final controller `KubeletServiceController` writes down configuration and PKI to disk, and manages restart/start of the `kubelet` service which is a pure wrapper around container lifecycle. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package secrets_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/cosi-project/runtime/pkg/resource"
|
|
"github.com/cosi-project/runtime/pkg/state"
|
|
"github.com/cosi-project/runtime/pkg/state/impl/inmem"
|
|
"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
|
|
"github.com/cosi-project/runtime/pkg/state/registry"
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/talos-systems/talos/pkg/machinery/resources/secrets"
|
|
)
|
|
|
|
func TestRegisterResource(t *testing.T) {
|
|
ctx := context.TODO()
|
|
|
|
resources := state.WrapCore(namespaced.NewState(inmem.Build))
|
|
resourceRegistry := registry.NewResourceRegistry(resources)
|
|
|
|
for _, resource := range []resource.Resource{
|
|
&secrets.API{},
|
|
&secrets.CertSAN{},
|
|
&secrets.Etcd{},
|
|
&secrets.EtcdRoot{},
|
|
&secrets.Kubelet{},
|
|
&secrets.Kubernetes{},
|
|
&secrets.KubernetesRoot{},
|
|
&secrets.OSRoot{},
|
|
} {
|
|
assert.NoError(t, resourceRegistry.Register(ctx, resource))
|
|
}
|
|
}
|