resources

package
v0.0.0-...-846bdf4 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 30 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareResourceVersion

func CompareResourceVersion(rv1, rv2 string) bool

CompareResourceVersion is used to compare resource version.

func CreateOrUpdateRole

func CreateOrUpdateRole(ctx context.Context,
	client kubernetes.Interface,
	roleLister rbaclisters.RoleLister,
	rootDir, domainID string,
	ownerRef *metav1.OwnerReference) error

func CreateRoleBinding

func CreateRoleBinding(ctx context.Context, client kubernetes.Interface, domainID string, ownerRef *metav1.OwnerReference) error

func CreateServiceToken

func CreateServiceToken(ctx context.Context, client kubernetes.Interface, domainID string) (*authenticationv1.TokenRequest, error)

func ExtractConfigMap

func ExtractConfigMap(p *corev1.ConfigMap) *corev1.ConfigMap

ExtractConfigMap is used to extract configmap.

func ExtractDomainDataAnnotations

func ExtractDomainDataAnnotations(p *kusciaapisv1alpha1.DomainData) *kusciaapisv1alpha1.DomainData

ExtractDomainDataAnnotations is used to extract domaindata annotations.

func ExtractDomainDataGrantAnnotations

func ExtractDomainDataGrantAnnotations(p *kusciaapisv1alpha1.DomainDataGrant) *kusciaapisv1alpha1.DomainDataGrant

ExtractDomainDataGrantAnnotations is used to extract domaindatagrant annotations.

func ExtractDomainDataGrantLabels

func ExtractDomainDataGrantLabels(p *kusciaapisv1alpha1.DomainDataGrant) *kusciaapisv1alpha1.DomainDataGrant

ExtractDomainDataGrantLabels is used to extract domainadatagrant labels.

func ExtractDomainDataGrantSpec

ExtractDomainDataGrantSpec is used to extract domaindatagrant spec.

func ExtractDomainDataGrantStatus

func ExtractDomainDataGrantStatus(p *kusciaapisv1alpha1.DomainDataGrant) *kusciaapisv1alpha1.DomainDataGrant

ExtractDomainDataGrantStatus is used to extract domaindatagrant status.

func ExtractDomainDataLabels

func ExtractDomainDataLabels(p *kusciaapisv1alpha1.DomainData) *kusciaapisv1alpha1.DomainData

ExtractDomainDataLabels is used to extract domainadata labels.

func ExtractDomainDataSpec

ExtractDomainDataSpec is used to extract domainData spec.

func ExtractPodAnnotations

func ExtractPodAnnotations(p *corev1.Pod) *corev1.Pod

ExtractPodAnnotations is used to extract pod annotations.

func ExtractPodAnnotationsAndLabels

func ExtractPodAnnotationsAndLabels(p *corev1.Pod) *corev1.Pod

ExtractPodAnnotationsAndLabels is used to extract pod annotations and labels.

func ExtractPodLabels

func ExtractPodLabels(p *corev1.Pod) *corev1.Pod

ExtractPodLabels is used to extract pod labels.

func ExtractPodSpec

func ExtractPodSpec(p *corev1.Pod) *corev1.Pod

ExtractPodSpec is used to extract pod spec.

func ExtractPodStatus

func ExtractPodStatus(p *corev1.Pod) *corev1.Pod

ExtractPodStatus is used to extract pod status.

func ExtractService

func ExtractService(p *corev1.Service) *corev1.Service

ExtractService is used to extract service.

func ExtractServiceLabels

func ExtractServiceLabels(p *corev1.Service) *corev1.Service

ExtractServiceLabels is used to extract service labels.

func ExtractTaskResource

ExtractTaskResource is used to extract task resource.

func ExtractTaskResourceStatus

func ExtractTaskResourceStatus(p *kusciaapisv1alpha1.TaskResource) *kusciaapisv1alpha1.TaskResource

ExtractTaskResourceStatus is used to extract task resource status.

func GenerateServiceName

func GenerateServiceName(prefix, portName string) string

GenerateServiceName is used to generate service name. Service name generation rules: 1. If the first character is a number, add svc- as a prefix; 2. If the length of the name exceeds 63 characters, it will be truncated to 63 characters. 3. The final name must comply with DNS subdomain naming rules. 4. Services derivate from same task may have same prefix and different portName suffix segment.

func GetInterConnParties

func GetInterConnParties(annotations map[string]string) map[string]string

func GetInterConnProtocolTypeByPartyAnnotation

func GetInterConnProtocolTypeByPartyAnnotation(key string) kusciaapisv1alpha1.InterConnProtocolType

func GetKusciaJobCondition

GetKusciaJobCondition gets kuscia job condition.

func GetKusciaTaskCondition

GetKusciaTaskCondition gets kuscia task condition.

func GetMasterDomain

func GetMasterDomain(domainLister kuscialistersv1alpha1.DomainLister, domainID string) (string, error)

GetMasterDomain is used to get master domain id.

func GetTaskResourceCondition

GetTaskResourceCondition gets task resource condition.

func GetTaskResourceGroupCondition

GetTaskResourceGroupCondition is used to get task resource group condition.

func IsEmpty

func IsEmpty(v interface{}) bool

IsEmpty will judge whether data is empty

func IsExistingTaskResourceGroupCondition

func IsExistingTaskResourceGroupCondition(status *kusciaapisv1alpha1.TaskResourceGroupStatus, condType kusciaapisv1alpha1.TaskResourceGroupConditionType, condStatus corev1.ConditionStatus) bool

IsExistingTaskResourceGroupCondition checks if TaskResourceGroupCondition exists.

func IsOuterBFIAInterConnDomain

func IsOuterBFIAInterConnDomain(nsLister corelisters.NamespaceLister, domainID string) bool

IsOuterBFIAInterConnDomain checks if outer domain with BFIA protocol.

func IsPartnerDomain

func IsPartnerDomain(nsLister corelisters.NamespaceLister, domainID string) (bool, error)

IsPartnerDomain check if is partner domain.

func MergeKusciaJobConditions

func MergeKusciaJobConditions(kusciaJob *kusciaapisv1alpha1.KusciaJob, conds []kusciaapisv1alpha1.KusciaJobCondition)

MergeKusciaJobConditions merges kuscia job conditions.

func MergeKusciaJobTaskStatus

func MergeKusciaJobTaskStatus(kusciaJob *kusciaapisv1alpha1.KusciaJob, taskPhase map[string]kusciaapisv1alpha1.KusciaTaskPhase) bool

MergeKusciaJobTaskStatus merges task status of kuscia job.

func MergeKusciaTaskConditions

func MergeKusciaTaskConditions(kusciaTask *kusciaapisv1alpha1.KusciaTask, conds []kusciaapisv1alpha1.KusciaTaskCondition)

MergeKusciaTaskConditions merges kuscia task conditions.

func MergeKusciaTaskPartyTaskStatus

func MergeKusciaTaskPartyTaskStatus(kusciaTask *kusciaapisv1alpha1.KusciaTask, partyTaskStatus []kusciaapisv1alpha1.PartyTaskStatus)

MergeKusciaTaskPartyTaskStatus merges party task status of Kuscia task.

func PatchConfigMap

func PatchConfigMap(ctx context.Context, kubeClient kubernetes.Interface, oldCm, newCm *corev1.ConfigMap) error

PatchConfigMap is used to patch configmap.

func PatchDomainData

func PatchDomainData(ctx context.Context, kusciaClient kusciaclientset.Interface, oldDd, newDd *kusciaapisv1alpha1.DomainData) error

PatchDomainData is used to patch domaindata.

func PatchDomainDataGrant

func PatchDomainDataGrant(ctx context.Context, kusciaClient kusciaclientset.Interface, oldDdg, newDdg *kusciaapisv1alpha1.DomainDataGrant) error

PatchDomainDataGrant is used to patch domaindatagrant.

func PatchDomainDataGrantStatus

func PatchDomainDataGrantStatus(ctx context.Context, kusciaClient kusciaclientset.Interface, oldDbg, newDbg *kusciaapisv1alpha1.DomainDataGrant) error

PatchDomainDataGrantStatus is used to patch domaindatagrant status.

func PatchDomainDataStatus

func PatchDomainDataStatus(ctx context.Context, kusciaClient kusciaclientset.Interface, oldDb, newDb *kusciaapisv1alpha1.DomainData) error

PatchDomainDataStatus is used to patch domaindata status.

func PatchPod

func PatchPod(ctx context.Context, kubeClient kubernetes.Interface, oldPod, newPod *corev1.Pod) error

PatchPod is used to patch pod.

func PatchPodStatus

func PatchPodStatus(ctx context.Context, kubeClient kubernetes.Interface, oldPod, newPod *corev1.Pod) error

PatchPodStatus is used to patch pod status.

func PatchService

func PatchService(ctx context.Context, kubeClient kubernetes.Interface, oldSvc, newSvc *corev1.Service) error

PatchService is used to patch service.

func PatchTaskResource

func PatchTaskResource(ctx context.Context, kusciaClient kusciaclientset.Interface, oldTr, newTr *kusciaapisv1alpha1.TaskResource) error

PatchTaskResource is used to patch task resource.

func PatchTaskResourceGroupStatus

func PatchTaskResourceGroupStatus(ctx context.Context, kusciaClient kusciaclientset.Interface, oldTrg, newTrg *kusciaapisv1alpha1.TaskResourceGroup) error

PatchTaskResourceGroupStatus is used to patch task resource group status.

func SelectDeployTemplate

func SelectDeployTemplate(templates []kusciaapisv1alpha1.DeployTemplate, role string) (*kusciaapisv1alpha1.DeployTemplate, error)

SelectDeployTemplate selects a matching template according to the role. value of templates[i].Role may have the following values: 'client', 'server', 'client,server', ... Matching process:

  1. if role [in] template role list, matched.
  2. if template role list is empty,template is universal.
  3. if role is empty,select the first template.

func SelfClusterAsInitiator

func SelfClusterAsInitiator(nsLister corelisters.NamespaceLister, domainID string, annotations map[string]string) bool

SelfClusterAsInitiator checks if self cluster domain is scheduling party.

func SetKusciaJobCondition

func SetKusciaJobCondition(now metav1.Time, cond *kusciaapisv1alpha1.KusciaJobCondition, status corev1.ConditionStatus, reason, message string)

SetKusciaJobCondition sets kuscia job condition.

func SetKusciaTaskCondition

func SetKusciaTaskCondition(now metav1.Time, cond *kusciaapisv1alpha1.KusciaTaskCondition, condStatus corev1.ConditionStatus, condReason, condMessage string) bool

SetKusciaTaskCondition sets kuscia task condition.

func SetTaskResourceGroupCondition

func SetTaskResourceGroupCondition(now *metav1.Time, cond *kusciaapisv1alpha1.TaskResourceGroupCondition, condStatus corev1.ConditionStatus, condReason string) bool

SetTaskResourceGroupCondition sets task resource group condition.

func SplitRSC

func SplitRSC(rsc string, n int) (string, error)

SplitRSC will split the resources into N parts

func UpdateKusciaJob

func UpdateKusciaJob(kusciaClient kusciaclientset.Interface,
	kj *kusciaapisv1alpha1.KusciaJob,
	hasUpdated func(kusciaJob *kusciaapisv1alpha1.KusciaJob) bool,
	update func(kusciaJob *kusciaapisv1alpha1.KusciaJob),
	retries int) (err error)

UpdateKusciaJob updates kuscia job.

func UpdateKusciaJobStage

func UpdateKusciaJobStage(kusciaClient kusciaclientset.Interface,
	kj *kusciaapisv1alpha1.KusciaJob,
	jobStage kusciaapisv1alpha1.JobStage,
	retries int) error

UpdateKusciaJobStage updates kuscia job stage.

func UpdateKusciaJobStatus

func UpdateKusciaJobStatus(kusciaClient kusciaclientset.Interface, rawKj, curKj *kusciaapisv1alpha1.KusciaJob) (err error)

UpdateKusciaJobStatus will update kuscia job status. The function will retry updating if failed.

func UpdateKusciaTaskStatus

func UpdateKusciaTaskStatus(kusciaClient kusciaclientset.Interface, rawKt, curKt *kusciaapisv1alpha1.KusciaTask) (err error)

UpdateKusciaTaskStatus updates kuscia task status.

func UpdateKusciaTaskStatusWithRetry

func UpdateKusciaTaskStatusWithRetry(kusciaClient kusciaclientset.Interface, rawKt, curKt *kusciaapisv1alpha1.KusciaTask, retryCount int) (err error)

UpdateKusciaTaskStatusWithRetry updates kuscia task status with retry.

func UpdateServiceAnnotations

func UpdateServiceAnnotations(kubeClient kubernetes.Interface, service *corev1.Service, at map[string]string) (err error)

UpdateServiceAnnotations updates service annotations.

func ValidateK8sName

func ValidateK8sName(val string, fieldName string) error

ValidateK8sName checks dns subdomain names

func ValidateServiceNamePrefix

func ValidateServiceNamePrefix(val string, fieldName string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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