本文整理匯總了Golang中models/k8sModel.ReplicationControllerModel.UpdateReplicationController方法的典型用法代碼示例。如果您正苦於以下問題:Golang ReplicationControllerModel.UpdateReplicationController方法的具體用法?Golang ReplicationControllerModel.UpdateReplicationController怎麽用?Golang ReplicationControllerModel.UpdateReplicationController使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models/k8sModel.ReplicationControllerModel
的用法示例。
在下文中一共展示了ReplicationControllerModel.UpdateReplicationController方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: 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
}
示例2: 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
}