Esempio n. 1
0
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
}
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
			}
		}
	}
}
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
}
Esempio n. 4
0
func addOriginVersionVar(output *[]kapi.EnvVar) {
	version := kapi.EnvVar{Name: buildapi.OriginVersion, Value: version.Get().String()}
	*output = append(*output, version)
}
Esempio n. 5
0
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 = "*****@*****.**"
				envs = append(envs, env)

				env.Name = "GIT_REPO"
				env.Value = "https://github.com/docker-library/hello-world.git"