當前位置: 首頁>>代碼示例>>Golang>>正文


Golang configuration.GetAvailablekubeApiServerEndPoint函數代碼示例

本文整理匯總了Golang中github.com/cloudawan/cloudone/utility/configuration.GetAvailablekubeApiServerEndPoint函數的典型用法代碼示例。如果您正苦於以下問題:Golang GetAvailablekubeApiServerEndPoint函數的具體用法?Golang GetAvailablekubeApiServerEndPoint怎麽用?Golang GetAvailablekubeApiServerEndPoint使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetAvailablekubeApiServerEndPoint函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: getNodeTopology

func getNodeTopology(request *restful.Request, response *restful.Response) {
	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	regionSlice, err := control.GetNodeTopology(kubeApiServerEndPoint, kubeApiServerToken)

	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get node topology failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}

	response.WriteJson(regionSlice, "[]Region")
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:27,代碼來源:node.go

示例2: CreateCommand

func CreateCommand() (*slb.Command, error) {
	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		log.Error(err)
		return nil, err
	}

	command := &slb.Command{
		time.Now(),
		nil,
		nil,
	}

	err = addCommandFromAllDeployInformation(command, kubeApiServerEndPoint, kubeApiServerToken)
	if err != nil {
		log.Error(err)
		return nil, err
	}

	err = addCommandFromAllBlueGreenDeployment(command, kubeApiServerEndPoint, kubeApiServerToken)
	if err != nil {
		log.Error(err)
		return nil, err
	}

	return command, nil
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:27,代碼來源:command.go

示例3: deleteReplicationController

func deleteReplicationController(request *restful.Request, response *restful.Response) {
	namespace := request.PathParameter("namespace")
	replicationController := request.PathParameter("replicationcontroller")

	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["namespace"] = namespace
		jsonMap["replicationController"] = replicationController
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	err = control.DeleteReplicationControllerAndRelatedPod(kubeApiServerEndPoint, kubeApiServerToken, namespace, replicationController)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Delete replication controller failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["replicationController"] = replicationController
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:31,代碼來源:replication_controller.go

示例4: getReplicationControllerMetric

func getReplicationControllerMetric(request *restful.Request, response *restful.Response) {
	namespace := request.PathParameter("namespace")
	replicationControllerName := request.PathParameter("replicationcontroller")

	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["namespace"] = namespace
		jsonMap["replicationControllerName"] = replicationControllerName
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	replicationControllerMetric, err := monitor.MonitorReplicationController(kubeApiServerEndPoint, kubeApiServerToken, namespace, replicationControllerName)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get replication controller metric failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["replicationControllerName"] = replicationControllerName
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}

	response.WriteJson(replicationControllerMetric, "ReplicationControllerMetric")
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:33,代碼來源:replication_controller_metric.go

示例5: deleteDeployClusterApplication

func deleteDeployClusterApplication(request *restful.Request, response *restful.Response) {
	namespace := request.PathParameter("namespace")
	clusterApplication := request.PathParameter("clusterapplication")

	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["namespace"] = namespace
		jsonMap["clusterApplication"] = clusterApplication
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	err = deploy.DeleteDeployClusterApplication(kubeApiServerEndPoint, kubeApiServerToken, namespace, clusterApplication)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Delete cluster application deployment failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["clusterApplication"] = clusterApplication
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:31,代碼來源:deploy_cluster_application.go

示例6: getAllKubernetesService

func getAllKubernetesService(request *restful.Request, response *restful.Response) {
	namespace := request.PathParameter("namespace")

	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["namespace"] = namespace
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	serviceSlice, err := control.GetAllService(kubeApiServerEndPoint, kubeApiServerToken, namespace)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get all service failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}

	response.WriteJson(serviceSlice, "[]Service")
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:30,代碼來源:service.go

示例7: getPodLog

func getPodLog(request *restful.Request, response *restful.Response) {
	namespace := request.PathParameter("namespace")
	pod := request.PathParameter("pod")

	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["namespace"] = namespace
		jsonMap["pod"] = pod
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	logJsonMap, err := control.GetPodLog(kubeApiServerEndPoint, kubeApiServerToken, namespace, pod)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get pod log failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["pod"] = pod
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}

	response.WriteJson(logJsonMap, "{}")
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:33,代碼來源:pod.go

示例8: postLaunchStatelessApplication

func postLaunchStatelessApplication(request *restful.Request, response *restful.Response) {
	namespace := request.PathParameter("namespace")
	name := request.PathParameter("statelessapplication")

	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["namespace"] = namespace
		jsonMap["name"] = name
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	environmentSlice := make([]interface{}, 0)
	err = request.ReadEntity(&environmentSlice)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Read body failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["name"] = name
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(400, string(errorMessageByteSlice))
		return
	}

	exist, err := monitor.ExistReplicationController(kubeApiServerEndPoint, kubeApiServerToken, namespace, name)
	if exist {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "The replication controller to use already exists"
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["name"] = name
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(409, string(errorMessageByteSlice))
		return
	}

	err = application.LaunchStatelessApplication(kubeApiServerEndPoint, kubeApiServerToken, namespace, name, environmentSlice)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Launch stateless application failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["name"] = name
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:59,代碼來源:application_stateless.go

示例9: GetKubernetesAllNodeIP

func (hostControl *HostControl) GetKubernetesAllNodeIP() ([]string, error) {
	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		log.Error(err)
		return nil, err
	}

	return control.GetAllNodeIP(kubeApiServerEndPoint, kubeApiServerToken)
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:9,代碼來源:host.go

示例10: putDeployResize

func putDeployResize(request *restful.Request, response *restful.Response) {
	sizeText := request.QueryParameter("size")
	namespace := request.PathParameter("namespace")
	imageinformation := request.PathParameter("imageinformation")

	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["namespace"] = namespace
		jsonMap["imageinformation"] = imageinformation
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	if sizeText == "" {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Input is incorrect. The fields sizeText is required."
		jsonMap["sizeText"] = sizeText
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(400, string(errorMessageByteSlice))
		return
	}
	size, err := strconv.Atoi(sizeText)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Could not parse sizeText"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["sizeText"] = sizeText
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(400, string(errorMessageByteSlice))
		return
	}

	err = deploy.DeployResize(kubeApiServerEndPoint, kubeApiServerToken, namespace, imageinformation, size)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Resize deployment failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["imageinformation"] = imageinformation
		jsonMap["size"] = size
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:54,代碼來源:deploy.go

示例11: postKubernetesService

func postKubernetesService(request *restful.Request, response *restful.Response) {
	namespace := request.PathParameter("namespace")

	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["namespace"] = namespace
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	service := new(control.Service)
	err = request.ReadEntity(&service)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Read body failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(400, string(errorMessageByteSlice))
		return
	}

	if service.Namespace != namespace {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Path parameter namespace is different from namespace in the body"
		jsonMap["path"] = namespace
		jsonMap["body"] = service.Namespace
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(400, string(errorMessageByteSlice))
		return
	}

	err = control.CreateService(kubeApiServerEndPoint, kubeApiServerToken, namespace, *service)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Create service failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["service"] = service
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:54,代碼來源:service.go

示例12: putDeployUpdate

func putDeployUpdate(request *restful.Request, response *restful.Response) {
	namespace := request.PathParameter("namespace")

	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["namespace"] = namespace
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	deployUpdateInput := new(DeployUpdateInput)
	err = request.ReadEntity(&deployUpdateInput)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Read body failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(400, string(errorMessageByteSlice))
		return
	}

	err = deploy.DeployUpdate(
		kubeApiServerEndPoint,
		kubeApiServerToken,
		namespace,
		deployUpdateInput.ImageInformationName,
		deployUpdateInput.Version,
		deployUpdateInput.Description,
		deployUpdateInput.EnvironmentSlice,
	)

	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Update deployment failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["deployUpdateInput"] = deployUpdateInput
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:52,代碼來源:deploy.go

示例13: deleteDeployBlueGreen

func deleteDeployBlueGreen(request *restful.Request, response *restful.Response) {
	imageInformation := request.PathParameter("imageinformation")

	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	err = deploy.GetStorage().DeleteDeployBlueGreen(imageInformation)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Delete blue green deployment failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["imageInformation"] = imageInformation
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}

	err = deploy.CleanAllServiceUnderBlueGreenDeployment(kubeApiServerEndPoint, kubeApiServerToken, imageInformation)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Delete all services under blue green deployment failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["imageInformation"] = imageInformation
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}

	err = slb.SendCommandToAllSLBDaemon()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Configure SLB failure"
		jsonMap["ErrorMessage"] = err.Error()
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:51,代碼來源:deploy_blue_green.go

示例14: putDeployBlueGreen

func putDeployBlueGreen(request *restful.Request, response *restful.Response) {
	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	deployBlueGreen := new(deploy.DeployBlueGreen)
	err = request.ReadEntity(&deployBlueGreen)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Read body failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(400, string(errorMessageByteSlice))
		return
	}

	err = deploy.UpdateDeployBlueGreen(kubeApiServerEndPoint, kubeApiServerToken, deployBlueGreen)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Update blue green deployment failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["deployBlueGreen"] = deployBlueGreen
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}

	err = slb.SendCommandToAllSLBDaemon()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Configure SLB failure"
		jsonMap["ErrorMessage"] = err.Error()
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:49,代碼來源:deploy_blue_green.go

示例15: putReplicationControllerSize

func putReplicationControllerSize(request *restful.Request, response *restful.Response) {
	namespace := request.PathParameter("namespace")
	replicationController := request.PathParameter("replicationcontroller")

	kubeApiServerEndPoint, kubeApiServerToken, err := configuration.GetAvailablekubeApiServerEndPoint()
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Get kube apiserver endpoint and token failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["namespace"] = namespace
		jsonMap["replicationController"] = replicationController
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(404, string(errorMessageByteSlice))
		return
	}

	sizeInput := SizeInput{}
	err = request.ReadEntity(&sizeInput)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Read body failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["replicationController"] = replicationController
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(400, string(errorMessageByteSlice))
		return
	}

	err = control.UpdateReplicationControllerSize(kubeApiServerEndPoint, kubeApiServerToken, namespace, replicationController, sizeInput.Size)
	if err != nil {
		jsonMap := make(map[string]interface{})
		jsonMap["Error"] = "Resize replication controller failure"
		jsonMap["ErrorMessage"] = err.Error()
		jsonMap["kubeApiServerEndPoint"] = kubeApiServerEndPoint
		jsonMap["namespace"] = namespace
		jsonMap["replicationController"] = replicationController
		jsonMap["size"] = sizeInput.Size
		errorMessageByteSlice, _ := json.Marshal(jsonMap)
		log.Error(jsonMap)
		response.WriteErrorString(422, string(errorMessageByteSlice))
		return
	}
}
開發者ID:cloudawan,項目名稱:cloudone,代碼行數:47,代碼來源:replication_controller.go


注:本文中的github.com/cloudawan/cloudone/utility/configuration.GetAvailablekubeApiServerEndPoint函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。