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


Golang api.EnvVar類代碼示例

本文整理匯總了Golang中k8s/io/kubernetes/pkg/api.EnvVar的典型用法代碼示例。如果您正苦於以下問題:Golang EnvVar類的具體用法?Golang EnvVar怎麽用?Golang EnvVar使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: deepCopy_api_EnvVar

func deepCopy_api_EnvVar(in api.EnvVar, out *api.EnvVar, c *conversion.Cloner) error {
	out.Name = in.Name
	out.Value = in.Value
	if in.ValueFrom != nil {
		out.ValueFrom = new(api.EnvVarSource)
		if err := deepCopy_api_EnvVarSource(*in.ValueFrom, out.ValueFrom, c); err != nil {
			return err
		}
	} else {
		out.ValueFrom = nil
	}
	return nil
}
開發者ID:josafat,項目名稱:contrib,代碼行數:13,代碼來源:deep_copy_generated.go

示例2: writeEnvVar

func writeEnvVar(m map[string]interface{}, item *api.EnvVar) {
	if x, ok := m["name"].(string); ok {
		item.Name = x
	}
	if x, ok := m["value"].(string); ok {
		item.Value = x
	}

	if n, ok := extractSingleMap(m["value_from"]); ok {
		item.Value = ""
		item.ValueFrom = &api.EnvVarSource{}

		if o, ok := extractSingleMap(n["field_ref"]); ok {
			item.ValueFrom.FieldRef = &api.ObjectFieldSelector{}
			if x, ok := o["field_path"].(string); ok {
				item.ValueFrom.FieldRef.FieldPath = x
			}
		}

		if o, ok := extractSingleMap(n["config_map_key_ref"]); ok {
			item.ValueFrom.ConfigMapKeyRef = &api.ConfigMapKeySelector{}
			if x, ok := o["name"].(string); ok {
				item.ValueFrom.ConfigMapKeyRef.Name = x
			}
			if x, ok := o["key"].(string); ok {
				item.ValueFrom.ConfigMapKeyRef.Key = x
			}
		}

		if o, ok := extractSingleMap(n["secret_key_ref"]); ok {
			item.ValueFrom.SecretKeyRef = &api.SecretKeySelector{}
			if x, ok := o["name"].(string); ok {
				item.ValueFrom.SecretKeyRef.Name = x
			}
			if x, ok := o["key"].(string); ok {
				item.ValueFrom.SecretKeyRef.Key = x
			}
		}
	}
}
開發者ID:fd,項目名稱:terraform-provider-kubernetes,代碼行數:40,代碼來源:replication_controller_resource.go

示例3: buildEnvVar

func buildEnvVar(userEnvVars []interface{}) []api.EnvVar {
	if len(userEnvVars) == 0 {
		return nil
	}

	var envVars []api.EnvVar

	for _, e := range userEnvVars {
		userEnvVar := e.(map[string]interface{})

		envVar := api.EnvVar{
			Name: userEnvVar["name"].(string),
		}

		if _, ok := userEnvVar["value"]; ok {
			log.Printf("envvar value : %s", userEnvVar["value"].(string))
			envVar.Value = userEnvVar["value"].(string)
		}

		envVars = append(envVars, envVar)
	}
	return envVars
}
開發者ID:kelcecil,項目名稱:terraform-provider-kubernetes,代碼行數:23,代碼來源:build_kubernetes_resource_controller.go

示例4: addOriginVersionVar

func addOriginVersionVar(output *[]kapi.EnvVar) {
	version := kapi.EnvVar{Name: buildapi.OriginVersion, Value: version.Get().String()}
	*output = append(*output, version)
}
開發者ID:juanluisvaladas,項目名稱:origin,代碼行數:4,代碼來源:util.go

示例5:

var _ = Describe("Container Conformance Test", func() {
	var cl *client.Client

	BeforeEach(func() {
		// Setup the apiserver client
		cl = client.NewOrDie(&restclient.Config{Host: *apiServerAddress})
	})

	Describe("container conformance blackbox test", func() {
		Context("when running a container that terminates", func() {
			var terminateCase ConformanceContainer
			var terminateImage ConformanceImage
			BeforeEach(func() {
				var envs []api.EnvVar
				var env api.EnvVar

				env.Name = "USERNAME"
				env.Value = "tiesheng"
				envs = append(envs, env)

				env.Name = "PASSWORD"
				env.Value = "opensource"
				envs = append(envs, env)

				env.Name = "EMAIL"
				env.Value = "[email protected]"
				envs = append(envs, env)

				env.Name = "GIT_REPO"
				env.Value = "https://github.com/docker-library/hello-world.git"
開發者ID:liangchenye,項目名稱:go-hack,代碼行數:30,代碼來源:build_test.go


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