Documentation
¶
Index ¶
- Constants
- func FluxResourceName(clusterName, helmDeploymentName, providerName string) string
- type HelmDeploymentClusterController
- type HelmDeploymentController
- func (c *HelmDeploymentController) ManageSecrets(ctx context.Context, targetClusterClient client.Client, ...) *errutils.ReasonableErrorList
- func (c *HelmDeploymentController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (c *HelmDeploymentController) SetupWithManager(mgr ctrl.Manager) error
- type ReconcileResult
- type SecretCopy
- type SecretCopyTarget
- type SecretsToCopy
- func (stc *SecretsToCopy) CopySecrets(target SecretCopyTarget, sourceNamespace string, ...) *SecretsToCopy
- func (stc *SecretsToCopy) CopyToPlatformCluster(sourceNamespace string, sourceAndTargetNames ...pairs.Pair[string, string]) *SecretsToCopy
- func (stc *SecretsToCopy) CopyToTargetCluster(sourceNamespace string, sourceAndTargetNames ...pairs.Pair[string, string]) *SecretsToCopy
- func (stc *SecretsToCopy) List(platformClusterNamespace, targetClusterNamespace string) []SecretCopy
Constants ¶
const ( ControllerName = "HelmDeployer" EventActionReconcile = "Reconcile" )
const (
SubControllerName = "Cluster"
)
Variables ¶
This section is empty.
Functions ¶
func FluxResourceName ¶
FluxResourceName generates a name for the flux resources related to a specific combination of Cluster and HelmDeployment.
Types ¶
type HelmDeploymentClusterController ¶
type HelmDeploymentClusterController struct {
PlatformCluster *clusters.Cluster
ProviderName string
// contains filtered or unexported fields
}
func TestHelmDeploymentClusterController ¶
func TestHelmDeploymentClusterController(platformCluster *clusters.Cluster, providerName string, fakeClients map[string]client.Client) *HelmDeploymentClusterController
TestHelmDeploymentClusterController creates a new instance of the cluster controller. THIS CONSTRUCTOR IS MEANT FOR UNIT TESTS AND SHOULD NEVER BE CALLED OUTSIDE OF TESTS. It sets the default trigger channel to nil (reconciliation needs to be triggered manually in unit tests) and configues the ClusterAccessReconciler to use fake clients for AccessRequests. AccessRequests created internally by the controller will use the fake clients from the mapping, if the requested cluster's "<namespace>/<name>" matches a key in the mapping. Otherwise, a new fake client will be created and added to the mapping.
func (*HelmDeploymentClusterController) GetAccessForCluster ¶
func (c *HelmDeploymentClusterController) GetAccessForCluster(ctx context.Context, cluster *clustersv1alpha1.Cluster) (*clustersv1alpha1.AccessRequest, *clusters.Cluster, error)
type HelmDeploymentController ¶
type HelmDeploymentController struct {
PlatformCluster *clusters.Cluster
ProviderName string
ProviderNamespace string
Environment string
// contains filtered or unexported fields
}
func NewHelmDeploymentController ¶
func NewHelmDeploymentController(platformCluster *clusters.Cluster, recorder events.EventRecorder, providerName, providerNamespace, environment string) *HelmDeploymentController
func TestHelmDeploymentController ¶
func TestHelmDeploymentController(platformCluster *clusters.Cluster, providerName, providerNamespace, environment string, clusterReconciler *HelmDeploymentClusterController, clusterReconcileQueue collections.Queue[*clustersv1alpha1.Cluster]) *HelmDeploymentController
TestHelmDeploymentController creates a new instance of the HelmDeploymentController. THIS CONSTRUCTOR IS MEANT FOR UNIT TESTS AND SHOULD NEVER BE CALLED OUTSIDE OF TESTS. It uses a queue instead of a channel for triggering cluster reconciliation, since this is easier to handle in unit tests.
func (*HelmDeploymentController) ManageSecrets ¶
func (c *HelmDeploymentController) ManageSecrets(ctx context.Context, targetClusterClient client.Client, expectedLabels map[string]string, secretsToCopy ...SecretCopy) *errutils.ReasonableErrorList
ManageSecrets manages the secret copying. It copies all specified secrets to the specified clusters and removes all secrets (within the corresponding namespaces) which have the desired labels but were not specified to copy. It returns errors if - a secret cannot be created or deleted due to some issue with the cluster (reason is 'PlatformClusterInteractionProblem' or 'TargetClusterInteractionProblem') - a secret should be updated, but the existing secret does not have the expected labels (reason is 'ConfigurationProblem') - a SecretCopy is invalid (reason is 'ConfigurationProblem')
func (*HelmDeploymentController) SetupWithManager ¶
func (c *HelmDeploymentController) SetupWithManager(mgr ctrl.Manager) error
type ReconcileResult ¶
type ReconcileResult struct {
ctrlutils.ReconcileResult[*helmv1alpha1.HelmDeployment]
// SourceKind indicates which kind of Flux source was reconciled for this HelmDeployment, if any.
SourceKind string
// Selector is the resolved selector for this HelmDeployment.
Selector *clustersv1alpha1.IdentityLabelPurposeSelector
// SecretsToCopy contains a definition of which secrets need to be copied where for this HelmDeployment.
SecretsToCopy *SecretsToCopy
// Config is the provider configuration.
Config *helmv1alpha1.HelmDeployerConfig
}
type SecretCopy ¶
type SecretCopy struct {
// Source is the source secret.
// Always refers to the platform cluster.
Source commonapi.ObjectReference `json:"source"`
// Target is the target secret.
// Cluster specifies which cluster it refers to.
Target commonapi.ObjectReference `json:"target"`
// Cluster specifies which Cluster the secret should be copied to.
Cluster SecretCopyTarget `json:"cluster"`
}
type SecretCopyTarget ¶
type SecretCopyTarget string
const ( ToPlatformCluster SecretCopyTarget = "platform" ToTargetCluster SecretCopyTarget = "target" )
type SecretsToCopy ¶
type SecretsToCopy struct {
// contains filtered or unexported fields
}
SecretsToCopy is basically a list of secret copying instructions, but it is internally represented as maps for a more efficient detection of conflicts.
func NewSecretsToCopy ¶
func NewSecretsToCopy() *SecretsToCopy
func (*SecretsToCopy) CopySecrets ¶
func (stc *SecretsToCopy) CopySecrets(target SecretCopyTarget, sourceNamespace string, sourceAndTargetNames ...pairs.Pair[string, string]) *SecretsToCopy
CopySecrets adds secrets which should be copied. Multiple secrets can be specified, but they all need to go to the same target (either platform cluster or target cluster). Source and target names are specified as pairs with the source name being the pair's key and the target name being its value. In case of a conflict (identical target secret), newly appended instructions overwrite previous ones. Modifies the struct in-place, but returns it for chaining.
func (*SecretsToCopy) CopyToPlatformCluster ¶
func (stc *SecretsToCopy) CopyToPlatformCluster(sourceNamespace string, sourceAndTargetNames ...pairs.Pair[string, string]) *SecretsToCopy
CopyToPlatformCluster adds secrets which should be copied to the Cluster's namespace on the platform cluster. It is an alias for CopySecrets(ToPlatformCluster, ....).
func (*SecretsToCopy) CopyToTargetCluster ¶
func (stc *SecretsToCopy) CopyToTargetCluster(sourceNamespace string, sourceAndTargetNames ...pairs.Pair[string, string]) *SecretsToCopy
CopyToTargetCluster adds secrets which should be copied to the designated namespace on the target cluster. It is an alias for CopySecrets(ToTargetCluster, ....).
func (*SecretsToCopy) List ¶
func (stc *SecretsToCopy) List(platformClusterNamespace, targetClusterNamespace string) []SecretCopy
List returns the secret copy instructions as a list. All information necessary for copying is contained in the list (except for the cluster clients).