Skip to content

Commit

Permalink
update App references to PackageRepo
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhelfand authored and ewrenn8 committed Jun 11, 2021
1 parent 20a12c4 commit 64180e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions cmd/controller/pkg_repository_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ func (r *PkgRepositoryReconciler) Reconcile(ctx context.Context, request reconci
existingPkgRepository, err := r.client.PackagingV1alpha1().PackageRepositories(request.Namespace).Get(ctx, request.Name, metav1.GetOptions{})
if err != nil {
if errors.IsNotFound(err) {
log.Info("Could not find PkgRepository", "name", request.Name)
log.Info("Could not find PackageRepository", "name", request.Name)
return reconcile.Result{}, nil // No requeue
}

log.Error(err, "Could not fetch PkgRepository")
log.Error(err, "Could not fetch PackageRepository")
return reconcile.Result{}, err
}

Expand All @@ -52,7 +52,7 @@ func (r *PkgRepositoryReconciler) Reconcile(ctx context.Context, request reconci
}

crdApp := r.appFactory.NewCRDPackageRepo(app, existingPkgRepository, log)
r.UpdateAppRefs(crdApp.ResourceRefs(), app)
r.UpdatePackageRepoRefs(crdApp.ResourceRefs(), app)

force := false
pkgrKey := reftracker.NewPackageRepositoryKey(app.Name, app.Namespace)
Expand All @@ -64,16 +64,16 @@ func (r *PkgRepositoryReconciler) Reconcile(ctx context.Context, request reconci
return crdApp.Reconcile(force)
}

func (r *PkgRepositoryReconciler) UpdateAppRefs(refKeys map[reftracker.RefKey]struct{}, app *v1alpha1.App) {
func (r *PkgRepositoryReconciler) UpdatePackageRepoRefs(refKeys map[reftracker.RefKey]struct{}, app *v1alpha1.App) {
pkgRepoKey := reftracker.NewPackageRepositoryKey(app.Name, app.Namespace)
// If App is being deleted, remove the App
// If PackageRepo is being deleted, remove
// from all its associated references.
if app.DeletionTimestamp != nil {
r.appRefTracker.RemoveAppFromAllRefs(pkgRepoKey)
return
}

// Add new refs for App to AppRefTracker/remove
// any formerly but now unused refs for App.
// Add new refs for PackageRepo to AppRefTracker/remove
// any formerly but now unused refs for PackageRepo.
r.appRefTracker.ReconcileRefs(refKeys, pkgRepoKey)
}
2 changes: 1 addition & 1 deletion config/crds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ spec:
description: Paused when set to true will ignore all pending changes, once it set back to false, pending changes will be applied
type: boolean
syncPeriod:
description: Controls frequency of app reconciliation
description: Controls frequency of PackageRepository reconciliation
type: string
required:
- fetch
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/packaging/v1alpha1/package_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type PackageRepositorySpec struct {
// once it set back to false, pending changes will be applied
// +optional
Paused bool `json:"paused,omitempty"`
// Controls frequency of app reconciliation
// Controls frequency of PackageRepository reconciliation
// +optional
SyncPeriod *metav1.Duration `json:"syncPeriod,omitempty"`

Expand Down

0 comments on commit 64180e4

Please sign in to comment.