Documentation ¶
Index ¶
- Constants
- func AddObjectMetaDefaultLabel(meta *metav1.ObjectMeta) *metav1.ObjectMeta
- func AddObjectMetaRunLabel(meta *metav1.ObjectMeta) *metav1.ObjectMeta
- func CreateService(req *Request, svc *v1.Service) (*v1.Service, error)
- func CreateServiceByOption(req *Request, objMeta *metav1.ObjectMeta, opt *api.ServiceCreateOption) (*v1.Service, error)
- func CreateServiceIfNotExist(req *Request, objMeta *metav1.ObjectMeta, opt *api.ServiceCreateOption) (*v1.Service, error)
- func EqualIgnoreHash(template1, template2 v1.PodTemplateSpec) bool
- func FilterDeploymentPodsByOwnerReference(deployment *apps.Deployment, allRS []*apps.ReplicaSet, allPods []*v1.Pod) []*v1.Pod
- func FilterPodsByControllerRef(owner metav1.Object, allPods []*v1.Pod) []*v1.Pod
- func FilterPodsForJob(job *batch.Job, pods []*v1.Pod) []*v1.Pod
- func GenerateName(base string) string
- func GetConfigMapsForPod(pod *v1.Pod, cfgs []*v1.ConfigMap) []*v1.ConfigMap
- func GetContainerImages(podTemplate *v1.PodSpec) []api.ContainerImage
- func GetContainerNames(podTemplate *v1.PodSpec) []string
- func GetExternalEndpoints(service *v1.Service) []api.Endpoint
- func GetInitContainerImages(podTemplate *v1.PodSpec) []api.ContainerImage
- func GetInitContainerNames(podTemplate *v1.PodSpec) []string
- func GetInternalEndpoint(serviceName, namespace string, ports []v1.ServicePort) api.Endpoint
- func GetK8sObjectCreateMeta(data jsonutils.JSONObject) (*metav1.ObjectMeta, error)
- func GetK8sObjectCreateMetaByRequest(req *Request) (*metav1.ObjectMeta, error)
- func GetK8sObjectCreateMetaWithLabel(req *Request) (*metav1.ObjectMeta, *metav1.LabelSelector, error)
- func GetPodConfigMapVolumes(pod *v1.Pod) []v1.Volume
- func GetPodInfo(current int32, desired *int32, pods []*v1.Pod) api.PodInfo
- func GetPodSecretVolumes(pod *v1.Pod) []v1.Volume
- func GetPodTemplate(req *Request, wrapperKey string) (*v1.PodTemplateSpec, error)
- func GetSecretsForPod(pod *v1.Pod, ss []*v1.Secret) []*v1.Secret
- func GetSelectorByObjectMeta(meta *metav1.ObjectMeta) *metav1.LabelSelector
- func GetServiceFromOption(objMeta *metav1.ObjectMeta, opt *api.ServiceCreateOption) *v1.Service
- func GetServicePorts(apiPorts []v1.ServicePort) []api.ServicePort
- func GetServicePortsByMapping(ps []api.PortMapping) []v1.ServicePort
- func JsonDecode(data jsonutils.JSONObject, obj interface{}) error
- func ListResource2JSONWithKey(list ListResource, key string) map[string]interface{}
- func NewDataSelectQuery(query jsonutils.JSONObject) *dataselect.DataSelectQuery
- func ToConfigMap(configMap *v1.ConfigMap, cluster api.ICluster) api.ConfigMap
- func ToConfigMaps(cfgs []*v1.ConfigMap, cluster api.ICluster) []api.ConfigMap
- func ToSecret(secret *v1.Secret, cluster api.ICluster) *api.Secret
- func ToSecrets(ss []*v1.Secret, cluster api.ICluster) []api.Secret
- func ValidateK8sResourceCreateData(req *Request, kind string, inNamespace bool) error
- type BaseList
- type ClusterRoleBindingListChannel
- type ClusterRoleListChannel
- type ConfigMapListChannel
- type DaemonSetListChannel
- type DeploymentListChannel
- type EndpointListChannel
- type EventList
- type EventListChannel
- type HorizontalPodAutoscalerListChannel
- type JobListChannel
- type LimitRangeListChannel
- type ListResource
- type NamespaceListChannel
- type NamespaceQuery
- type NetworkConfig
- type NodeListChannel
- type PersistentVolumeClaimListChannel
- type PersistentVolumeListChannel
- type PodListChannel
- type ReplicaSetListChannel
- type ReplicationControllerListChannel
- type Request
- func (r *Request) AllowListItems() bool
- func (r *Request) DataUnmarshal(input interface{}) error
- func (r *Request) GetCluster() *models.SCluster
- func (r *Request) GetDefaultNamespace() string
- func (r *Request) GetHandler() yclient.ResourceHandler
- func (r *Request) GetHelmClient(namespace string) (*helm.Client, error)
- func (r *Request) GetIndexer() *yclient.CacheFactory
- func (r *Request) GetK8sAdminClient() client.Interface
- func (r *Request) GetK8sAdminRestConfig() *rest.Config
- func (r *Request) GetK8sClient() client.Interface
- func (r *Request) GetK8sManager() *yclient.ClusterManager
- func (r *Request) GetK8sRestConfig() *rest.Config
- func (r *Request) GetNamespaceByData() (string, error)
- func (r *Request) GetNamespaceByQuery() (string, error)
- func (r *Request) GetNamespaceQuery() *NamespaceQuery
- func (r *Request) GetParams() map[string]string
- func (r *Request) GetVerberClient() yclient.ResourceHandler
- func (r *Request) IsClusterOwner() bool
- func (r *Request) IsK8sResourceExists(kind string, namespace string, id string) (bool, error)
- func (r *Request) ShowAllNamespace() bool
- func (r *Request) ToQuery() *dataselect.DataSelectQuery
- type ResourceChannels
- type ResourceQuotaListChannel
- type ResourceStatus
- type RoleBindingListChannel
- type RoleListChannel
- type SecretListChannel
- type ServiceListChannel
- type StatefulSetListChannel
- type StorageClassListChannel
Constants ¶
const ( // k8s annotations for create pod YUNION_CNI_NETWORK_ANNOTATION = "cni.yunion.io/network" YUNION_CNI_IPADDR_ANNOTATION = "cni.yunion.io/ip" YUNION_LB_NETWORK_ANNOTATION = "loadbalancer.yunion.io/network" )
Variables ¶
This section is empty.
Functions ¶
func AddObjectMetaDefaultLabel ¶
func AddObjectMetaDefaultLabel(meta *metav1.ObjectMeta) *metav1.ObjectMeta
func AddObjectMetaRunLabel ¶
func AddObjectMetaRunLabel(meta *metav1.ObjectMeta) *metav1.ObjectMeta
func CreateServiceByOption ¶
func CreateServiceByOption(req *Request, objMeta *metav1.ObjectMeta, opt *api.ServiceCreateOption) (*v1.Service, error)
func CreateServiceIfNotExist ¶
func CreateServiceIfNotExist(req *Request, objMeta *metav1.ObjectMeta, opt *api.ServiceCreateOption) (*v1.Service, error)
func EqualIgnoreHash ¶
func EqualIgnoreHash(template1, template2 v1.PodTemplateSpec) bool
EqualIgnoreHash returns true if two given podTemplateSpec are equal, ignoring the diff in value of Labels[pod-template-hash] We ignore pod-template-hash because the hash result would be different upon podTemplateSpec API changes (e.g. the addition of a new field will cause the hash code to change) Note that we assume input podTemplateSpecs contain non-empty labels
func FilterDeploymentPodsByOwnerReference ¶
func FilterDeploymentPodsByOwnerReference(deployment *apps.Deployment, allRS []*apps.ReplicaSet, allPods []*v1.Pod) []*v1.Pod
FilterPodsByControllerResource returns a subset of pods controlled by given deployment.
func FilterPodsByControllerRef ¶
FilterPodsByControllerRef returns a subset of pods controlled by given controller resource, excluding deployments.
func GenerateName ¶
func GetConfigMapsForPod ¶
func GetContainerImages ¶
func GetContainerImages(podTemplate *v1.PodSpec) []api.ContainerImage
GetContainerImages returns container image strings from the given pod spec.
func GetContainerNames ¶
GetContainerNames returns the container image name without the version number from the given pod spec.
func GetExternalEndpoints ¶
GetExternalEndpoints returns endpoints that are externally reachable for a service.
func GetInitContainerImages ¶
func GetInitContainerImages(podTemplate *v1.PodSpec) []api.ContainerImage
GetInitContainerImages returns init container image strings from the given pod spec.
func GetInitContainerNames ¶
GetInitContainerNames returns the init container image name without the version number from the given pod spec.
func GetInternalEndpoint ¶
func GetInternalEndpoint(serviceName, namespace string, ports []v1.ServicePort) api.Endpoint
GetInternalEndpoint returns internal endpoint name for the given service properties, e.g., "my-service.namespace 80/TCP" or "my-service 53/TCP,53/UDP".
func GetK8sObjectCreateMeta ¶
func GetK8sObjectCreateMeta(data jsonutils.JSONObject) (*metav1.ObjectMeta, error)
func GetK8sObjectCreateMetaByRequest ¶
func GetK8sObjectCreateMetaByRequest(req *Request) (*metav1.ObjectMeta, error)
func GetK8sObjectCreateMetaWithLabel ¶
func GetK8sObjectCreateMetaWithLabel(req *Request) (*metav1.ObjectMeta, *metav1.LabelSelector, error)
func GetPodInfo ¶
GetPodInfo returns aggregate information about a group of pods.
func GetPodTemplate ¶
func GetPodTemplate(req *Request, wrapperKey string) (*v1.PodTemplateSpec, error)
func GetSelectorByObjectMeta ¶
func GetSelectorByObjectMeta(meta *metav1.ObjectMeta) *metav1.LabelSelector
func GetServiceFromOption ¶
func GetServiceFromOption(objMeta *metav1.ObjectMeta, opt *api.ServiceCreateOption) *v1.Service
func GetServicePorts ¶
func GetServicePorts(apiPorts []v1.ServicePort) []api.ServicePort
GetServicePorts returns human readable name for the given service ports list.
func GetServicePortsByMapping ¶
func GetServicePortsByMapping(ps []api.PortMapping) []v1.ServicePort
func JsonDecode ¶
func JsonDecode(data jsonutils.JSONObject, obj interface{}) error
func ListResource2JSONWithKey ¶
func ListResource2JSONWithKey(list ListResource, key string) map[string]interface{}
func NewDataSelectQuery ¶
func NewDataSelectQuery(query jsonutils.JSONObject) *dataselect.DataSelectQuery
Types ¶
type BaseList ¶
type BaseList struct { *dataselect.ListMeta Cluster api.ICluster }
func NewBaseList ¶
func (*BaseList) GetCluster ¶
type ClusterRoleBindingListChannel ¶
type ClusterRoleBindingListChannel struct { List chan []*rbac.ClusterRoleBinding Error chan error }
ClusterRoleBindingListChannel is a list and error channels to ClusterRoleBindings.
func GetClusterRoleBindingListChannel ¶
func GetClusterRoleBindingListChannel(indexer *client.CacheFactory) ClusterRoleBindingListChannel
type ClusterRoleListChannel ¶
type ClusterRoleListChannel struct { List chan []*rbac.ClusterRole Error chan error }
ClusterRoleListChannel is a list and error channels to ClusterRoles.
func GetClusterRoleListChannel ¶
func GetClusterRoleListChannel(indexer *client.CacheFactory) ClusterRoleListChannel
type ConfigMapListChannel ¶
ConfigMapListChannel is a list and error channels to ConfigMaps.
func GetConfigMapListChannel ¶
func GetConfigMapListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) ConfigMapListChannel
func GetConfigMapListChannelWithOptions ¶
func GetConfigMapListChannelWithOptions(indexer *client.CacheFactory, nsQuery *NamespaceQuery, options labels.Selector) ConfigMapListChannel
type DaemonSetListChannel ¶
type DaemonSetListChannel struct { //List chan []*apps.DaemonSet List chan []*apps.DaemonSet Error chan error }
func GetDaemonSetListChannel ¶
func GetDaemonSetListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) DaemonSetListChannel
type DeploymentListChannel ¶
type DeploymentListChannel struct { List chan []*apps.Deployment Error chan error }
func GetDeploymentListChannel ¶
func GetDeploymentListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) DeploymentListChannel
type EndpointListChannel ¶
func GetEndpointListChannel ¶
func GetEndpointListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) EndpointListChannel
func GetEndpointListChannelWithOptions ¶
func GetEndpointListChannelWithOptions(indexer *client.CacheFactory, nsQuery *NamespaceQuery, opt labels.Selector) EndpointListChannel
type EventList ¶
type EventList struct { *BaseList // List of events from given namespace. Events []api.Event `json:"events"` }
EventList is an events response structure.
type EventListChannel ¶
func GetEventListChannel ¶
func GetEventListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) EventListChannel
func GetEventListChannelWithOptions ¶
func GetEventListChannelWithOptions(indexer *client.CacheFactory, nsQuery *NamespaceQuery, options labels.Selector) EventListChannel
type HorizontalPodAutoscalerListChannel ¶
type HorizontalPodAutoscalerListChannel struct { List chan []*autoscaling.HorizontalPodAutoscaler Error chan error }
HorizontalPodAutoscalerListChannel is a list and error channels.
func GetHorizontalPodAutoscalerListChannel ¶
func GetHorizontalPodAutoscalerListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) HorizontalPodAutoscalerListChannel
type JobListChannel ¶
func GetJobListChannel ¶
func GetJobListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) JobListChannel
type LimitRangeListChannel ¶
type LimitRangeListChannel struct { List chan []*v1.LimitRange Error chan error }
func GetLimitRangeListChannel ¶
func GetLimitRangeListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) LimitRangeListChannel
type ListResource ¶
type NamespaceListChannel ¶
func GetNamespaceListChannel ¶
func GetNamespaceListChannel(indexer *client.CacheFactory) NamespaceListChannel
type NamespaceQuery ¶
type NamespaceQuery struct {
// contains filtered or unexported fields
}
func NewNamespaceQuery ¶
func NewNamespaceQuery(namespaces ...string) *NamespaceQuery
func NewSameNamespaceQuery ¶
func NewSameNamespaceQuery(namespace string) *NamespaceQuery
NewSameNamespaceQuery creates new namespace query that queries single namespace.
func (*NamespaceQuery) Matches ¶
func (n *NamespaceQuery) Matches(namespace string) bool
func (*NamespaceQuery) ToRequestParam ¶
func (n *NamespaceQuery) ToRequestParam() string
type NetworkConfig ¶
func (NetworkConfig) ToPodAnnotation ¶
func (n NetworkConfig) ToPodAnnotation() map[string]string
type NodeListChannel ¶
func GetNodeListChannel ¶
func GetNodeListChannel(indexer *client.CacheFactory) NodeListChannel
type PersistentVolumeClaimListChannel ¶
type PersistentVolumeClaimListChannel struct { List chan []*v1.PersistentVolumeClaim Error chan error }
PersistentVolumeClaimListChannel is a list and error channels to PersistentVolumeClaims.
func GetPersistentVolumeClaimListChannel ¶
func GetPersistentVolumeClaimListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) PersistentVolumeClaimListChannel
type PersistentVolumeListChannel ¶
type PersistentVolumeListChannel struct { List chan []*v1.PersistentVolume Error chan error }
PersistentVolumeListChannel is a list and error channels to PersistentVolumes.
func GetPersistentVolumeListChannel ¶
func GetPersistentVolumeListChannel(indexer *client.CacheFactory) PersistentVolumeListChannel
type PodListChannel ¶
PodListChannel is a list and error channels to Nodes
func GetPodListChannel ¶
func GetPodListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) PodListChannel
func GetPodListChannelWithOptions ¶
func GetPodListChannelWithOptions(indexer *client.CacheFactory, nsQuery *NamespaceQuery, options labels.Selector) PodListChannel
type ReplicaSetListChannel ¶
type ReplicaSetListChannel struct { List chan []*apps.ReplicaSet Error chan error }
func GetReplicaSetListChannel ¶
func GetReplicaSetListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) ReplicaSetListChannel
func GetReplicaSetListChannelWithOptions ¶
func GetReplicaSetListChannelWithOptions(indexer *client.CacheFactory, nsQuery *NamespaceQuery, options labels.Selector) ReplicaSetListChannel
type ReplicationControllerListChannel ¶
type ReplicationControllerListChannel struct { List chan []*v1.ReplicationController Error chan error }
func GetReplicationControllerListChannel ¶
func GetReplicationControllerListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) ReplicationControllerListChannel
type Request ¶
type Request struct { Cluster *models.SCluster ClusterManager *yclient.ClusterManager K8sClient client.Interface K8sAdminClient client.Interface K8sConfig *rest.Config K8sAdminConfig *rest.Config UserCred mcclient.TokenCredential Query *jsonutils.JSONDict Data *jsonutils.JSONDict Context context.Context KubeAdminConfig string }
func (*Request) AllowListItems ¶
func (*Request) DataUnmarshal ¶
func (*Request) GetCluster ¶
func (*Request) GetDefaultNamespace ¶
func (*Request) GetHandler ¶
func (r *Request) GetHandler() yclient.ResourceHandler
GetHandler return generic kubenretes CRUD resource handler
func (*Request) GetHelmClient ¶
func (*Request) GetIndexer ¶
func (r *Request) GetIndexer() *yclient.CacheFactory
func (*Request) GetK8sAdminClient ¶
func (*Request) GetK8sAdminRestConfig ¶
func (*Request) GetK8sClient ¶
func (*Request) GetK8sManager ¶
func (r *Request) GetK8sManager() *yclient.ClusterManager
func (*Request) GetK8sRestConfig ¶
func (*Request) GetNamespaceByData ¶
func (*Request) GetNamespaceByQuery ¶
func (r *Request) GetGenericClient() (*k8sclient.GenericClient, error) { return k8sclient.NewGeneric(r.KubeAdminConfig) }
func (*Request) GetNamespaceQuery ¶
func (r *Request) GetNamespaceQuery() *NamespaceQuery
func (*Request) GetVerberClient ¶
func (r *Request) GetVerberClient() yclient.ResourceHandler
func (*Request) IsClusterOwner ¶
func (*Request) IsK8sResourceExists ¶
func (*Request) ShowAllNamespace ¶
func (*Request) ToQuery ¶
func (r *Request) ToQuery() *dataselect.DataSelectQuery
type ResourceChannels ¶
type ResourceChannels struct { // List and error channels to Replication Controllers. ReplicationControllerList ReplicationControllerListChannel // List and error channels to Replica Sets ReplicaSetList ReplicaSetListChannel // List and error channels to Deployments DeploymentList DeploymentListChannel // List and error channels to Daemon Sets DaemonSetList DaemonSetListChannel // List and error channels to Jobs. JobList JobListChannel // List and error channels to Services ServiceList ServiceListChannel // List and error channels to Endpoints. EndpointList EndpointListChannel // List and error channels to Pods PodList PodListChannel // List and error channels to Events. EventList EventListChannel // List and error channels to LimitRanges. LimitRangeList LimitRangeListChannel // List and error channels to Nodes. NodeList NodeListChannel // List and error channels to Namespaces. NamespaceList NamespaceListChannel // List and error channels to StatefulSets. StatefulSetList StatefulSetListChannel // List and error channels to ConfigMaps. ConfigMapList ConfigMapListChannel // List and error channels to Secrets. SecretList SecretListChannel // List and error channels to PersistentVolumes PersistentVolumeList PersistentVolumeListChannel // List and error channels to PersistentVolumeClaims PersistentVolumeClaimList PersistentVolumeClaimListChannel // List and error channels to ResourceQuotas ResourceQuotaList ResourceQuotaListChannel // List and error channels to HorizontalPodAutoscalers HorizontalPodAutoscalerList HorizontalPodAutoscalerListChannel // List and error channels to StorageClasses StorageClassList StorageClassListChannel // List and error channels to Roles RoleList RoleListChannel // List and error channels to ClusterRoles ClusterRoleList ClusterRoleListChannel // List and error channels to RoleBindings RoleBindingList RoleBindingListChannel // List and error channels to ClusterRoleBindings ClusterRoleBindingList ClusterRoleBindingListChannel }
ResourceChannels struct holds channels to resource lists. Each list channel is paired with an error channel which *must* be read sequentially: first read the list channel and then the error channel.
type ResourceQuotaListChannel ¶
type ResourceQuotaListChannel struct { List chan []*v1.ResourceQuota Error chan error }
ResourceQuotaListChannel is a list and error channels to ResourceQuotas.
func GetResourceQuotaListChannel ¶
func GetResourceQuotaListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) ResourceQuotaListChannel
type ResourceStatus ¶
type ResourceStatus struct { // Number of resources that are currently in running state. Running int `json:"running"` // Number of resources that are currently in pending state. Pending int `json:"pending"` // Number of resources that are in failed state. Failed int `json:"failed"` // Number of resources that are in succeeded state. Succeeded int `json:"succeeded"` }
ResourceStatus provides basic information about resources status on the list.
type RoleBindingListChannel ¶
type RoleBindingListChannel struct { List chan []*rbac.RoleBinding Error chan error }
RoleBindingListChannel is a list and error channels to RoleBindings.
func GetRoleBindingListChannel ¶
func GetRoleBindingListChannel(indexer *client.CacheFactory) RoleBindingListChannel
type RoleListChannel ¶
RoleListChannel is a list and error channels to Roles.
func GetRoleListChannel ¶
func GetRoleListChannel(indexer *client.CacheFactory) RoleListChannel
type SecretListChannel ¶
SecretListChannel is a list and error channels to Secrets.
func GetSecretListChannel ¶
func GetSecretListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) SecretListChannel
type ServiceListChannel ¶
// IngressListChannel is a list and error channels to Ingresss.
type IngressListChannel struct { List chan []*extensions.Ingress Error chan error } func GetIngressListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) IngressListChannel { return GetIngressListChannelWithOptions(indexer, nsQuery, api.ListEverything) } func GetIngressListChannelWithOptions(indexer *client.CacheFactory, nsQuery *NamespaceQuery, options metaV1.ListOptions) IngressListChannel { channel := IngressListChannel{ List: make(chan []*extensions.Ingress), Error: make(chan error), } go func() { list, err := indexer.IngressLister().Ingresses(nsQuery.ToRequestParam()).List(labels.Everything()) channel.List <- list channel.Error <- err }() return channel }
func GetServiceListChannel ¶
func GetServiceListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) ServiceListChannel
func GetServiceListChannelWithOptions ¶
func GetServiceListChannelWithOptions(indexer *client.CacheFactory, nsQuery *NamespaceQuery, options labels.Selector) ServiceListChannel
type StatefulSetListChannel ¶
type StatefulSetListChannel struct { List chan []*apps.StatefulSet Error chan error }
StatefulSetListChannel is a list and error channels to Nodes.
func GetStatefulSetListChannel ¶
func GetStatefulSetListChannel(indexer *client.CacheFactory, nsQuery *NamespaceQuery) StatefulSetListChannel
func GetStatefulSetListChannelWithOptions ¶
func GetStatefulSetListChannelWithOptions(indexer *client.CacheFactory, nsQuery *NamespaceQuery, options labels.Selector) StatefulSetListChannel
type StorageClassListChannel ¶
type StorageClassListChannel struct { List chan []*storage.StorageClass Error chan error }
StorageClassListChannel is a list and error channels to storage classes.
func GetStorageClassListChannel ¶
func GetStorageClassListChannel(indexer *client.CacheFactory) StorageClassListChannel