Documentation ¶
Overview ¶
Copyright Contributors to the Open Cluster Management project
Copyright Contributors to the Open Cluster Management project ¶
Copyright Contributors to the Open Cluster Management project
Index ¶
- Constants
- func AgentNamespace(klusterlet *operatorapiv1.Klusterlet) string
- func ApplyDeployment(ctx context.Context, client kubernetes.Interface, ...) (*appsv1.Deployment, operatorapiv1.GenerationStatus, error)
- func ApplyDirectly(ctx context.Context, client kubernetes.Interface, ...) []resourceapply.ApplyResult
- func ApplyEndpoints(ctx context.Context, client coreclientv1.EndpointsGetter, ...) (*corev1.Endpoints, bool, error)
- func BootstrapHubKubeConfigSecret(klusterlet *operatorapiv1.Klusterlet) string
- func BuildFeatureCondition(invalidMsgs ...string) metav1.Condition
- func CleanUpStaticObject(ctx context.Context, client kubernetes.Interface, ...) error
- func ClusterName(klusterlet *operatorapiv1.Klusterlet) string
- func ConvertToFeatureGateFlags(component string, features []operatorapiv1.FeatureGate, ...) ([]string, string)
- func DeleteAllManifestWorks(ctx context.Context, workClient workclient.Interface, ...) error
- func DeleteManagedCluster(ctx context.Context, clusterClient clusterclient.Interface, clusterName string) error
- func DeletePolicies(ctx context.Context, dynamicClient dynamic.Interface, clusterName string) error
- func ExternalManagedClusterKubeConfigSecret(klusterlet *operatorapiv1.Klusterlet) string
- func FeatureGateEnabled(features []operatorapiv1.FeatureGate, ...) bool
- func FindGenerationStatus(generationStatuses []operatorapiv1.GenerationStatus, ...) *operatorapiv1.GenerationStatus
- func FindKlusterletByNamespace(klusterlets []*operatorapiv1.Klusterlet, namespace string) *operatorapiv1.Klusterlet
- func FindRelatedResourcesStatus(relatedResourcesStatuses []operatorapiv1.RelatedResourceMeta, ...) *operatorapiv1.RelatedResourceMeta
- func GenerateRelatedResource(objBytes []byte) (operatorapiv1.RelatedResourceMeta, error)
- func GetComponentNamespace() string
- func HubKubeConfigSecret(klusterlet *operatorapiv1.Klusterlet) string
- func IsClusterUnavailable(ctx context.Context, clusterClient clusterclient.Interface, name string) (bool, error)
- func KlusterletDeploymentQueueKeyFunc(klusterletLister operatorlister.KlusterletLister) factory.ObjectQueueKeyFunc
- func KlusterletNamespace(klusterlet *operatorapiv1.Klusterlet) string
- func KlusterletSecretQueueKeyFunc(klusterletLister operatorlister.KlusterletLister) factory.ObjectQueueKeyFunc
- func LoadClientConfigFromSecret(secret *corev1.Secret) (*rest.Config, error)
- func NewGenerationStatus(gvr schema.GroupVersionResource, object runtime.Object) operatorapiv1.GenerationStatus
- func NumOfUnavailablePod(deployment *appsv1.Deployment) int32
- func RemoveRelatedResourcesStatus(relatedResourcesStatuses *[]operatorapiv1.RelatedResourceMeta, ...)
- func RemoveRelatedResourcesStatuses(relatedResourcesStatuses *[]operatorapiv1.RelatedResourceMeta, ...)
- func RemoveRelatedResourcesStatusesWithObj(relatedResourcesStatuses *[]operatorapiv1.RelatedResourceMeta, objData []byte)
- func SetGenerationStatuses(generationStatuses *[]operatorapiv1.GenerationStatus, ...)
- func SetRelatedResourcesStatuses(relatedResourcesStatuses *[]operatorapiv1.RelatedResourceMeta, ...)
- func SetRelatedResourcesStatusesWithObj(relatedResourcesStatuses *[]operatorapiv1.RelatedResourceMeta, objData []byte)
- func SyncKubeConfigSecret(ctx context.Context, secretName, secretNamespace, kubeconfigPath string, ...) error
- func SyncSecret(ctx context.Context, client, targetClient coreclientv1.SecretsGetter, ...) (*corev1.Secret, bool, error)
- func UpdateKlusterletStatus(ctx context.Context, client operatorv1client.KlusterletInterface, ...) (*operatorapiv1.KlusterletStatus, bool, error)
- type TokenGetterFunc
- type UpdateKlusterletStatusFunc
- func UpdateKlusterletConditionFn(conds ...metav1.Condition) UpdateKlusterletStatusFunc
- func UpdateKlusterletGenerationsFn(generations ...operatorapiv1.GenerationStatus) UpdateKlusterletStatusFunc
- func UpdateKlusterletRelatedResourcesFn(relatedResources ...operatorapiv1.RelatedResourceMeta) UpdateKlusterletStatusFunc
Constants ¶
const ( FeatureGatesTypeValid = "ValidFeatureGates" FeatureGatesReasonAllValid = "FeatureGatesAllValid" FeatureGatesReasonInvalidExisting = "InvalidFeatureGatesExisting" )
const ( // KlusterletDefaultNamespace is the default namespace of klusterlet KlusterletDefaultNamespace = "open-cluster-management-agent" // BootstrapHubKubeConfig is the secret name of bootstrap kubeconfig secret to connect to hub BootstrapHubKubeConfig = "bootstrap-hub-kubeconfig" ControlplaneBootstrapHubKubeConfig = "multicluster-controlplane-svc-kubeconfig" // HubKubeConfig is the secret name of kubeconfig secret to connect to hub with mtls HubKubeConfig = "hub-kubeconfig-secret" // ManagedClusterKubeConfig is the secret name of kubeconfig secret, it is provied by user in the managed cluster // namespace on the controlplane, it only applicable to Hosted mode, klusterlet uses it to install resources // on the managed cluster. ManagedClusterKubeConfig = "managedcluster-kubeconfig" // ExternalManagedClusterKubeConfig is the secret name of kubeconfig secret, it is created by klusterlet with // ManagedClusterKubeConfig, it is in the controlplane namespace on the management cluster, it only applicable to // Hosted mode, controlplane agent uses it connecting to the managed cluster. ExternalManagedClusterKubeConfig = "external-managedcluster-kubeconfig" )
const KlusterletOwnerAnnotation = "operator.open-cluster-management.io/klusterlet-owner"
Variables ¶
This section is empty.
Functions ¶
func AgentNamespace ¶
func AgentNamespace(klusterlet *operatorapiv1.Klusterlet) string
AgentNamespace returns the namespace to deploy the agents. It is on the managed cluster in the Default mode, and on the management cluster in the Hosted mode.
func ApplyDeployment ¶
func ApplyDeployment( ctx context.Context, client kubernetes.Interface, generationStatuses []operatorapiv1.GenerationStatus, nodePlacement operatorapiv1.NodePlacement, manifests resourceapply.AssetFunc, recorder events.Recorder, file string) (*appsv1.Deployment, operatorapiv1.GenerationStatus, error)
func ApplyDirectly ¶
func ApplyDirectly( ctx context.Context, client kubernetes.Interface, apiExtensionClient apiextensionsclient.Interface, recorder events.Recorder, cache resourceapply.ResourceCache, manifests resourceapply.AssetFunc, files ...string) []resourceapply.ApplyResult
func ApplyEndpoints ¶
func ApplyEndpoints(ctx context.Context, client coreclientv1.EndpointsGetter, required *corev1.Endpoints) (*corev1.Endpoints, bool, error)
func BootstrapHubKubeConfigSecret ¶
func BootstrapHubKubeConfigSecret(klusterlet *operatorapiv1.Klusterlet) string
func BuildFeatureCondition ¶
func CleanUpStaticObject ¶
func CleanUpStaticObject( ctx context.Context, client kubernetes.Interface, apiExtensionClient apiextensionsclient.Interface, apiRegistrationClient apiregistrationclient.APIServicesGetter, manifests resourceapply.AssetFunc, file string) error
func ClusterName ¶
func ClusterName(klusterlet *operatorapiv1.Klusterlet) string
func ConvertToFeatureGateFlags ¶
func ConvertToFeatureGateFlags(component string, features []operatorapiv1.FeatureGate, defaultFeatureGates map[featuregate.Feature]featuregate.FeatureSpec) ([]string, string)
func DeleteAllManifestWorks ¶
func DeleteAllManifestWorks( ctx context.Context, workClient workclient.Interface, manifestWorks []workv1.ManifestWork, force bool) error
func DeleteManagedCluster ¶
func DeletePolicies ¶
func ExternalManagedClusterKubeConfigSecret ¶
func ExternalManagedClusterKubeConfigSecret(klusterlet *operatorapiv1.Klusterlet) string
func FeatureGateEnabled ¶
func FeatureGateEnabled(features []operatorapiv1.FeatureGate, defaultFeatures map[featuregate.Feature]featuregate.FeatureSpec, featureName featuregate.Feature) bool
FeatureGateEnabled checks if a feature is enabled or disabled in operator API, or fallback to use the the default setting
func FindGenerationStatus ¶
func FindGenerationStatus(generationStatuses []operatorapiv1.GenerationStatus, generation operatorapiv1.GenerationStatus) *operatorapiv1.GenerationStatus
func FindKlusterletByNamespace ¶
func FindKlusterletByNamespace(klusterlets []*operatorapiv1.Klusterlet, namespace string) *operatorapiv1.Klusterlet
func FindRelatedResourcesStatus ¶
func FindRelatedResourcesStatus( relatedResourcesStatuses []operatorapiv1.RelatedResourceMeta, relatedResource operatorapiv1.RelatedResourceMeta) *operatorapiv1.RelatedResourceMeta
func GenerateRelatedResource ¶
func GenerateRelatedResource(objBytes []byte) (operatorapiv1.RelatedResourceMeta, error)
func GetComponentNamespace ¶
func GetComponentNamespace() string
func HubKubeConfigSecret ¶
func HubKubeConfigSecret(klusterlet *operatorapiv1.Klusterlet) string
func IsClusterUnavailable ¶
func KlusterletDeploymentQueueKeyFunc ¶
func KlusterletDeploymentQueueKeyFunc(klusterletLister operatorlister.KlusterletLister) factory.ObjectQueueKeyFunc
func KlusterletNamespace ¶
func KlusterletNamespace(klusterlet *operatorapiv1.Klusterlet) string
KlusterletNamespace returns the klusterlet namespace on the managed cluster.
func KlusterletSecretQueueKeyFunc ¶
func KlusterletSecretQueueKeyFunc(klusterletLister operatorlister.KlusterletLister) factory.ObjectQueueKeyFunc
func LoadClientConfigFromSecret ¶
LoadClientConfigFromSecret returns a client config loaded from the given secret
func NewGenerationStatus ¶
func NewGenerationStatus(gvr schema.GroupVersionResource, object runtime.Object) operatorapiv1.GenerationStatus
func NumOfUnavailablePod ¶
func NumOfUnavailablePod(deployment *appsv1.Deployment) int32
NumOfUnavailablePod is to check if a deployment is in degraded state.
func RemoveRelatedResourcesStatus ¶
func RemoveRelatedResourcesStatus( relatedResourcesStatuses *[]operatorapiv1.RelatedResourceMeta, relatedResource operatorapiv1.RelatedResourceMeta)
func RemoveRelatedResourcesStatuses ¶
func RemoveRelatedResourcesStatuses( relatedResourcesStatuses *[]operatorapiv1.RelatedResourceMeta, rmRelatedResourcesStatus operatorapiv1.RelatedResourceMeta)
func RemoveRelatedResourcesStatusesWithObj ¶
func RemoveRelatedResourcesStatusesWithObj( relatedResourcesStatuses *[]operatorapiv1.RelatedResourceMeta, objData []byte)
func SetGenerationStatuses ¶
func SetGenerationStatuses(generationStatuses *[]operatorapiv1.GenerationStatus, newGenerationStatus operatorapiv1.GenerationStatus)
func SetRelatedResourcesStatuses ¶
func SetRelatedResourcesStatuses( relatedResourcesStatuses *[]operatorapiv1.RelatedResourceMeta, newRelatedResourcesStatus operatorapiv1.RelatedResourceMeta)
func SetRelatedResourcesStatusesWithObj ¶
func SetRelatedResourcesStatusesWithObj( relatedResourcesStatuses *[]operatorapiv1.RelatedResourceMeta, objData []byte)
func SyncKubeConfigSecret ¶
func SyncKubeConfigSecret(ctx context.Context, secretName, secretNamespace, kubeconfigPath string, templateKubeconfig *rest.Config, secretClient coreclientv1.SecretsGetter, tokenGetter TokenGetterFunc, recorder events.Recorder) error
func SyncSecret ¶
func SyncSecret(ctx context.Context, client, targetClient coreclientv1.SecretsGetter, recorder events.Recorder, sourceNamespace, sourceName, targetNamespace, targetName string, ownerRefs []metav1.OwnerReference) (*corev1.Secret, bool, error)
SyncSecret forked from https://github.com/openshift/library-go/blob/d9cdfbd844ea08465b938c46a16bed2ea23207e4/pkg/operator/resource/resourceapply/core.go#L357, add an addition targetClient parameter to support sync secret to another cluster.
func UpdateKlusterletStatus ¶
func UpdateKlusterletStatus( ctx context.Context, client operatorv1client.KlusterletInterface, klusterletName string, updateFuncs ...UpdateKlusterletStatusFunc) (*operatorapiv1.KlusterletStatus, bool, error)
Types ¶
type TokenGetterFunc ¶
func SATokenGetter ¶
func SATokenGetter(ctx context.Context, saName, saNamespace string, saClient kubernetes.Interface) TokenGetterFunc
SATokenGetter get the saToken of target sa. If there is not secrets in the sa, use the tokenrequest to get a token.
type UpdateKlusterletStatusFunc ¶
type UpdateKlusterletStatusFunc func(status *operatorapiv1.KlusterletStatus) error
func UpdateKlusterletConditionFn ¶
func UpdateKlusterletConditionFn(conds ...metav1.Condition) UpdateKlusterletStatusFunc
func UpdateKlusterletGenerationsFn ¶
func UpdateKlusterletGenerationsFn(generations ...operatorapiv1.GenerationStatus) UpdateKlusterletStatusFunc
func UpdateKlusterletRelatedResourcesFn ¶
func UpdateKlusterletRelatedResourcesFn(relatedResources ...operatorapiv1.RelatedResourceMeta) UpdateKlusterletStatusFunc