Example #1
0
func (this *PodService) GetPod(name string) Pod {
	var _pod Pod

	_podModel := k8sModel.PodModel{}
	data := _podModel.PodByName(name)

	_metadata_name_arr := strings.Split(data.Metadata.Name, "-")
	_metadata_name := strings.Join(_metadata_name_arr[:len(_metadata_name_arr)-1], "-")
	if _metadata_name == "kube-dns-v3" {
		_pod.Status = "fail"
		return _pod
	}

	_pod.Data = this.PodByName(name, data)
	_pod.Status = "ok"
	return _pod
}
Example #2
0
func (this *PodService) GetPodList() PodList {
	_podModel := k8sModel.PodModel{}
	data := _podModel.GetPodList()

	var _pod_list PodList
	for _, data_items := range data.Items {
		_metadata_name_arr := strings.Split(data_items.Metadata.Name, "-")
		_metadata_name := strings.Join(_metadata_name_arr[:len(_metadata_name_arr)-1], "-")
		if _metadata_name == "kube-dns-v3" {
			continue
		}

		data := _podModel.PodByName(data_items.Metadata.Name)
		_pod := this.PodByName(data_items.Metadata.Name, data)
		_pod_list.Data = append(_pod_list.Data, _pod)
	}
	return _pod_list
}