// GetDaemonSetList returns a list of all Daemon Set in the cluster. func GetDaemonSetList(client *client.Client, nsQuery *common.NamespaceQuery) (*DaemonSetList, error) { log.Printf("Getting list of all daemon sets in the cluster") channels := &common.ResourceChannels{ DaemonSetList: common.GetDaemonSetListChannel(client, nsQuery, 1), ServiceList: common.GetServiceListChannel(client, nsQuery, 1), PodList: common.GetPodListChannel(client, nsQuery, 1), EventList: common.GetEventListChannel(client, nsQuery, 1), } return GetDaemonSetListFromChannels(channels) }
// GetWorkloads returns a list of all workloads in the cluster. func GetWorkloads(client *k8sClient.Client, heapsterClient client.HeapsterClient, nsQuery *common.NamespaceQuery) (*Workloads, error) { log.Printf("Getting lists of all workloads") channels := &common.ResourceChannels{ ReplicationControllerList: common.GetReplicationControllerListChannel(client, nsQuery, 1), ReplicaSetList: common.GetReplicaSetListChannel(client.Extensions(), nsQuery, 1), JobList: common.GetJobListChannel(client.Batch(), nsQuery, 1), DaemonSetList: common.GetDaemonSetListChannel(client.Extensions(), nsQuery, 1), DeploymentList: common.GetDeploymentListChannel(client.Extensions(), nsQuery, 1), PetSetList: common.GetPetSetListChannel(client.Apps(), nsQuery, 1), ServiceList: common.GetServiceListChannel(client, nsQuery, 1), PodList: common.GetPodListChannel(client, nsQuery, 7), EventList: common.GetEventListChannel(client, nsQuery, 6), } return GetWorkloadsFromChannels(channels, heapsterClient) }
// GetServiceList returns a list of all services in the cluster. func GetServiceList(client client.Interface, nsQuery *common.NamespaceQuery) (*ServiceList, error) { log.Printf("Getting list of all services in the cluster") channels := &common.ResourceChannels{ ServiceList: common.GetServiceListChannel(client, nsQuery, 1), } services := <-channels.ServiceList.List if err := <-channels.ServiceList.Error; err != nil { return nil, err } serviceList := &ServiceList{Services: make([]Service, 0)} for _, service := range services.Items { serviceList.Services = append(serviceList.Services, ToService(&service)) } return serviceList, nil }