templateagent

package
v0.15.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// Private value keys that are used internally by the addon template controller, should not be exposed to users.
	// All private value keys should begin with "__"
	NodePlacementPrivateValueKey    = "__NODE_PLACEMENT"
	RegistriesPrivateValueKey       = "__REGISTRIES"
	InstallNamespacePrivateValueKey = "__INSTALL_NAMESPACE"
)
View Source
const (
	// AddonTemplateLabelKey is the label key to set addon template name. It is to set the resources on the hub relating
	// to an addon template
	AddonTemplateLabelKey = "open-cluster-management.io/addon-template-name"
)

Variables

This section is empty.

Functions

func AddonManagerNamespace

func AddonManagerNamespace() string

func AddonTemplateConfigRef

func AddonTemplateConfigRef(
	configReferences []addonapiv1alpha1.ConfigReference) (bool, addonapiv1alpha1.ConfigReference)

AddonTemplateConfigRef return the first addon template config

func CustomSignedSecretName

func CustomSignedSecretName(addonName, signerName string) string

func CustomSignerConfigurations

func CustomSignerConfigurations(addonName, agentName string,
	customSignerConfig *addonapiv1alpha1.CustomSignerRegistrationConfig,
) func(cluster *clusterv1.ManagedCluster) []addonapiv1alpha1.RegistrationConfig

CustomSignerConfigurations returns a func that can generate RegistrationConfig for CustomSigner type registration addon

func CustomSignerWithExpiry

func CustomSignerWithExpiry(
	kubeclient kubernetes.Interface,
	customSignerConfig *addonapiv1alpha1.CustomSignerRegistrationConfig,
	duration time.Duration) agent.CSRSignerFunc

func CustomerSignerCSRApprover

func CustomerSignerCSRApprover(logger klog.Logger, agentName string) agent.CSRApproveFunc

CustomerSignerCSRApprover approve the csr when addon agent uses custom signer to sign csr.

func GetAddOnRegistriesPrivateValuesFromClusterAnnotation added in v0.12.0

func GetAddOnRegistriesPrivateValuesFromClusterAnnotation(
	logger klog.Logger,
	cluster *clusterv1.ManagedCluster,
	_ *addonapiv1alpha1.ManagedClusterAddOn) (addonfactory.Values, error)

func GetAddOnTemplateSpecHash added in v0.12.0

func GetAddOnTemplateSpecHash(template *addonapiv1alpha1.AddOnTemplate) (string, error)

GetAddOnTemplateSpecHash returns the sha256 hash of the spec field of the addon template

func HubKubeconfigSecretName

func HubKubeconfigSecretName(addonName string) string

func KubeClientCSRApprover

func KubeClientCSRApprover(agentName string) agent.CSRApproveFunc

KubeClientCSRApprover approve the csr when addon agent uses default group, default user and "kubernetes.io/kube-apiserver-client" signer to sign csr.

func SupportAddOnTemplate

func SupportAddOnTemplate(cma *addonapiv1alpha1.ClusterManagementAddOn) bool

SupportAddOnTemplate return true if the given ClusterManagementAddOn supports the AddOnTemplate

func ToAddOnInstallNamespacePrivateValues added in v0.14.0

func ToAddOnInstallNamespacePrivateValues(config addonapiv1alpha1.AddOnDeploymentConfig) (addonfactory.Values, error)

func ToAddOnNodePlacementPrivateValues

func ToAddOnNodePlacementPrivateValues(config addonapiv1alpha1.AddOnDeploymentConfig) (addonfactory.Values, error)

ToAddOnNodePlacementPrivateValues only transform the AddOnDeploymentConfig NodePlacement part into Values object with a specific key, this value would be used by the addon template controller

func ToAddOnRegistriesPrivateValues

func ToAddOnRegistriesPrivateValues(config addonapiv1alpha1.AddOnDeploymentConfig) (addonfactory.Values, error)

ToAddOnRegistriesPrivateValues only transform the AddOnDeploymentConfig Registries part into Values object with a specific key, this value would be used by the addon template controller

Types

type CRDTemplateAgentAddon

type CRDTemplateAgentAddon struct {
	// contains filtered or unexported fields
}

func NewCRDTemplateAgentAddon

func NewCRDTemplateAgentAddon(
	ctx context.Context,
	addonName string,
	hubKubeClient kubernetes.Interface,
	addonClient addonv1alpha1client.Interface,
	addonInformers addoninformers.SharedInformerFactory,
	rolebindingLister rbacv1lister.RoleBindingLister,
	recorder events.Recorder,
	getValuesFuncs ...addonfactory.GetValuesFunc,
) *CRDTemplateAgentAddon

NewCRDTemplateAgentAddon creates a CRDTemplateAgentAddon instance

func (*CRDTemplateAgentAddon) GetAgentAddonOptions

func (a *CRDTemplateAgentAddon) GetAgentAddonOptions() agent.AgentAddonOptions

func (*CRDTemplateAgentAddon) GetDesiredAddOnTemplate

func (a *CRDTemplateAgentAddon) GetDesiredAddOnTemplate(addon *addonapiv1alpha1.ManagedClusterAddOn,
	clusterName, addonName string) (*addonapiv1alpha1.AddOnTemplate, error)

GetDesiredAddOnTemplate returns the desired AddOnTemplate for the given ManagedClusterAddOn. If the desired AddOnTemplate is not found in the ManagedClusterAddOn Status ConfigReferences, it will return a nil AddOnTemplate with no error. the caller should handle the nil AddOnTemplate case.

func (*CRDTemplateAgentAddon) Manifests

func (*CRDTemplateAgentAddon) TemplateAgentRegistrationNamespaceFunc added in v0.14.0

func (a *CRDTemplateAgentAddon) TemplateAgentRegistrationNamespaceFunc(
	addon *addonapiv1alpha1.ManagedClusterAddOn) (string, error)

TemplateAgentRegistrationNamespaceFunc reads deployment/daemonset resources in the manifests and use that namespace as the default registration namespace. If addonDeploymentConfig is set, uses the namespace in it.

func (*CRDTemplateAgentAddon) TemplateCSRApproveCheckFunc

func (a *CRDTemplateAgentAddon) TemplateCSRApproveCheckFunc() agent.CSRApproveFunc

func (*CRDTemplateAgentAddon) TemplateCSRConfigurationsFunc

func (a *CRDTemplateAgentAddon) TemplateCSRConfigurationsFunc() func(cluster *clusterv1.ManagedCluster) []addonapiv1alpha1.RegistrationConfig

func (*CRDTemplateAgentAddon) TemplateCSRSignFunc

func (a *CRDTemplateAgentAddon) TemplateCSRSignFunc() agent.CSRSignerFunc

func (*CRDTemplateAgentAddon) TemplatePermissionConfigFunc

func (a *CRDTemplateAgentAddon) TemplatePermissionConfigFunc() agent.PermissionConfigFunc

TemplatePermissionConfigFunc returns a func that can grant permission for addon agent that is deployed by addon template. the returned func will create a rolebinding to bind the clusterRole/role which is specified by the user, so the user is required to make sure the existence of the clusterRole/role

Jump to

Keyboard shortcuts

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