Documentation ¶
Index ¶
- Constants
- func DoRequest(urlPath string, token string) (int, error)
- func GetTokenFromServiceAccount(client kubernetes.Interface, saNamespace, saName string) (string, error)
- func IsExclude(srcCluster string, targetClusters []string) bool
- func IsScheduleResultEqual(tc1, tc2 []workv1alpha2.TargetCluster) bool
- func MakeNodeWithLabels(node string, milliCPU, memory, pods, ephemeralStorage int64, ...) *corev1.Node
- func MakeNodeWithTaints(node string, milliCPU, memory, pods, ephemeralStorage int64, ...) *corev1.Node
- func MakeNodesAndPods(allNodesNum, allPodsNum int, nodeTemplate *corev1.Node, ...) ([]*corev1.Node, []*corev1.Pod)
- func NewCluster(name string) *clusterv1alpha1.Cluster
- func NewClusterOverridePolicyByOverrideRules(policyName string, rsSelectors []policyv1alpha1.ResourceSelector, ...) *policyv1alpha1.ClusterOverridePolicy
- func NewClusterPropagationPolicy(policyName string, rsSelectors []policyv1alpha1.ResourceSelector, ...) *policyv1alpha1.ClusterPropagationPolicy
- func NewClusterRole(name string, rules []rbacv1.PolicyRule) *rbacv1.ClusterRole
- func NewClusterRoleBinding(name, roleRefName string, subject []rbacv1.Subject) *rbacv1.ClusterRoleBinding
- func NewClusterWithResource(name string, allocatable, allocating, allocated corev1.ResourceList) *clusterv1alpha1.Cluster
- func NewConfigMap(namespace string, name string, data map[string]string) *corev1.ConfigMap
- func NewCronFederatedHPARule(name, cron string, suspend bool, ...) autoscalingv1alpha1.CronFederatedHPARule
- func NewCronFederatedHPAWithScalingDeployment(namespace, name, deploymentName string, ...) *autoscalingv1alpha1.CronFederatedHPA
- func NewCronFederatedHPAWithScalingFHPA(namespace, name, fhpaName string, ...) *autoscalingv1alpha1.CronFederatedHPA
- func NewCrossClusterMultiClusterService(namespace, name string, providerClusters, consumerClusters []string) *networkingv1alpha1.MultiClusterService
- func NewCustomResource(apiVersion, kind, namespace, name string) *unstructured.Unstructured
- func NewCustomResourceDefinition(group string, specNames apiextensionsv1.CustomResourceDefinitionNames, ...) *apiextensionsv1.CustomResourceDefinition
- func NewDaemonSet(namespace string, name string) *appsv1.DaemonSet
- func NewDeployment(namespace string, name string) *appsv1.Deployment
- func NewDeploymentWithServiceAccount(namespace, deploymentName string, serviceAccountName string) *appsv1.Deployment
- func NewDeploymentWithVolumes(namespace, deploymentName string, volumes []corev1.Volume) *appsv1.Deployment
- func NewExplicitPriorityClusterPropagationPolicy(policyName string, rsSelectors []policyv1alpha1.ResourceSelector, ...) *policyv1alpha1.ClusterPropagationPolicy
- func NewExplicitPriorityPropagationPolicy(ns, name string, rsSelectors []policyv1alpha1.ResourceSelector, ...) *policyv1alpha1.PropagationPolicy
- func NewFederatedHPA(namespace, name, scaleTargetDeployment string) *autoscalingv1alpha1.FederatedHPA
- func NewFederatedResourceQuota(ns, name string) *policyv1alpha1.FederatedResourceQuota
- func NewGroupRESTMapper(kind string, scope meta.RESTScope) meta.RESTMapper
- func NewHPA(namespace, name, scaleDeployment string) *autoscalingv2.HorizontalPodAutoscaler
- func NewIngress(namespace, name string) *networkingv1.Ingress
- func NewJob(namespace string, name string) *batchv1.Job
- func NewNamespace(namespace string) *corev1.Namespace
- func NewNode(node string, milliCPU, memory, pods, ephemeralStorage int64) *corev1.Node
- func NewOverridePolicy(namespace, policyName string, rsSelectors []policyv1alpha1.ResourceSelector, ...) *policyv1alpha1.OverridePolicy
- func NewOverridePolicyByOverrideRules(namespace, policyName string, rsSelectors []policyv1alpha1.ResourceSelector, ...) *policyv1alpha1.OverridePolicy
- func NewPVC(namespace, name string, resources corev1.ResourceRequirements, ...) *corev1.PersistentVolumeClaim
- func NewPod(namespace string, name string) *corev1.Pod
- func NewPodDisruptionBudget(namespace, name string, maxUnAvailable intstr.IntOrString) *policyv1.PodDisruptionBudget
- func NewPodWithRequest(pod, node string, milliCPU, memory, ephemeralStorage int64) *corev1.Pod
- func NewPropagationPolicy(ns, name string, rsSelectors []policyv1alpha1.ResourceSelector, ...) *policyv1alpha1.PropagationPolicy
- func NewResourceInterpreterCustomization(name string, target configv1alpha1.CustomizationTarget, ...) *configv1alpha1.ResourceInterpreterCustomization
- func NewResourceList(milliCPU, memory, ephemeralStorage int64) corev1.ResourceList
- func NewRole(namespace, name string, rules []rbacv1.PolicyRule) *rbacv1.Role
- func NewRoleBinding(namespace, name, roleRefName string, subject []rbacv1.Subject) *rbacv1.RoleBinding
- func NewSecret(namespace string, name string, data map[string][]byte) *corev1.Secret
- func NewService(namespace string, name string, svcType corev1.ServiceType) *corev1.Service
- func NewServiceaccount(namespace, name string) *corev1.ServiceAccount
- func NewStatefulSet(namespace string, name string) *appsv1.StatefulSet
- func NewWork(workName, workNs, workUID string, raw []byte) *workv1alpha1.Work
- func NewWorkload(namespace, name string) *workloadv1alpha1.Workload
Constants ¶
const ( ResourceUnitZero int64 = 0 ResourceUnitCPU int64 = 1000 ResourceUnitMem int64 = 1024 * 1024 * 1024 ResourceUnitPod int64 = 1 ResourceUnitEphemeralStorage int64 = 1024 * 1024 * 1024 ResourceUnitGPU int64 = 1 )
These are different resource units.
Variables ¶
This section is empty.
Functions ¶
func GetTokenFromServiceAccount ¶ added in v1.2.0
func GetTokenFromServiceAccount(client kubernetes.Interface, saNamespace, saName string) (string, error)
GetTokenFromServiceAccount get token from serviceAccount's related secret.
func IsScheduleResultEqual ¶ added in v0.10.0
func IsScheduleResultEqual(tc1, tc2 []workv1alpha2.TargetCluster) bool
IsScheduleResultEqual will check whether two schedule results are equal.
func MakeNodeWithLabels ¶ added in v0.9.0
func MakeNodeWithLabels(node string, milliCPU, memory, pods, ephemeralStorage int64, labels map[string]string) *corev1.Node
MakeNodeWithLabels will build a ready node with resource and labels.
func MakeNodeWithTaints ¶ added in v0.9.0
func MakeNodeWithTaints(node string, milliCPU, memory, pods, ephemeralStorage int64, taints []corev1.Taint) *corev1.Node
MakeNodeWithTaints will build a ready node with resource and taints.
func MakeNodesAndPods ¶ added in v1.2.0
func MakeNodesAndPods(allNodesNum, allPodsNum int, nodeTemplate *corev1.Node, podTemplate *corev1.Pod) ([]*corev1.Node, []*corev1.Pod)
MakeNodesAndPods will make batch of nodes and pods based on template.
func NewCluster ¶ added in v0.10.0
func NewCluster(name string) *clusterv1alpha1.Cluster
NewCluster will build a Cluster.
func NewClusterOverridePolicyByOverrideRules ¶ added in v1.1.6
func NewClusterOverridePolicyByOverrideRules(policyName string, rsSelectors []policyv1alpha1.ResourceSelector, overrideRules []policyv1alpha1.RuleWithCluster) *policyv1alpha1.ClusterOverridePolicy
NewClusterOverridePolicyByOverrideRules will build a ClusterOverridePolicy object by OverrideRules
func NewClusterPropagationPolicy ¶ added in v0.7.0
func NewClusterPropagationPolicy(policyName string, rsSelectors []policyv1alpha1.ResourceSelector, placement policyv1alpha1.Placement) *policyv1alpha1.ClusterPropagationPolicy
NewClusterPropagationPolicy will build a ClusterPropagationPolicy object.
func NewClusterRole ¶ added in v1.2.0
func NewClusterRole(name string, rules []rbacv1.PolicyRule) *rbacv1.ClusterRole
NewClusterRole will build a new clusterRole object.
func NewClusterRoleBinding ¶ added in v1.2.0
func NewClusterRoleBinding(name, roleRefName string, subject []rbacv1.Subject) *rbacv1.ClusterRoleBinding
NewClusterRoleBinding will build a new clusterRoleBinding object.
func NewClusterWithResource ¶ added in v0.10.0
func NewClusterWithResource(name string, allocatable, allocating, allocated corev1.ResourceList) *clusterv1alpha1.Cluster
NewClusterWithResource will build a Cluster with resource.
func NewConfigMap ¶ added in v1.2.0
NewConfigMap will build a configmap object.
func NewCronFederatedHPARule ¶ added in v1.7.0
func NewCronFederatedHPARule(name, cron string, suspend bool, targetReplicas, targetMinReplicas, targetMaxReplicas *int32) autoscalingv1alpha1.CronFederatedHPARule
NewCronFederatedHPARule will build a CronFederatedHPARule object.
func NewCronFederatedHPAWithScalingDeployment ¶ added in v1.7.0
func NewCronFederatedHPAWithScalingDeployment(namespace, name, deploymentName string, rule autoscalingv1alpha1.CronFederatedHPARule) *autoscalingv1alpha1.CronFederatedHPA
NewCronFederatedHPAWithScalingDeployment will build a CronFederatedHPA object with scaling deployment.
func NewCronFederatedHPAWithScalingFHPA ¶ added in v1.7.0
func NewCronFederatedHPAWithScalingFHPA(namespace, name, fhpaName string, rule autoscalingv1alpha1.CronFederatedHPARule) *autoscalingv1alpha1.CronFederatedHPA
NewCronFederatedHPAWithScalingFHPA will build a CronFederatedHPA object with scaling FederatedHPA.
func NewCrossClusterMultiClusterService ¶ added in v1.8.0
func NewCrossClusterMultiClusterService(namespace, name string, providerClusters, consumerClusters []string) *networkingv1alpha1.MultiClusterService
NewCrossClusterMultiClusterService will build a MultiClusterService object.
func NewCustomResource ¶ added in v0.5.0
func NewCustomResource(apiVersion, kind, namespace, name string) *unstructured.Unstructured
NewCustomResource will build a CR object with CRD Foo.
func NewCustomResourceDefinition ¶ added in v0.5.0
func NewCustomResourceDefinition(group string, specNames apiextensionsv1.CustomResourceDefinitionNames, scope apiextensionsv1.ResourceScope) *apiextensionsv1.CustomResourceDefinition
NewCustomResourceDefinition will build a CRD object.
func NewDaemonSet ¶ added in v1.2.0
NewDaemonSet will build a daemonSet object.
func NewDeployment ¶
func NewDeployment(namespace string, name string) *appsv1.Deployment
NewDeployment will build a deployment object.
func NewDeploymentWithServiceAccount ¶ added in v1.3.5
func NewDeploymentWithServiceAccount(namespace, deploymentName string, serviceAccountName string) *appsv1.Deployment
NewDeploymentWithServiceAccount will build a deployment object that with serviceAccount.
func NewDeploymentWithVolumes ¶ added in v1.2.0
func NewDeploymentWithVolumes(namespace, deploymentName string, volumes []corev1.Volume) *appsv1.Deployment
NewDeploymentWithVolumes will build a deployment object that with reference volumes.
func NewExplicitPriorityClusterPropagationPolicy ¶ added in v1.4.0
func NewExplicitPriorityClusterPropagationPolicy(policyName string, rsSelectors []policyv1alpha1.ResourceSelector, placement policyv1alpha1.Placement, priority int32) *policyv1alpha1.ClusterPropagationPolicy
NewExplicitPriorityClusterPropagationPolicy will build a ClusterPropagationPolicy object with explicit priority.
func NewExplicitPriorityPropagationPolicy ¶ added in v1.4.0
func NewExplicitPriorityPropagationPolicy(ns, name string, rsSelectors []policyv1alpha1.ResourceSelector, placement policyv1alpha1.Placement, priority int32) *policyv1alpha1.PropagationPolicy
NewExplicitPriorityPropagationPolicy will build a PropagationPolicy object with explicit priority.
func NewFederatedHPA ¶ added in v1.7.0
func NewFederatedHPA(namespace, name, scaleTargetDeployment string) *autoscalingv1alpha1.FederatedHPA
NewFederatedHPA will build a FederatedHPA object.
func NewFederatedResourceQuota ¶ added in v1.2.0
func NewFederatedResourceQuota(ns, name string) *policyv1alpha1.FederatedResourceQuota
NewFederatedResourceQuota will build a demo FederatedResourceQuota object.
func NewGroupRESTMapper ¶ added in v1.6.0
func NewGroupRESTMapper(kind string, scope meta.RESTScope) meta.RESTMapper
NewGroupRESTMapper make a fake RESTMapper in GroupVersion, by kind and scope.
func NewHPA ¶ added in v1.8.0
func NewHPA(namespace, name, scaleDeployment string) *autoscalingv2.HorizontalPodAutoscaler
NewHPA will build a HorizontalPodAutoscaler object.
func NewIngress ¶ added in v1.2.0
func NewIngress(namespace, name string) *networkingv1.Ingress
NewIngress will build a new ingress object.
func NewNamespace ¶
NewNamespace will build a Namespace object.
func NewOverridePolicy ¶ added in v0.7.0
func NewOverridePolicy(namespace, policyName string, rsSelectors []policyv1alpha1.ResourceSelector, clusterAffinity policyv1alpha1.ClusterAffinity, overriders policyv1alpha1.Overriders) *policyv1alpha1.OverridePolicy
NewOverridePolicy will build a OverridePolicy object.
func NewOverridePolicyByOverrideRules ¶ added in v1.0.0
func NewOverridePolicyByOverrideRules(namespace, policyName string, rsSelectors []policyv1alpha1.ResourceSelector, overrideRules []policyv1alpha1.RuleWithCluster) *policyv1alpha1.OverridePolicy
NewOverridePolicyByOverrideRules will build a OverridePolicy object by OverrideRules
func NewPVC ¶ added in v1.3.0
func NewPVC(namespace, name string, resources corev1.ResourceRequirements, accessModes ...corev1.PersistentVolumeAccessMode) *corev1.PersistentVolumeClaim
NewPVC will build a new PersistentVolumeClaim.
func NewPodDisruptionBudget ¶ added in v1.5.0
func NewPodDisruptionBudget(namespace, name string, maxUnAvailable intstr.IntOrString) *policyv1.PodDisruptionBudget
NewPodDisruptionBudget will build a new PodDisruptionBudget object.
func NewPodWithRequest ¶ added in v0.9.0
NewPodWithRequest will build a Pod with resource request.
func NewPropagationPolicy ¶ added in v0.7.0
func NewPropagationPolicy(ns, name string, rsSelectors []policyv1alpha1.ResourceSelector, placement policyv1alpha1.Placement) *policyv1alpha1.PropagationPolicy
NewPropagationPolicy will build a PropagationPolicy object.
func NewResourceInterpreterCustomization ¶ added in v1.4.0
func NewResourceInterpreterCustomization( name string, target configv1alpha1.CustomizationTarget, rules configv1alpha1.CustomizationRules) *configv1alpha1.ResourceInterpreterCustomization
NewResourceInterpreterCustomization will build a ResourceInterpreterCustomization object.
func NewResourceList ¶ added in v0.9.0
func NewResourceList(milliCPU, memory, ephemeralStorage int64) corev1.ResourceList
NewResourceList will build a ResourceList.
func NewRole ¶ added in v1.4.0
func NewRole(namespace, name string, rules []rbacv1.PolicyRule) *rbacv1.Role
NewRole will build a new role object.
func NewRoleBinding ¶ added in v1.4.0
func NewRoleBinding(namespace, name, roleRefName string, subject []rbacv1.Subject) *rbacv1.RoleBinding
NewRoleBinding will build a new roleBinding object.
func NewService ¶ added in v0.4.0
NewService will build a service object.
func NewServiceaccount ¶ added in v1.2.0
func NewServiceaccount(namespace, name string) *corev1.ServiceAccount
NewServiceaccount will build a new serviceaccount.
func NewStatefulSet ¶ added in v1.2.0
func NewStatefulSet(namespace string, name string) *appsv1.StatefulSet
NewStatefulSet will build a statefulSet object.
func NewWork ¶ added in v1.7.0
func NewWork(workName, workNs, workUID string, raw []byte) *workv1alpha1.Work
NewWork will build a new Work object.
func NewWorkload ¶ added in v1.0.0
func NewWorkload(namespace, name string) *workloadv1alpha1.Workload
NewWorkload will build a workload object.
Types ¶
This section is empty.