Rename ImageRepository -> ImageRepositoryRef

.. to follow gitops-toolkit convention.
This commit is contained in:
Michael Bridgen 2020-08-05 19:54:11 +01:00
parent 639007c659
commit 7ab3632b1b
5 changed files with 11 additions and 11 deletions

View File

@ -24,10 +24,10 @@ import (
// ImagePolicySpec defines the parameters for calculating the // ImagePolicySpec defines the parameters for calculating the
// ImagePolicy // ImagePolicy
type ImagePolicySpec struct { type ImagePolicySpec struct {
// ImageRepository points at the object specifying the image being // ImageRepositoryRef points at the object specifying the image
// scanned // being scanned
// +required // +required
ImageRepository corev1.LocalObjectReference `json:"imageRepository"` ImageRepositoryRef corev1.LocalObjectReference `json:"imageRepositoryRef"`
// Policy gives the particulars of the policy to be followed in // Policy gives the particulars of the policy to be followed in
// selecting the most recent image // selecting the most recent image
// +required // +required

View File

@ -107,7 +107,7 @@ func (in *ImagePolicyList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImagePolicySpec) DeepCopyInto(out *ImagePolicySpec) { func (in *ImagePolicySpec) DeepCopyInto(out *ImagePolicySpec) {
*out = *in *out = *in
out.ImageRepository = in.ImageRepository out.ImageRepositoryRef = in.ImageRepositoryRef
in.Policy.DeepCopyInto(&out.Policy) in.Policy.DeepCopyInto(&out.Policy)
} }

View File

@ -41,9 +41,9 @@ spec:
description: ImagePolicySpec defines the parameters for calculating the description: ImagePolicySpec defines the parameters for calculating the
ImagePolicy ImagePolicy
properties: properties:
imageRepository: imageRepositoryRef:
description: ImageRepository points at the object specifying the image description: ImageRepositoryRef points at the object specifying the
being scanned image being scanned
properties: properties:
name: name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
@ -68,7 +68,7 @@ spec:
type: object type: object
type: object type: object
required: required:
- imageRepository - imageRepositoryRef
- policy - policy
type: object type: object
status: status:

View File

@ -65,7 +65,7 @@ func (r *ImagePolicyReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)
var repo imagev1alpha1.ImageRepository var repo imagev1alpha1.ImageRepository
if err := r.Get(ctx, types.NamespacedName{ if err := r.Get(ctx, types.NamespacedName{
Namespace: pol.Namespace, Namespace: pol.Namespace,
Name: pol.Spec.ImageRepository.Name, Name: pol.Spec.ImageRepositoryRef.Name,
}, &repo); err != nil { }, &repo); err != nil {
if client.IgnoreNotFound(err) == nil { if client.IgnoreNotFound(err) == nil {
log.Error(err, "referenced ImageRepository does not exist") log.Error(err, "referenced ImageRepository does not exist")
@ -105,7 +105,7 @@ func (r *ImagePolicyReconciler) SetupWithManager(mgr ctrl.Manager) error {
// it's easy to list those out when an image repo changes. // it's easy to list those out when an image repo changes.
if err := mgr.GetFieldIndexer().IndexField(&imagev1alpha1.ImagePolicy{}, imageRepoKey, func(obj runtime.Object) []string { if err := mgr.GetFieldIndexer().IndexField(&imagev1alpha1.ImagePolicy{}, imageRepoKey, func(obj runtime.Object) []string {
pol := obj.(*imagev1alpha1.ImagePolicy) pol := obj.(*imagev1alpha1.ImagePolicy)
return []string{pol.Spec.ImageRepository.Name} return []string{pol.Spec.ImageRepositoryRef.Name}
}); err != nil { }); err != nil {
return err return err
} }

View File

@ -69,7 +69,7 @@ var _ = Describe("ImagePolicy controller", func() {
} }
pol := imagev1alpha1.ImagePolicy{ pol := imagev1alpha1.ImagePolicy{
Spec: imagev1alpha1.ImagePolicySpec{ Spec: imagev1alpha1.ImagePolicySpec{
ImageRepository: corev1.LocalObjectReference{ ImageRepositoryRef: corev1.LocalObjectReference{
Name: imageObjectName.Name, Name: imageObjectName.Name,
}, },
Policy: imagev1alpha1.ImagePolicyChoice{ Policy: imagev1alpha1.ImagePolicyChoice{