controllers

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const CAPI_VERSION = "v1beta1"
View Source
const LocalK8sApiServer = "https://kubernetes.default.svc"

LocalK8sApiServer is the address of the API server got the local cluster

View Source
const MilliResyncPeriod = 10000

MilliResyncPeriod is the duration between two synchronization attempt of a given resource

View Source
const PROGRESSION_ANNOTATION = "clusterdef.kanod.io/progression"

annotation for the move process

View Source
const PivotMilliResyncPeriod = 5000
View Source
const (
	TIMEOUT = 3600
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterDefConfig

type ClusterDefConfig struct {
	ArgoCDNamespace   string
	ClusterFileName   string
	PluginName        string
	InfraNamespace    string
	KanodOperatorCrd  string
	MilliResyncPeriod int
}

ClusterDefConfig contains global parameters of the ClusterDef operator. Typical operators are the location and credentials of the snapshot repository, location of base cluster models and infrastructure parameters.

func MakeConfig added in v0.7.0

func MakeConfig() *ClusterDefConfig

MakeConfig initializes the global configuration of the controller

type ClusterDefReconciler

type ClusterDefReconciler struct {
	client.Client
	Log             logr.Logger
	Scheme          *runtime.Scheme
	Config          *ClusterDefConfig
	State           map[string]*ClusterDefStateCache
	BrokerdefClient *broker.ClientWithResponses
	BrokernetClient *http.Client
}

ClusterDefReconciler reconciles a ClusterDef object

func (*ClusterDefReconciler) ApplyData added in v0.8.0

func (r *ClusterDefReconciler) ApplyData(ctx context.Context, env *Env, resource string, data []byte, cache *ClusterDefStateCache) error

func (*ClusterDefReconciler) ApplyFile added in v0.8.0

func (r *ClusterDefReconciler) ApplyFile(ctx context.Context, env *Env, url string, cache *ClusterDefStateCache) error

func (*ClusterDefReconciler) MapObjectToClusterDef added in v0.7.2

func (r *ClusterDefReconciler) MapObjectToClusterDef(ctx context.Context, object client.Object) []reconcile.Request

MapObjectToClusterDef associates the ClusterDef that triggered the creation of the cluster that owns this object.

func (*ClusterDefReconciler) NewHttpClient added in v0.8.5

func (r *ClusterDefReconciler) NewHttpClient(Certificate string) *http.Client

func (*ClusterDefReconciler) Reconcile

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

Reconcile implements the core logic

func (*ClusterDefReconciler) SetupWithManager

func (r *ClusterDefReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager registers the controller for ClusterDef

func (*ClusterDefReconciler) StoreTargetClusterInfo added in v0.8.0

func (r *ClusterDefReconciler) StoreTargetClusterInfo(
	ctx context.Context,
	cache *ClusterDefStateCache,
	clusterDef *gitopsv1.ClusterDef,
	log logr.Logger,
) error

func (*ClusterDefReconciler) UpdateArgoCDConfig added in v0.8.0

func (r *ClusterDefReconciler) UpdateArgoCDConfig(
	ctx context.Context,
	clusterName string,
	kubeConfig *clientapi.Config,
) error

Create in the cluster the secret for ArgoCD

func (*ClusterDefReconciler) UpdatePivotStatus added in v0.8.0

func (r *ClusterDefReconciler) UpdatePivotStatus(
	nsName types.NamespacedName,
	pivotStatus gitopsv1.PivotState,
) error

UpdateConditions method update the status of a clusterDef resource

func (*ClusterDefReconciler) UpdateStatus added in v0.7.2

func (r *ClusterDefReconciler) UpdateStatus(
	nsName types.NamespacedName,
	phase gitopsv1.ClusterDefState,
	cpVersion string,
	versions []string,
	pivotStatus gitopsv1.PivotState,
) error

UpdateConditions method update the status of a clusterDef resource

func (*ClusterDefReconciler) WithHttpsClient added in v0.9.4

func (r *ClusterDefReconciler) WithHttpsClient(Certificate string) broker.ClientOption

type ClusterDefStateCache

type ClusterDefStateCache struct {
	// ClusterName is the name of target cluster-api definition
	ClusterName string
	// ClusterNamespace is the namespace of target cluster-api definition
	ClusterNamespace string
	// Kubeconfig is the config of target
	Kubeconfig *clientapi.Config
	// ServerURL is the cached URL of the workload cluster API endpoint
	ServerURL string
	// TargetClient is a kubernetes client for the target (workload) cluster
	TargetClient *clientgo.Clientset
	// isClusterPivoted
	IsClusterPivoted bool
	// isClusterReady
	IsClusterReady bool
	// PivotStatus
	PivotStatus gitopsv1.PivotState
}

type Env added in v0.8.0

type Env struct {
	Env    map[string]string
	Errors []string
}

func (*Env) Getenv added in v0.8.0

func (e *Env) Getenv(key string) string

func (*Env) Setenv added in v0.8.0

func (e *Env) Setenv(key string, val string)

type NetDefCredentials added in v0.8.5

type NetDefCredentials struct {
	Username string
	Password string
}

type PasswordData added in v0.8.5

type PasswordData struct {
	Password string
}

type TransientState

type TransientState int

TransientState is the state of reconciler during the pivoting process

const (
	// TSNotPivoted
	TSNotPivoted TransientState = iota
	// TSStoreTargetClusterInfo
	TSStoreTargetClusterInfo
	// TSUndeployLocalIronic
	TSUndeployLocalIronic
	// TSCheckIronicIsUndeployed
	TSCheckIronicIsUndeployed
	// TSInstallKanodOperator
	TSInstallKanodOperator
	// TSWaitForKanodOperator
	TSWaitForKanodOperator
	// TSMoveKanod
	TSMoveKanod
	// TSWaitForStackDeployed
	TSWaitForStackDeployed
	// TSDeleteArgoCdApp
	TSDeleteArgoCdApp
	// TSLabelResources
	TSLabelResources
	// TSPauseBareMetalPool
	TSPauseBareMetalPool
	// TSPauseByoHostPool
	TSPauseByoHostPool
	// TSPauseAndConfigureByoHost
	TSPauseAndConfigureByoHost
	// TSPauseNetwork
	TSPauseNetwork
	// TSPivotNetworkResources
	TSPivotNetworkResources
	// TSPivotResources
	TSPivotResources
	// TSUnlabelResources
	TSUnlabelResources
	// TSPivotBmpResources
	TSPivotBmpResources
	// TSPivotByoHostPoolResources
	TSPivotByoHostPoolResources
	// TSActivateNetwork
	TSActivateNetwork
	// TSActivateBareMetalPool
	TSActivateBareMetalPool
	// TSActivateByoHost
	TSActivateByoHost
	// TSActivateBareMetalPool
	TSActivateByoHostPool
	// TSRedeployLocalIronic
	TSRedeployLocalIronic
	// TSCheckIronicIsdeployed
	TSCheckIronicIsdeployed
	// TSConfigureArgoApp
	TSConfigureArgoApp
	// ClusterPivoted
	TSClusterPivoted
)

Jump to

Keyboard shortcuts

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