Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyDescription(ctx context.Context, clusternetClient *clusternetclientset.Clientset, ...) error
- func ApplyEndPointSliceWithRetry(client kubernetes.Interface, slice *discoveryv1.EndpointSlice) error
- func ApplyResourceWithRetry(ctx context.Context, dynamicClient dynamic.Interface, ...) error
- func BaseSubUidIndexFunc(obj interface{}) ([]string, error)
- func BaseUidIndexFunc(obj interface{}) ([]string, error)
- func CheckIfInstallable(chart *chart.Chart) error
- func ClusterHasReadyCondition(mc *clusterapi.ManagedCluster) bool
- func ContainsPrefix(slice []string, s string) bool
- func ContainsString(slice []string, s string) bool
- func CopyStrings(s []string) []string
- func CreateKubeConfigForSocketProxyWithToken(secretLister corev1lister.SecretLister, ...) (*clientcmdapi.Config, error)
- func CreateKubeConfigWithToken(serverURL, token string, caCert []byte) *clientcmdapi.Config
- func DeleteResourceWithRetry(ctx context.Context, dynamicClient dynamic.Interface, ...) error
- func DeployableByAgent(syncMode clusterapi.ClusterSyncMode, appPusherEnabled bool) bool
- func DeployableByHub(clusterLister clusterlisters.ManagedClusterLister, ...) (bool, error)
- func DerivedName(namespace, name string) string
- func EndpointSliceV1beta1Promoted(kubeServerVersion string) (bool, error)
- func EnsureClusterRole(ctx context.Context, clusterrole v1.ClusterRole, client *kubernetes.Clientset, ...) error
- func EnsureClusterRoleBinding(ctx context.Context, clusterrolebinding v1.ClusterRoleBinding, ...) error
- func EnsureRole(ctx context.Context, role v1.Role, client *kubernetes.Clientset, ...) error
- func EnsureRoleBinding(ctx context.Context, rolebinding v1.RoleBinding, client *kubernetes.Clientset, ...) error
- func FindBasesFromUIDs(baseIndexer cache.Indexer, uids []string) []*appsapi.Base
- func FindOCIChart(chartRepo, chartName, chartVersion string) (bool, error)
- func FindObsoletedFeeds(oldFeeds []appsapi.Feed, newFeeds []appsapi.Feed) []appsapi.Feed
- func FormatFeed(feed appsapi.Feed) string
- func GenerateHelmReleaseName(descName string, chartRef appsapi.ChartReference) string
- func GenerateIdentity() (string, error)
- func GenerateKubeConfigFromToken(serverURL, token string, caCert []byte) (*rest.Config, error)
- func GetChildClusterConfig(secretLister corev1lister.SecretLister, ...) (*clientcmdapi.Config, float32, int32, error)
- func GetCondition(conditions []metav1.Condition, conditionType string) *metav1.Condition
- func GetDeployerCredentials(ctx context.Context, childKubeClientSet kubernetes.Interface, ...) *corev1.Secret
- func GetFeedKey(feed appsapi.Feed) string
- func GetHelmRepoCredentials(kubeclient *kubernetes.Clientset, secretName, namespace string) (string, string, error)
- func GetLabelsSelectorFromFeed(feed appsapi.Feed) (labels.Selector, error)
- func GetPatchDataForLabelsAndAnnotations(labels, annotations map[string]*string) ([]byte, error)
- func GracefulStopWithContext() context.Context
- func HasFeed(feed appsapi.Feed, feeds []appsapi.Feed) bool
- func HashSubscriptionSpec(subscriptionSpec *appsapi.SubscriptionSpec) uint64
- func InstallRelease(cfg *action.Configuration, hr *appsapi.HelmRelease, chart *chart.Chart, ...) (*release.Release, error)
- func IsAttachableVolumeResourceName(name corev1.ResourceName) bool
- func IsClusterLost(clusterID, namespace string, clusterLister clusterlisters.ManagedClusterLister) bool
- func IsExtendedResourceName(name corev1.ResourceName) bool
- func IsHugePageResourceName(name corev1.ResourceName) bool
- func IsNativeResource(name corev1.ResourceName) bool
- func IsPrefixedNativeResource(name corev1.ResourceName) bool
- func IsScalarResourceName(name corev1.ResourceName) bool
- func ListManifestsBySelector(reservedNamespace string, manifestLister applisters.ManifestLister, ...) ([]*appsapi.Manifest, error)
- func LoadsKubeConfig(clientConnectionCfg *componentbaseconfig.ClientConnectionConfiguration) (*rest.Config, error)
- func LoadsKubeConfigFromFile(fileName string) (*rest.Config, error)
- func LocateAuthHelmChart(cfg *action.Configuration, ...) (*chart.Chart, error)
- func Marshal(v any) ([]byte, error)
- func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error)
- func MaxInt(a, b int) int
- func MaxInt32(a, b int32) int32
- func MinInt(a, b int) int
- func MinInt32(a, b int32) int32
- func MinInt64(a, b int64) int64
- func MultiClusterServiceEnabled(kubeServerVersion string) (bool, error)
- func NewHealthzAndMetricsHandler(name string, debuggingOptions *controllermanageroptions.DebuggingOptions, ...) http.Handler
- func NewLeaderElectionConfigWithDefaultValue(identity, leaseName, leaseNamespace string, leaseDuration time.Duration, ...) *leaderelection.LeaderElectionConfig
- func NewResourceInformer(client ResourceClient, apiResource *metav1.APIResource, ...) (*resourceInformer, error)
- func OffloadDescription(ctx context.Context, clusternetClient *clusternetclientset.Clientset, ...) error
- func PatchHelmChartLabelsAndAnnotations(clusternetClient *clusternetclientset.Clientset, chart *appsapi.HelmChart, ...) error
- func PatchManifestLabelsAndAnnotations(clusternetClient *clusternetclientset.Clientset, manifest *appsapi.Manifest, ...) error
- func ReconcileHelmRelease(ctx context.Context, deployCtx *DeployContext, ...) error
- func ReleaseNeedsUpgrade(rel *release.Release, hr *appsapi.HelmRelease, chart *chart.Chart, ...) bool
- func RemoveFeedFromSubscription(ctx context.Context, clusternetClient *clusternetclientset.Clientset, ...) error
- func RemoveNonexistentEndpointslice(srcLister discoverylisterv1.EndpointSliceLister, srcNamespace string, ...) ([]*discoveryv1.EndpointSlice, error)
- func RemoveString(slice []string, s string) []string
- func ResourceNeedResync(current pkgruntime.Object, modified pkgruntime.Object, ignoreAdd bool) bool
- func SATokenAutoGenerated(kubeServerVersion string) (bool, error)
- func SortStrings(s []string) []string
- func SubUidIndexFunc(obj interface{}) ([]string, error)
- func SumArrayInt32(array []int32) (sum int32)
- func UninstallRelease(cfg *action.Configuration, hr *appsapi.HelmRelease) error
- func Unmarshal(data []byte, v any) error
- func UpdateConditions(status *clusterapi.ManagedClusterStatus, newConditions []metav1.Condition) (hasChanged bool)
- func UpdateDescriptionStatus(ctx context.Context, desc *appsapi.Description, ...) error
- func UpdateHelmReleaseStatus(ctx context.Context, clusternetClient *clusternetclientset.Clientset, ...) error
- func UpdateRepo(repoURL string) error
- func UpgradeRelease(cfg *action.Configuration, hr *appsapi.HelmRelease, chart *chart.Chart, ...) (*release.Release, error)
- type ControllerOptions
- type DeployContext
- type JsonPatchOption
- type MetaData
- type MetaOption
- type Resource
- func (r *Resource) Add(rl corev1.ResourceList)
- func (r *Resource) AddMulti(rl corev1.ResourceList, ratio int64)
- func (r *Resource) AddPodRequest(podSpec *corev1.PodSpec) *Resource
- func (r *Resource) AddResourcePods(pods int64)
- func (r *Resource) AddScalar(name corev1.ResourceName, quantity int64)
- func (r *Resource) Clone() *Resource
- func (r *Resource) Less(rr *Resource) bool
- func (r *Resource) MaxReplicaDivided(rl corev1.ResourceList) int64
- func (r *Resource) Multi(ratio int64)
- func (r *Resource) ResourceList() corev1.ResourceList
- func (r *Resource) SetMaxResource(rl corev1.ResourceList)
- func (r *Resource) SetScalar(name corev1.ResourceName, quantity int64)
- func (r *Resource) String() string
- func (r *Resource) Sub(rl corev1.ResourceList) error
- type ResourceCallbackHandler
- type ResourceClient
Constants ¶
const ( // UsernameKey is the key for username in the helm repo auth secret UsernameKey = "username" // PasswordKey is the key for password in the helm repo auth secret PasswordKey = "password" )
Variables ¶
var ( // KubeV1240Alpha4 indicates the version of Kubernetes v1.24.0-alpha.4 KubeV1240Alpha4 = version.MustParseSemantic("v1.24.0-alpha.4") // KubeV1170Beta2 indicates the version of Kubernetes v1.17.0-beta.2 KubeV1170Beta2 = version.MustParseSemantic("v1.17.0-beta.2") // KubeV1210Beta1 indicates the version of Kubernetes v1.21.0-beta.1 KubeV1210Beta1 = version.MustParseSemantic("v1.21.0-beta.1") )
var (
Settings = cli.New()
)
Functions ¶
func ApplyDescription ¶ added in v0.4.0
func ApplyDescription(ctx context.Context, clusternetClient *clusternetclientset.Clientset, dynamicClient dynamic.Interface, discoveryRESTMapper meta.RESTMapper, desc *appsapi.Description, recorder record.EventRecorder, dryApply bool, callbackHandler ResourceCallbackHandler, ignoreAdd bool) error
func ApplyEndPointSliceWithRetry ¶ added in v0.12.0
func ApplyEndPointSliceWithRetry(client kubernetes.Interface, slice *discoveryv1.EndpointSlice) error
ApplyEndPointSliceWithRetry create or update existed slices.
func ApplyResourceWithRetry ¶ added in v0.7.0
func ApplyResourceWithRetry(ctx context.Context, dynamicClient dynamic.Interface, restMapper meta.RESTMapper, resource *unstructured.Unstructured, ignoreAdd bool) error
func BaseSubUidIndexFunc ¶ added in v0.17.0
func BaseUidIndexFunc ¶ added in v0.17.0
func CheckIfInstallable ¶ added in v0.4.0
CheckIfInstallable validates if a chart can be installed only application chart type is installable
func ClusterHasReadyCondition ¶ added in v0.16.0
func ClusterHasReadyCondition(mc *clusterapi.ManagedCluster) bool
func ContainsPrefix ¶ added in v0.10.0
ContainsPrefix checks if a given slice of strings start with the provided string.
func ContainsString ¶ added in v0.2.0
ContainsString checks if a given slice of strings contains the provided string.
func CopyStrings ¶ added in v0.2.0
CopyStrings copies the contents of the specified string slice into a new slice.
func CreateKubeConfigForSocketProxyWithToken ¶ added in v0.2.0
func CreateKubeConfigForSocketProxyWithToken(secretLister corev1lister.SecretLister, systemNamespace, serverURL, token string, AnonymousAuthSupported bool) (*clientcmdapi.Config, error)
CreateKubeConfigForSocketProxyWithToken creates a KubeConfig object with access to the API server with a token
func CreateKubeConfigWithToken ¶ added in v0.2.0
func CreateKubeConfigWithToken(serverURL, token string, caCert []byte) *clientcmdapi.Config
CreateKubeConfigWithToken creates a KubeConfig object with access to the API server with a token
func DeleteResourceWithRetry ¶ added in v0.5.0
func DeleteResourceWithRetry(ctx context.Context, dynamicClient dynamic.Interface, restMapper meta.RESTMapper, resource *unstructured.Unstructured) error
func DeployableByAgent ¶ added in v0.4.0
func DeployableByAgent(syncMode clusterapi.ClusterSyncMode, appPusherEnabled bool) bool
func DeployableByHub ¶ added in v0.4.0
func DeployableByHub(clusterLister clusterlisters.ManagedClusterLister, clusterID, dedicatedNamespace string) (bool, error)
DeployableByHub checks whether HelmRelease/Description should be deployed from hub
func DerivedName ¶ added in v0.12.0
func EndpointSliceV1beta1Promoted ¶ added in v0.13.0
EndpointSliceV1beta1Promoted is used to indicate whether EndpointSlice v1beta1 has been promoted Keep it for legacy use.
func EnsureClusterRole ¶ added in v0.2.0
func EnsureClusterRole(ctx context.Context, clusterrole v1.ClusterRole, client *kubernetes.Clientset, backoff wait.Backoff) error
EnsureClusterRole will make sure desired clusterrole exists and update it if available
func EnsureClusterRoleBinding ¶ added in v0.2.0
func EnsureClusterRoleBinding(ctx context.Context, clusterrolebinding v1.ClusterRoleBinding, client *kubernetes.Clientset, backoff wait.Backoff) error
EnsureClusterRoleBinding will make sure desired clusterrolebinding exists and update it if available
func EnsureRole ¶ added in v0.2.0
func EnsureRole(ctx context.Context, role v1.Role, client *kubernetes.Clientset, backoff wait.Backoff) error
EnsureRole will make sure desired role exists and update it if available
func EnsureRoleBinding ¶ added in v0.2.0
func EnsureRoleBinding(ctx context.Context, rolebinding v1.RoleBinding, client *kubernetes.Clientset, backoff wait.Backoff) error
EnsureRoleBinding will make sure desired rolebinding exists and update it if available
func FindBasesFromUIDs ¶ added in v0.6.0
func FindOCIChart ¶ added in v0.8.0
FindOCIChart will looks for an OCI-based helm chart from repository.
func FindObsoletedFeeds ¶ added in v0.6.0
func FormatFeed ¶ added in v0.4.0
func GenerateHelmReleaseName ¶ added in v0.5.0
func GenerateHelmReleaseName(descName string, chartRef appsapi.ChartReference) string
func GenerateIdentity ¶ added in v0.7.0
func GenerateKubeConfigFromToken ¶
GenerateKubeConfigFromToken composes a kubeconfig from token
func GetChildClusterConfig ¶ added in v0.3.0
func GetChildClusterConfig( secretLister corev1lister.SecretLister, clusterLister clusterlisters.ManagedClusterLister, namespace, clusterID, parentAPIServerURL, systemNamespace string, proxyingWithAnonymous bool, ) (*clientcmdapi.Config, float32, int32, error)
func GetCondition ¶ added in v0.17.0
func GetDeployerCredentials ¶ added in v0.4.0
func GetFeedKey ¶ added in v0.9.0
func GetHelmRepoCredentials ¶ added in v0.7.0
func GetHelmRepoCredentials(kubeclient *kubernetes.Clientset, secretName, namespace string) (string, string, error)
GetHelmRepoCredentials get helm repo credentials from the given secret
func GetLabelsSelectorFromFeed ¶ added in v0.4.0
func GetPatchDataForLabelsAndAnnotations ¶ added in v0.15.0
func GracefulStopWithContext ¶
GracefulStopWithContext registered for SIGTERM and SIGINT with a cancel context returned. When one of these signals get caught, the returned context's channel will be closed. If a second signal is caught, then the program is terminated with exit code 1.
func HashSubscriptionSpec ¶ added in v0.7.0
func HashSubscriptionSpec(subscriptionSpec *appsapi.SubscriptionSpec) uint64
func InstallRelease ¶ added in v0.4.0
func InstallRelease(cfg *action.Configuration, hr *appsapi.HelmRelease, chart *chart.Chart, vals map[string]interface{}) (*release.Release, error)
func IsAttachableVolumeResourceName ¶ added in v0.10.0
func IsAttachableVolumeResourceName(name corev1.ResourceName) bool
IsAttachableVolumeResourceName returns true when the resource name is prefixed in attachable volume
func IsClusterLost ¶ added in v0.6.0
func IsClusterLost(clusterID, namespace string, clusterLister clusterlisters.ManagedClusterLister) bool
func IsExtendedResourceName ¶ added in v0.10.0
func IsExtendedResourceName(name corev1.ResourceName) bool
IsExtendedResourceName returns true if: 1. the resource name is not in the default namespace; 2. resource name does not have "requests." prefix, to avoid confusion with the convention in quota 3. it satisfies the rules in IsQualifiedName() after converted into quota resource name
func IsHugePageResourceName ¶ added in v0.10.0
func IsHugePageResourceName(name corev1.ResourceName) bool
IsHugePageResourceName returns true if the resource name has the huge page resource prefix.
func IsNativeResource ¶ added in v0.10.0
func IsNativeResource(name corev1.ResourceName) bool
IsNativeResource returns true if the resource name is in the *kubernetes.io/ namespace. Partially-qualified (unprefixed) names are implicitly in the kubernetes.io/ namespace.
func IsPrefixedNativeResource ¶ added in v0.10.0
func IsPrefixedNativeResource(name corev1.ResourceName) bool
IsPrefixedNativeResource returns true if the resource name is in the *kubernetes.io/ namespace.
func IsScalarResourceName ¶ added in v0.10.0
func IsScalarResourceName(name corev1.ResourceName) bool
IsScalarResourceName validates the resource for Extended, Hugepages, Native and AttachableVolume resources
func ListManifestsBySelector ¶ added in v0.4.0
func ListManifestsBySelector(reservedNamespace string, manifestLister applisters.ManifestLister, feed appsapi.Feed) ([]*appsapi.Manifest, error)
func LoadsKubeConfig ¶
func LoadsKubeConfig(clientConnectionCfg *componentbaseconfig.ClientConnectionConfiguration) (*rest.Config, error)
LoadsKubeConfig tries to load kubeconfig from specified kubeconfig file or in-cluster config
func LoadsKubeConfigFromFile ¶ added in v0.12.0
LoadsKubeConfigFromFile tries to load kubeconfig from specified kubeconfig file
func LocateAuthHelmChart ¶ added in v0.7.0
func LocateAuthHelmChart(cfg *action.Configuration, chartRepo, username, password, chartName, chartVersion string) (*chart.Chart, error)
LocateAuthHelmChart will looks for a chart from auth repository and load it.
func MarshalIndent ¶ added in v0.17.0
MarshalIndent is a shadow function.
func MultiClusterServiceEnabled ¶ added in v0.15.0
MultiClusterServiceEnabled is used to indicate whether EndpointSlice v1 has been promoted
func NewHealthzAndMetricsHandler ¶ added in v0.15.0
func NewHealthzAndMetricsHandler(name string, debuggingOptions *controllermanageroptions.DebuggingOptions, checks ...healthz.HealthChecker) http.Handler
NewHealthzAndMetricsHandler creates a healthz server from the config, and will also embed the metrics handler.
func NewLeaderElectionConfigWithDefaultValue ¶ added in v0.7.0
func NewLeaderElectionConfigWithDefaultValue(identity, leaseName, leaseNamespace string, leaseDuration time.Duration, renewDeadline time.Duration, retryPeriod time.Duration, clientset kubernetes.Interface, callbacks leaderelection.LeaderCallbacks) *leaderelection.LeaderElectionConfig
func NewResourceInformer ¶ added in v0.7.0
func NewResourceInformer(client ResourceClient, apiResource *metav1.APIResource, handler cache.ResourceEventHandlerFuncs) (*resourceInformer, error)
NewResourceInformer returns a filtered informer limited to resources managed by Clusternet as indicated by labeling.
func OffloadDescription ¶ added in v0.4.0
func OffloadDescription(ctx context.Context, clusternetClient *clusternetclientset.Clientset, dynamicClient dynamic.Interface, discoveryRESTMapper meta.RESTMapper, desc *appsapi.Description, recorder record.EventRecorder) error
func PatchHelmChartLabelsAndAnnotations ¶ added in v0.4.0
func PatchManifestLabelsAndAnnotations ¶ added in v0.4.0
func ReconcileHelmRelease ¶ added in v0.4.0
func ReconcileHelmRelease(ctx context.Context, deployCtx *DeployContext, kubeClient *kubernetes.Clientset, clusternetClient *clusternetclientset.Clientset, hrLister applisters.HelmReleaseLister, descLister applisters.DescriptionLister, hr *appsapi.HelmRelease, recorder record.EventRecorder) error
func ReleaseNeedsUpgrade ¶ added in v0.4.0
func RemoveFeedFromSubscription ¶ added in v0.4.0
func RemoveFeedFromSubscription(ctx context.Context, clusternetClient *clusternetclientset.Clientset, feedSourceLabels map[string]string, sub *appsapi.Subscription) error
func RemoveNonexistentEndpointslice ¶ added in v0.17.0
func RemoveNonexistentEndpointslice( srcLister discoverylisterv1.EndpointSliceLister, srcNamespace string, labelMap labels.Set, targetClient kubernetes.Interface, targetNamespace string, dstLabelMap labels.Set, ) ([]*discoveryv1.EndpointSlice, error)
func RemoveString ¶ added in v0.2.0
RemoveString returns a newly created []string that contains all items from slice that are not equal to s.
func ResourceNeedResync ¶ added in v0.7.0
func ResourceNeedResync(current pkgruntime.Object, modified pkgruntime.Object, ignoreAdd bool) bool
ResourceNeedResync will compare fields and decide whether to sync back the current object.
current is deployed resource, modified is changed resource. ignoreAdd is true if you want to ignore add action. The function will return the bool value to indicate whether to sync back the current object.
func SATokenAutoGenerated ¶ added in v0.13.0
SATokenAutoGenerated is used to indicate whether secret-based service account token can be auto generated
func SortStrings ¶ added in v0.2.0
SortStrings sorts the specified string slice in place. It returns the same slice that was provided in order to facilitate method chaining.
func SubUidIndexFunc ¶ added in v0.17.0
func SumArrayInt32 ¶ added in v0.11.0
func UninstallRelease ¶ added in v0.4.0
func UninstallRelease(cfg *action.Configuration, hr *appsapi.HelmRelease) error
func UpdateConditions ¶ added in v0.17.0
func UpdateConditions(status *clusterapi.ManagedClusterStatus, newConditions []metav1.Condition) (hasChanged bool)
func UpdateDescriptionStatus ¶ added in v0.11.0
func UpdateDescriptionStatus( ctx context.Context, desc *appsapi.Description, status *appsapi.DescriptionStatus, clusternetClient *clusternetclientset.Clientset, deployerTrigger bool, ) error
func UpdateHelmReleaseStatus ¶ added in v0.4.0
func UpdateHelmReleaseStatus(ctx context.Context, clusternetClient *clusternetclientset.Clientset, hrLister applisters.HelmReleaseLister, descLister applisters.DescriptionLister, hr *appsapi.HelmRelease, status *appsapi.HelmReleaseStatus) error
func UpdateRepo ¶ added in v0.4.0
func UpgradeRelease ¶ added in v0.4.0
func UpgradeRelease(cfg *action.Configuration, hr *appsapi.HelmRelease, chart *chart.Chart, vals map[string]interface{}) (*release.Release, error)
Types ¶
type ControllerOptions ¶ added in v0.7.0
type ControllerOptions struct { // LeaderElection defines the configuration of leader election client. LeaderElection componentbaseconfig.LeaderElectionConfiguration // ClientConnection specifies the kubeconfig file and client connection // settings for the proxy server to use when communicating with the apiserver. ClientConnection componentbaseconfig.ClientConnectionConfiguration Logs *logs.Options }
ControllerOptions has all the params needed to run a Controller
func NewControllerOptions ¶ added in v0.7.0
func NewControllerOptions(resourceName, resourceNamespace string) (*ControllerOptions, error)
NewControllerOptions returns a new ControllerOptions
func (*ControllerOptions) AddFlagSets ¶ added in v0.15.0
func (o *ControllerOptions) AddFlagSets(fss *cliflag.NamedFlagSets)
func (*ControllerOptions) Complete ¶ added in v0.7.0
func (o *ControllerOptions) Complete() error
Complete fills in fields required to have valid data
func (*ControllerOptions) Validate ¶ added in v0.7.0
func (o *ControllerOptions) Validate() error
Validate validates ControllerOptions
type DeployContext ¶ added in v0.4.0
type DeployContext struct {
// contains filtered or unexported fields
}
func NewDeployContext ¶ added in v0.4.0
func NewDeployContext(config *clientcmdapi.Config, kubeQPS float32, kubeBurst int32) (*DeployContext, error)
func (*DeployContext) ToDiscoveryClient ¶ added in v0.4.0
func (dctx *DeployContext) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
func (*DeployContext) ToRESTConfig ¶ added in v0.4.0
func (dctx *DeployContext) ToRESTConfig() (*rest.Config, error)
func (*DeployContext) ToRESTMapper ¶ added in v0.4.0
func (dctx *DeployContext) ToRESTMapper() (meta.RESTMapper, error)
func (*DeployContext) ToRawKubeConfigLoader ¶ added in v0.4.0
func (dctx *DeployContext) ToRawKubeConfigLoader() clientcmd.ClientConfig
type JsonPatchOption ¶ added in v0.4.0
type MetaOption ¶ added in v0.4.0
type MetaOption struct {
MetaData MetaData `json:"metadata"`
}
type Resource ¶ added in v0.10.0
type Resource struct { MilliCPU int64 Memory int64 EphemeralStorage int64 AllowedPodNumber int64 // ScalarResources ScalarResources map[corev1.ResourceName]int64 }
Resource is a collection of compute resource.
func EmptyResource ¶ added in v0.10.0
func EmptyResource() *Resource
EmptyResource creates a empty resource object and returns.
func NewResource ¶ added in v0.10.0
func NewResource(rl corev1.ResourceList) *Resource
func (*Resource) Add ¶ added in v0.10.0
func (r *Resource) Add(rl corev1.ResourceList)
Add is used to add two resources.
func (*Resource) AddMulti ¶ added in v0.10.0
func (r *Resource) AddMulti(rl corev1.ResourceList, ratio int64)
AddMulti is used to add resources with scale.
func (*Resource) AddPodRequest ¶ added in v0.10.0
AddPodRequest add the effective request resource of a pod to the origin resource. The Pod's effective request is the higher of: - the sum of all app containers(spec.Containers) request for a resource. - the effective init containers(spec.InitContainers) request for a resource. The effective init containers request is the highest request on all init containers.
func (*Resource) AddResourcePods ¶ added in v0.10.0
func (*Resource) AddScalar ¶ added in v0.10.0
func (r *Resource) AddScalar(name corev1.ResourceName, quantity int64)
AddScalar adds a resource by a scalar value of this resource.
func (*Resource) Clone ¶ added in v0.10.0
Clone is used to clone a resource type, which is a deep copy function.
func (*Resource) MaxReplicaDivided ¶ added in v0.10.0
func (r *Resource) MaxReplicaDivided(rl corev1.ResourceList) int64
func (*Resource) ResourceList ¶ added in v0.10.0
func (r *Resource) ResourceList() corev1.ResourceList
ResourceList returns a resource list of this resource.
func (*Resource) SetMaxResource ¶ added in v0.10.0
func (r *Resource) SetMaxResource(rl corev1.ResourceList)
SetMaxResource compares with ResourceList and takes max value for each Resource.
func (*Resource) SetScalar ¶ added in v0.10.0
func (r *Resource) SetScalar(name corev1.ResourceName, quantity int64)
SetScalar sets a resource by a scalar value of this resource.
type ResourceCallbackHandler ¶ added in v0.7.0
type ResourceCallbackHandler func(resource *unstructured.Unstructured) error
type ResourceClient ¶ added in v0.7.0
type ResourceClient interface { Resources(namespace string) dynamic.ResourceInterface Kind() string }
func NewResourceClient ¶ added in v0.7.0
func NewResourceClient(client dynamic.Interface, apiResource *metav1.APIResource) ResourceClient