Add source kind and name to not found error
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
parent
736867d359
commit
e99f328200
|
@ -16,6 +16,8 @@ limitations under the License.
|
|||
|
||||
package v1beta1
|
||||
|
||||
import "fmt"
|
||||
|
||||
// CrossNamespaceSourceReference contains enough information to let you locate the
|
||||
// typed referenced object at cluster level
|
||||
type CrossNamespaceSourceReference struct {
|
||||
|
@ -36,3 +38,10 @@ type CrossNamespaceSourceReference struct {
|
|||
// +optional
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
func (s *CrossNamespaceSourceReference) String() string {
|
||||
if s.Namespace != "" {
|
||||
return fmt.Sprintf("%s/%s/%s", s.Kind, s.Namespace, s.Name)
|
||||
}
|
||||
return fmt.Sprintf("%s/%s", s.Kind, s.Name)
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ func (r *KustomizationReconciler) Reconcile(ctx context.Context, req ctrl.Reques
|
|||
source, err := r.getSource(ctx, kustomization)
|
||||
if err != nil {
|
||||
if apierrors.IsNotFound(err) {
|
||||
msg := "Source not found"
|
||||
msg := fmt.Sprintf("Source '%s' not found", kustomization.Spec.SourceRef.String())
|
||||
kustomization = kustomizev1.KustomizationNotReady(kustomization, "", kustomizev1.ArtifactFailedReason, msg)
|
||||
if err := r.patchStatus(ctx, req, kustomization.Status); err != nil {
|
||||
log.Error(err, "unable to update status for source not found")
|
||||
|
|
Loading…
Reference in New Issue