namespacesync

package
v0.24.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package syncclusterclass provides a controller that copies ClusterClasses and their referenced Templates from a source namespace to target namespaces.

For every ClusterClass in the source namespace, the controller creates a copy of it, and all its referenced Templates, in the target namespace.

Resources in target namespaces are not updated, even if they are updated or deleted in the source namespace.

+kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io;bootstrap.cluster.x-k8s.io;controlplane.cluster.x-k8s.io,resources=*,verbs=get;list;watch;create +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=clusterclasses,verbs=get;list;watch;create +kubebuilder:rbac:groups="",resources=namespaces,verbs=get;list;watch

Copyright 2024 Nutanix. All rights reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var NamespaceHasLabelKey = func(key string) func(ns *corev1.Namespace) bool {
	return func(ns *corev1.Namespace) bool {
		_, ok := ns.GetLabels()[key]
		return ok
	}
}

Functions

This section is empty.

Types

type Options

type Options struct {
	Enabled                 bool
	Concurrency             int
	SourceNamespace         string
	TargetNamespaceLabelKey string
}

func (*Options) AddFlags

func (o *Options) AddFlags(flags *pflag.FlagSet)

type Reconciler

type Reconciler struct {
	Client client.Client

	// UnstructuredCachingClient provides a client that forces caching of unstructured objects,
	// optimizing reads of provider-specific resources.
	UnstructuredCachingClient client.Client

	// SourceClusterClassNamespace is the namespace from which ClusterClasses are copied.
	SourceClusterClassNamespace string

	// IsTargetNamespace determines whether ClusterClasses should be copied to a given namespace.
	IsTargetNamespace func(ns *corev1.Namespace) bool
}

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(
	ctx context.Context,
	req ctrl.Request,
) (
	_ ctrl.Result,
	rerr error,
)

func (*Reconciler) SetupWithManager

func (r *Reconciler) SetupWithManager(
	ctx context.Context,
	mgr ctrl.Manager,
	options *controller.Options,
) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL