当前位置: 首页>>代码示例>>Golang>>正文


Golang ReplicationControllerModel.GetReplicationController方法代码示例

本文整理汇总了Golang中models/k8sModel.ReplicationControllerModel.GetReplicationController方法的典型用法代码示例。如果您正苦于以下问题:Golang ReplicationControllerModel.GetReplicationController方法的具体用法?Golang ReplicationControllerModel.GetReplicationController怎么用?Golang ReplicationControllerModel.GetReplicationController使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models/k8sModel.ReplicationControllerModel的用法示例。


在下文中一共展示了ReplicationControllerModel.GetReplicationController方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Delete

func (this *LineService) Delete(data []byte) line {
	fmt.Println("[Delete] LineService")

	var _data_format data_format
	json.Unmarshal(data, &_data_format)

	service_model := k8sModel.ServiceModel{}
	_get_service_data := service_model.GetService(_data_format.Service_name)

	replication_controller_model := k8sModel.ReplicationControllerModel{}
	_get_replication_controller_data := replication_controller_model.GetReplicationController(_data_format.Cluster_name)

	var _line line

	if _get_service_data.Spec.Selector == nil {
		_line.Status = "fail"
		_line.Errmsg = "service no selector"
		return _line
	}

	if _get_service_data.Spec.Selector["name"] != _get_replication_controller_data.Spec.Selector["name"] {
		_line.Status = "fail"
		_line.Errmsg = "service and cluster not same"
		return _line
	}

	_get_service_data.Spec.Selector["name"] = _get_service_data.Spec.Selector["name"] + "-giga"
	service_model.UpdateService(_data_format.Service_name, _get_service_data)

	_line.Status = "ok"
	return _line
}
开发者ID:w19900227,项目名称:go-k8s,代码行数:32,代码来源:lineService.go

示例2: Post

func (this *LineService) Post(data []byte) line {
	fmt.Println("[Post] LineService")

	var _data_format data_format
	json.Unmarshal(data, &_data_format)

	service_model := k8sModel.ServiceModel{}
	_get_service_data := service_model.GetService(_data_format.Service_name)

	replication_controller_model := k8sModel.ReplicationControllerModel{}
	_get_replication_controller_data := replication_controller_model.GetReplicationController(_data_format.Cluster_name)

	var _line line

	if _get_service_data.Spec.Selector == nil {
		_line.Status = "fail"
		_line.Errmsg = "service no selector"
		return _line
	}

	_get_service_data.Spec.Selector = _get_replication_controller_data.Spec.Selector

	service_model.UpdateService(_data_format.Service_name, _get_service_data)
	// _put_service_data := service_model.UpdateService(_data_format.Service_name, _get_service_data)
	// if _put_service_data.Status_code == "200" {
	// 	Status = "ok"
	// } else {
	// 	Status = "fail"
	// }
	_line.Status = "ok"
	return _line
}
开发者ID:w19900227,项目名称:go-k8s,代码行数:32,代码来源:lineService.go

示例3: UpdateReplicationController

func (this *ReplicationControllerService) UpdateReplicationController(rc_name string, data []byte) Cluster {
	type rc_format struct {
		// Cluster_name string `json:"cluster_name"`
		Port            string            `json:"port"`
		Container_count string            `json:"container_count"`
		Cpu             string            `json:"cpu"`
		Image           string            `json:"image"`
		Label           map[string]string `json:"label"`
	}
	var _rc_format rc_format
	json.Unmarshal(data, &_rc_format)

	_replication_controllerModel := k8sModel.ReplicationControllerModel{}
	_k8s_rc := _replication_controllerModel.GetReplicationController(rc_name)

	var _cluster Cluster
	_k8s_rc.Metadata.Labels = _rc_format.Label
	_k8s_rc.Spec.Replicas, _ = strconv.Atoi(_rc_format.Container_count)
	// _k8s_rc.Spec.Selector["name"] = _rc_format.Cluster_name
	// _k8s_rc.Spec.Template.Metadata.Labels["name"] = _rc_format.Cluster_name
	// _k8s_rc.Spec.Template.Spec.Containers[0].Name = _rc_format.Cluster_name
	_k8s_rc.Spec.Template.Spec.Containers[0].Image = _rc_format.Image
	_k8s_rc.Spec.Template.Spec.Containers[0].Ports[0].ContainerPort, _ = strconv.Atoi(_rc_format.Port)

	_replication_controllerModel.UpdateReplicationController(rc_name, _k8s_rc)

	_cluster.Status = "ok"
	return _cluster
}
开发者ID:w19900227,项目名称:go-k8s,代码行数:29,代码来源:replication_controllerService.go

示例4: GetReplicationController

func (this *ReplicationControllerService) GetReplicationController(rc_name string) Cluster {
	_replication_controllerModel := k8sModel.ReplicationControllerModel{}
	data := _replication_controllerModel.GetReplicationController(rc_name)

	var _cluster Cluster
	_cluster.Data = this.RcByName(data)

	_cluster.Status = "ok"
	return _cluster
}
开发者ID:w19900227,项目名称:go-k8s,代码行数:10,代码来源:replication_controllerService.go

示例5: DeleteReplicationController

func (this *ReplicationControllerService) DeleteReplicationController(rc_name string) Cluster {
	_replication_controllerModel := k8sModel.ReplicationControllerModel{}
	_k8s_rc := _replication_controllerModel.GetReplicationController(rc_name)
	_k8s_rc.Spec.Replicas = 0
	_replication_controllerModel.UpdateReplicationController(rc_name, _k8s_rc)
	_replication_controllerModel.DeleteReplicationController(rc_name)

	var _cluster Cluster
	_cluster.Status = "ok"

	return _cluster
}
开发者ID:w19900227,项目名称:go-k8s,代码行数:12,代码来源:replication_controllerService.go


注:本文中的models/k8sModel.ReplicationControllerModel.GetReplicationController方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。