本文整理汇总了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
}
示例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
}
}
}
}
示例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)
}
示例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"