diff --git a/operator/v1alpha1/types_image_content_source_policy.go b/operator/v1alpha1/types_image_content_source_policy.go new file mode 100644 index 00000000000..c82f415504c --- /dev/null +++ b/operator/v1alpha1/types_image_content_source_policy.go @@ -0,0 +1,54 @@ +package v1alpha1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ImageContentSourcePolicy holds cluster-wide information about how to handle registry mirror rules. +// When multple policies are defined, the outcome of the behavior is defined on each field. +type ImageContentSourcePolicy struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + metav1.ObjectMeta `json:"metadata,omitempty"` + + // spec holds user settable values for configuration + // +required + Spec ImageContentSourcePolicySpec `json:"spec"` +} + +// ImageContentSourcePolicySpec is the specification of the ImageContentSourcePolicy CRD. +type ImageContentSourcePolicySpec struct { + // repositoryDigestMirrors allows images referenced by image digests in pods to be + // pulled from alternative mirrored repository locations. The image pull specification + // provided to the pod will be compared to the source locations described in RepositoryDigestMirrors + // and the image may be pulled down from any of the repositories in the list instead of the + // specified repository allowing administrators to choose a potentially faster mirror. + // Only image pull specifications that have an image disgest will have this behavior applied + // to them - tags will continue to be pulled from the specified repository in the pull spec. + // When multiple policies are defined, any overlaps found will be merged together when the mirror + // rules are written to `/etc/containers/registries.conf`. For example, if policy A has sources `a, b, c` + // and policy B has sources `c, d, e`. Then the mirror rule written to `registries.conf` will be `a, b, c, d, e` + // where the duplicate `c` is removed. + // +optional + RepositoryDigestMirrors []RepositoryDigestMirrors `json:"repositoryDigestMirrors"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ImageContentSourcePolicyList lists the items in the ImageContentSourcePolicy CRD. +type ImageContentSourcePolicyList struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + metav1.ListMeta `json:"metadata"` + Items []ImageContentSourcePolicy `json:"items"` +} + +// RepositoryDigestMirrors holds cluster-wide information about how to handle mirros in the registries config. +// Note: the mirrors only work when pulling the images that are reference by their digests. +type RepositoryDigestMirrors struct { + // sources are repositories that are mirrors of each other. + // +optional + Sources []string `json:"sources,omitempty"` +} diff --git a/operator/v1alpha1/zz_generated.deepcopy.go b/operator/v1alpha1/zz_generated.deepcopy.go index 72ae4b3db09..36a17cff8bc 100644 --- a/operator/v1alpha1/zz_generated.deepcopy.go +++ b/operator/v1alpha1/zz_generated.deepcopy.go @@ -85,6 +85,89 @@ func (in *GenericOperatorConfig) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageContentSourcePolicy) DeepCopyInto(out *ImageContentSourcePolicy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageContentSourcePolicy. +func (in *ImageContentSourcePolicy) DeepCopy() *ImageContentSourcePolicy { + if in == nil { + return nil + } + out := new(ImageContentSourcePolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ImageContentSourcePolicy) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageContentSourcePolicyList) DeepCopyInto(out *ImageContentSourcePolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ImageContentSourcePolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageContentSourcePolicyList. +func (in *ImageContentSourcePolicyList) DeepCopy() *ImageContentSourcePolicyList { + if in == nil { + return nil + } + out := new(ImageContentSourcePolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ImageContentSourcePolicyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageContentSourcePolicySpec) DeepCopyInto(out *ImageContentSourcePolicySpec) { + *out = *in + if in.RepositoryDigestMirrors != nil { + in, out := &in.RepositoryDigestMirrors, &out.RepositoryDigestMirrors + *out = make([]RepositoryDigestMirrors, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageContentSourcePolicySpec. +func (in *ImageContentSourcePolicySpec) DeepCopy() *ImageContentSourcePolicySpec { + if in == nil { + return nil + } + out := new(ImageContentSourcePolicySpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LoggingConfig) DeepCopyInto(out *LoggingConfig) { *out = *in @@ -189,6 +272,27 @@ func (in *OperatorStatus) DeepCopy() *OperatorStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RepositoryDigestMirrors) DeepCopyInto(out *RepositoryDigestMirrors) { + *out = *in + if in.Sources != nil { + in, out := &in.Sources, &out.Sources + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryDigestMirrors. +func (in *RepositoryDigestMirrors) DeepCopy() *RepositoryDigestMirrors { + if in == nil { + return nil + } + out := new(RepositoryDigestMirrors) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *StaticPodOperatorStatus) DeepCopyInto(out *StaticPodOperatorStatus) { *out = *in diff --git a/operator/v1alpha1/zz_generated.swagger_doc_generated.go b/operator/v1alpha1/zz_generated.swagger_doc_generated.go index 59a145211eb..fc80a126b8f 100644 --- a/operator/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/operator/v1alpha1/zz_generated.swagger_doc_generated.go @@ -135,4 +135,41 @@ func (VersionAvailability) SwaggerDoc() map[string]string { return map_VersionAvailability } +var map_ImageContentSourcePolicy = map[string]string{ + "": "ImageContentSourcePolicy holds cluster-wide information about how to handle registry mirror rules. When multple policies are defined, the outcome of the behavior is defined on each field.", + "metadata": "Standard object's metadata.", + "spec": "spec holds user settable values for configuration", +} + +func (ImageContentSourcePolicy) SwaggerDoc() map[string]string { + return map_ImageContentSourcePolicy +} + +var map_ImageContentSourcePolicyList = map[string]string{ + "": "ImageContentSourcePolicyList lists the items in the ImageContentSourcePolicy CRD.", + "metadata": "Standard object's metadata.", +} + +func (ImageContentSourcePolicyList) SwaggerDoc() map[string]string { + return map_ImageContentSourcePolicyList +} + +var map_ImageContentSourcePolicySpec = map[string]string{ + "": "ImageContentSourcePolicySpec is the specification of the ImageContentSourcePolicy CRD.", + "repositoryDigestMirrors": "repositoryDigestMirrors allows images referenced by image digests in pods to be pulled from alternative mirrored repository locations. The image pull specification provided to the pod will be compared to the source locations described in RepositoryDigestMirrors and the image may be pulled down from any of the repositories in the list instead of the specified repository allowing administrators to choose a potentially faster mirror. Only image pull specifications that have an image disgest will have this behavior applied to them - tags will continue to be pulled from the specified repository in the pull spec. When multiple policies are defined, any overlaps found will be merged together when the mirror rules are written to `/etc/containers/registries.conf`. For example, if policy A has sources `a, b, c` and policy B has sources `c, d, e`. Then the mirror rule written to `registries.conf` will be `a, b, c, d, e` where the duplicate `c` is removed.", +} + +func (ImageContentSourcePolicySpec) SwaggerDoc() map[string]string { + return map_ImageContentSourcePolicySpec +} + +var map_RepositoryDigestMirrors = map[string]string{ + "": "RepositoryDigestMirrors holds cluster-wide information about how to handle mirros in the registries config. Note: the mirrors only work when pulling the images that are reference by their digests.", + "sources": "sources are repositories that are mirrors of each other.", +} + +func (RepositoryDigestMirrors) SwaggerDoc() map[string]string { + return map_RepositoryDigestMirrors +} + // AUTO-GENERATED FUNCTIONS END HERE