コード例 #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
			}
		}
	}
}