Documentation
¶
Index ¶
- Constants
- Variables
- func CheckIfMinorVersionUpdate(old, new string) (bool, error)
- func ComputeKubeletConfigChange(oldConfig, newConfig *kubeletconfigv1beta1.KubeletConfiguration) (bool, bool, error)
- type Reconciler
- func (r *Reconciler) AddToManager(ctx context.Context, mgr manager.Manager) error
- func (r *Reconciler) EnqueueWithJitterDelay(ctx context.Context, log logr.Logger) handler.EventHandler
- func (r *Reconciler) NodeReadyForUpdate() predicate.Predicate
- func (r *Reconciler) NodeToSecretMapper() handler.MapFunc
- func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
- func (r *Reconciler) ReconcileContainerdConfig(ctx context.Context, log logr.Logger, ...) error
- func (r *Reconciler) ReconcileContainerdRegistries(ctx context.Context, log logr.Logger, changes *operatingSystemConfigChanges) (func() error, error)
- func (r *Reconciler) SecretPredicate() predicate.Predicate
Constants ¶
const ControllerName = "operatingsystemconfig"
ControllerName is the name of this controller.
Variables ¶
var ( // KubeletHealthCheckRetryInterval is the interval at which the kubelet health check is retried. Exposed for testing. KubeletHealthCheckRetryInterval = 5 * time.Second // KubeletHealthCheckRetryTimeout is the timeout after which the kubelet health check is considered failed. Exposed for testing. KubeletHealthCheckRetryTimeout = 5 * time.Minute // OSUpdateRetryInterval is the interval between OS update retries. Exported for testing. OSUpdateRetryInterval = 30 * time.Second // OSUpdateRetryTimeout is the timeout for OS update retries. Exported for testing. OSUpdateRetryTimeout = 5 * time.Minute )
var Exec = func(ctx context.Context, command string, arg ...string) ([]byte, error) { return exec.CommandContext(ctx, command, arg...).Output() }
Exec is the execution function to invoke outside binaries. Exposed for testing.
var ExecCommandCombinedOutput = func(ctx context.Context, command string, args ...string) ([]byte, error) { return exec.CommandContext(ctx, command, args...).CombinedOutput() }
ExecCommandCombinedOutput executes the given command with the given arguments and returns the combined output. Exposed for testing.
var GetOSVersion = func(inPlaceUpdates *extensionsv1alpha1.InPlaceUpdates, fs afero.Afero) (*string, error) { if inPlaceUpdates == nil { return nil, nil } os, err := getOperatingSystem(fs) if err != nil { return nil, fmt.Errorf("unable to get operating system name: %w", err) } version := osVersionRegex.FindString(os) if version == "" { return nil, fmt.Errorf("unable to find version in %q with regex: %s", os, osVersionRegex.String()) } return ptr.To(version), nil }
GetOSVersion returns the current operating system version.
var RequestAndStoreKubeconfig = nodeagent.RequestAndStoreKubeconfig
RequestAndStoreKubeconfig is an alias for `nodeagent.RequestAndStoreKubeconfig`. Exposed for tests.
Functions ¶
func CheckIfMinorVersionUpdate ¶ added in v1.118.0
CheckIfMinorVersionUpdate checks if the new kubelet version is a minor version update to the old kubelet version.
func ComputeKubeletConfigChange ¶ added in v1.118.0
func ComputeKubeletConfigChange(oldConfig, newConfig *kubeletconfigv1beta1.KubeletConfiguration) (bool, bool, error)
ComputeKubeletConfigChange computes changes in the kubelet configuration relevant for in-place updates. This function needs to be updated when the kubelet configuration triggers in https://github.com/gardener/gardener/blob/master/docs/usage/shoot-operations/shoot_updates.md#rolling-update-triggers are changed.
Types ¶
type Reconciler ¶
type Reconciler struct {
Client client.Client
Config nodeagentconfigv1alpha1.OperatingSystemConfigControllerConfig
Recorder record.EventRecorder
DBus dbus.DBus
FS afero.Afero
Extractor registry.Extractor
CancelContext context.CancelFunc
HostName string
NodeName string
MachineName string
// Channel and TokenSecretSyncConfigs are used by the reconciler to trigger events for the token reconciler during an in-place service-account-key rotation.
Channel chan event.TypedGenericEvent[*corev1.Secret]
TokenSecretSyncConfigs []nodeagentconfigv1alpha1.TokenSecretSyncConfig
}
Reconciler decodes the OperatingSystemConfig resources from secrets and applies the systemd units and files to the node.
func (*Reconciler) AddToManager ¶
AddToManager adds Reconciler to the given manager.
func (*Reconciler) EnqueueWithJitterDelay ¶
func (r *Reconciler) EnqueueWithJitterDelay(ctx context.Context, log logr.Logger) handler.EventHandler
EnqueueWithJitterDelay returns handler.Funcs which enqueues the object with a random jitter duration for 'update' events. 'Create' events are enqueued immediately.
func (*Reconciler) NodeReadyForUpdate ¶ added in v1.118.0
func (r *Reconciler) NodeReadyForUpdate() predicate.Predicate
NodeReadyForUpdate returns a predicate that returns - true for Create event if the new node has the InPlaceUpdate condition with the reason ReadyForUpdate. - true for Update event if the new node has the InPlaceUpdate condition with the reason ReadyForUpdate and old node doesn't. - false for Delete and Generic events.
func (*Reconciler) NodeToSecretMapper ¶ added in v1.118.0
func (r *Reconciler) NodeToSecretMapper() handler.MapFunc
NodeToSecretMapper returns a mapper that returns requests for a secret based on its node.
func (*Reconciler) Reconcile ¶
func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
Reconcile decodes the OperatingSystemConfig resources from secrets and applies the systemd units and files to the node.
func (*Reconciler) ReconcileContainerdConfig ¶ added in v1.100.0
func (r *Reconciler) ReconcileContainerdConfig(ctx context.Context, log logr.Logger, osc *extensionsv1alpha1.OperatingSystemConfig) error
ReconcileContainerdConfig sets required values of the given containerd configuration.
func (*Reconciler) ReconcileContainerdRegistries ¶ added in v1.100.0
func (r *Reconciler) ReconcileContainerdRegistries(ctx context.Context, log logr.Logger, changes *operatingSystemConfigChanges) (func() error, error)
ReconcileContainerdRegistries configures desired registries for containerd and cleans up abandoned ones. Registries without readiness probes are added synchronously and related errors are returned immediately. Registries with configured readiness probes are added asynchronously and must be waited for by invoking the returned function.
func (*Reconciler) SecretPredicate ¶
func (r *Reconciler) SecretPredicate() predicate.Predicate
SecretPredicate returns the predicate for Secret events.