func convert_api_SourceRevision_To_v1beta3_SourceRevision(in *newer.SourceRevision, out *SourceRevision, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } out.Type = BuildSourceGit return nil }
// This will Convert the v1 representation of VolumeSource to our internal representation // Used for keeping backwards compatibility for the Metadata field func Convert_v1beta1_VolumeSource_To_api_VolumeSource(in *v1.VolumeSource, out *api.VolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*v1.VolumeSource))(in) } if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } // if specified Metadata will stomp DownwardAPI if in.Metadata != nil { out.DownwardAPI = new(api.DownwardAPIVolumeSource) if err := Convert_v1_MetadataVolumeSource_To_api_DownwardAPIVolumeSource(in.Metadata, out.DownwardAPI, s); err != nil { return err } } else { if in.DownwardAPI != nil { out.DownwardAPI = new(api.DownwardAPIVolumeSource) if err := Convert_v1_DownwardAPIVolumeSource_To_api_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil { return err } } else { out.DownwardAPI = nil } } return nil }
// This will Convert our internal represantation of VolumeSource to its v1 representation // Used for keeping backwards compatibility for the Metadata field func Convert_api_VolumeSource_To_v1beta1_VolumeSource(in *api.VolumeSource, out *v1.VolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*api.VolumeSource))(in) } if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } if in.DownwardAPI != nil { out.DownwardAPI = new(v1.DownwardAPIVolumeSource) if err := Convert_api_DownwardAPIVolumeSource_To_v1_DownwardAPIVolumeSource(in.DownwardAPI, out.DownwardAPI, s); err != nil { return err } // also copy to Metadata out.Metadata = new(v1.MetadataVolumeSource) if err := Convert_api_DownwardAPIVolumeSource_To_v1_MetadataVolumeSource(in.DownwardAPI, out.Metadata, s); err != nil { return err } } else { out.DownwardAPI = nil } return nil }
func Convert_api_Template_To_v1beta3_Template(in *newer.Template, out *Template, s conversion.Scope) error { //FIXME: DefaultConvert should not overwrite the Labels field on the // the base object. This is likely a bug in the DefaultConvert // code. For now, it is called before converting the labels. if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } if err := s.Convert(&in.ObjectLabels, &out.Labels, 0); err != nil { return err } // if we have runtime.Unstructured objects from the Process call. We need to encode those // objects using the unstructured codec BEFORE the REST layers gets its shot at encoding to avoid a layered // encode being done. for i := range in.Objects { if unstructured, ok := in.Objects[i].(*runtime.Unstructured); ok { bytes, err := runtime.Encode(runtime.UnstructuredJSONScheme, unstructured) if err != nil { return err } out.Objects[i] = runtime.RawExtension{Raw: bytes} } } return nil }
func convert_api_SubjectAccessReview_To_v1beta3_SubjectAccessReview(in *newer.SubjectAccessReview, out *SubjectAccessReview, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } out.GroupsSlice = in.Groups.List() return nil }
func convert_api_ClusterRoleBinding_To_v1_ClusterRoleBinding(in *newer.ClusterRoleBinding, out *ClusterRoleBinding, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil { return err } out.UserNames, out.GroupNames = newer.StringSubjectsFor(in.Namespace, in.Subjects) return nil }
func convert_api_Template_To_v1beta3_Template(in *newer.Template, out *Template, s conversion.Scope) error { //FIXME: DefaultConvert should not overwrite the Labels field on the // the base object. This is likely a bug in the DefaultConvert // code. For now, it is called before converting the labels. if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } return s.Convert(&in.ObjectLabels, &out.Labels, 0) }
func convert_v1beta3_SubjectAccessReview_To_api_SubjectAccessReview(in *SubjectAccessReview, out *newer.SubjectAccessReview, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } out.Groups = util.NewStringSet(in.GroupsSlice...) return nil }
func convert_api_ResourceAccessReviewResponse_To_v1_ResourceAccessReviewResponse(in *newer.ResourceAccessReviewResponse, out *ResourceAccessReviewResponse, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } out.UsersSlice = in.Users.List() out.GroupsSlice = in.Groups.List() return nil }
func convert_api_ClusterRoleBinding_To_v1_ClusterRoleBinding(in *newer.ClusterRoleBinding, out *ClusterRoleBinding, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil { return err } out.UserNames = in.Users.List() out.GroupNames = in.Groups.List() return nil }
func convert_v1_RoleBinding_To_api_RoleBinding(in *RoleBinding, out *newer.RoleBinding, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil { return err } out.Users = util.NewStringSet(in.UserNames...) out.Groups = util.NewStringSet(in.GroupNames...) return nil }
func convert_v1beta3_BuildOutput_To_api_BuildOutput(in *BuildOutput, out *newer.BuildOutput, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } if in.To != nil && (in.To.Kind == "ImageStream" || len(in.To.Kind) == 0) { out.To.Kind = "ImageStreamTag" out.To.Name = imageapi.JoinImageStreamTag(in.To.Name, "") } return nil }
func convert_v1_ResourceAccessReviewResponse_To_api_ResourceAccessReviewResponse(in *ResourceAccessReviewResponse, out *newer.ResourceAccessReviewResponse, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } out.Users = sets.NewString(in.UsersSlice...) out.Groups = sets.NewString(in.GroupsSlice...) return nil }
func convert_api_LocalResourceAccessReview_To_v1_LocalResourceAccessReview(in *newer.LocalResourceAccessReview, out *LocalResourceAccessReview, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } if err := s.DefaultConvert(&in.Action, &out.AuthorizationAttributes, conversion.IgnoreMissingFields); err != nil { return err } return nil }
func convert_v1beta3_CustomBuildStrategy_To_api_CustomBuildStrategy(in *CustomBuildStrategy, out *newer.CustomBuildStrategy, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } switch in.From.Kind { case "ImageStream": out.From.Kind = "ImageStreamTag" out.From.Name = imageapi.JoinImageStreamTag(in.From.Name, "") } return nil }
func convert_api_Route_To_v1_Route(in *newer.Route, out *Route, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } out.Spec.Path = in.Path out.Spec.Host = in.Host out.Spec.To.Kind = "Service" out.Spec.To.Name = in.ServiceName return s.Convert(&in.TLS, &out.Spec.TLS, 0) }
func convert_v1beta3_Route_To_api_Route(in *Route, out *newer.Route, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } out.Path = in.Spec.Path out.Host = in.Spec.Host if in.Spec.To.Kind == "Service" || len(in.Spec.To.Kind) == 0 { out.ServiceName = in.Spec.To.Name } return s.Convert(&in.Spec.TLS, &out.TLS, 0) }
func convert_api_LocalSubjectAccessReview_To_v1_LocalSubjectAccessReview(in *newer.LocalSubjectAccessReview, out *LocalSubjectAccessReview, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } if err := s.DefaultConvert(&in.Action, &out.AuthorizationAttributes, conversion.IgnoreMissingFields); err != nil { return err } out.GroupsSlice = in.Groups.List() return nil }
func convert_v1_SubjectAccessReview_To_api_SubjectAccessReview(in *SubjectAccessReview, out *newer.SubjectAccessReview, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } if err := s.DefaultConvert(&in.AuthorizationAttributes, &out.Action, conversion.IgnoreMissingFields); err != nil { return err } out.Groups = sets.NewString(in.GroupsSlice...) return nil }
func Convert_api_BuildTriggerPolicy_To_v1beta3_BuildTriggerPolicy(in *newer.BuildTriggerPolicy, out *BuildTriggerPolicy, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } switch in.Type { case newer.ImageChangeBuildTriggerType: out.Type = ImageChangeBuildTriggerType case newer.GenericWebHookBuildTriggerType: out.Type = GenericWebHookBuildTriggerType case newer.GitHubWebHookBuildTriggerType: out.Type = GitHubWebHookBuildTriggerType } return nil }
func convert_api_BuildStrategy_To_v1beta3_BuildStrategy(in *newer.BuildStrategy, out *BuildStrategy, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } switch { case in.SourceStrategy != nil: out.Type = SourceBuildStrategyType case in.DockerStrategy != nil: out.Type = DockerBuildStrategyType case in.CustomStrategy != nil: out.Type = CustomBuildStrategyType } return nil }
func convert_v1beta3_BuildTriggerPolicy_To_api_BuildTriggerPolicy(in *BuildTriggerPolicy, out *newer.BuildTriggerPolicy, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.DestFromSource); err != nil { return err } switch in.Type { case ImageChangeBuildTriggerType: out.Type = newer.ImageChangeBuildTriggerType case GenericWebHookBuildTriggerType: out.Type = newer.GenericWebHookBuildTriggerType case GitHubWebHookBuildTriggerType: out.Type = newer.GitHubWebHookBuildTriggerType } return nil }
func convert_v1_ClusterRoleBinding_To_api_ClusterRoleBinding(in *ClusterRoleBinding, out *newer.ClusterRoleBinding, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields|conversion.AllowDifferentFieldTypeNames); err != nil { return err } // if the users and groups fields are cleared, then respect only subjects. The field was set in the DefaultConvert above if in.UserNames == nil && in.GroupNames == nil { return nil } out.Subjects = newer.BuildSubjects(in.UserNames, in.GroupNames, uservalidation.ValidateUserName, uservalidation.ValidateGroupName) return nil }
func convert_api_DeploymentConfig_To_v1_DeploymentConfig(in *newer.DeploymentConfig, out *DeploymentConfig, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } if err := s.Convert(&in.Template, &out.Spec, 0); err != nil { return err } if err := s.Convert(&in.Triggers, &out.Spec.Triggers, 0); err != nil { return err } out.Status.LatestVersion = in.LatestVersion if err := s.Convert(&in.Details, &out.Status.Details, 0); err != nil { return err } return nil }
func Convert_api_DeploymentTriggerImageChangeParams_To_v1beta3_DeploymentTriggerImageChangeParams(in *newer.DeploymentTriggerImageChangeParams, out *DeploymentTriggerImageChangeParams, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } switch in.From.Kind { case "ImageStreamTag": case "ImageStream", "ImageRepository": out.From.Kind = "ImageStreamTag" if !strings.Contains(out.From.Name, ":") { out.From.Name = imageapi.JoinImageStreamTag(out.From.Name, imageapi.DefaultImageTag) } default: // Will be handled by validation } return nil }
// This will convert the v1 representation of VolumeSource to our internal representation // Used for keeping backwards compatibility for the Metadata field func convert_v1_VolumeSource_To_api_VolumeSource(in *VolumeSource, out *api.VolumeSource, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*VolumeSource))(in) } if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } if in.Metadata != nil { out.DownwardAPI = new(api.DownwardAPIVolumeSource) if err := convert_v1_MetadataVolumeSource_To_api_DownwardAPIVolumeSource(in.Metadata, out.DownwardAPI, s); err != nil { return err } } return nil }
func convert_api_BuildSource_To_v1beta3_BuildSource(in *newer.BuildSource, out *BuildSource, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } switch { // it is legal for a buildsource to have both a git+dockerfile source, but in v1 that was represented // as type git. case in.Git != nil: out.Type = BuildSourceGit // it is legal for a buildsource to have both a binary+dockerfile source, but in v1 that was represented // as type binary. case in.Binary != nil: out.Type = BuildSourceBinary case in.Dockerfile != nil: out.Type = BuildSourceDockerfile } return nil }
func Convert_v1_DeploymentTriggerImageChangeParams_To_api_DeploymentTriggerImageChangeParams(in *DeploymentTriggerImageChangeParams, out *newer.DeploymentTriggerImageChangeParams, s conversion.Scope) error { if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found { defaulting.(func(*DeploymentTriggerImageChangeParams))(in) } if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } switch in.From.Kind { case "ImageStreamTag": case "ImageStream", "ImageRepository": out.From.Kind = "ImageStreamTag" if !strings.Contains(out.From.Name, ":") { out.From.Name = imageapi.JoinImageStreamTag(out.From.Name, imageapi.DefaultImageTag) } default: // Will be handled by validation } return nil }
func convert_v1_BuildConfig_To_api_BuildConfig(in *BuildConfig, out *newer.BuildConfig, s conversion.Scope) error { if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil { return err } newTriggers := []newer.BuildTriggerPolicy{} // strip off any default imagechange triggers where the buildconfig's // "from" is not an ImageStreamTag, because those triggers // will never be invoked. imageRef := buildutil.GetImageStreamForStrategy(out.Spec.Strategy) hasIST := imageRef != nil && imageRef.Kind == "ImageStreamTag" for _, trigger := range out.Spec.Triggers { if trigger.Type != newer.ImageChangeBuildTriggerType { newTriggers = append(newTriggers, trigger) continue } if (trigger.ImageChange == nil || trigger.ImageChange.From == nil) && !hasIST { continue } newTriggers = append(newTriggers, trigger) } out.Spec.Triggers = newTriggers return nil }
func convert_v1beta3_Template_To_api_Template(in *Template, out *newer.Template, s conversion.Scope) error { if err := s.Convert(&in.Labels, &out.ObjectLabels, 0); err != nil { return err } return s.DefaultConvert(in, out, conversion.IgnoreMissingFields) }