Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions api/v1/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import (
// Store is the Schema for the stores API
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Storefront",type=string,JSONPath=".status.storefrontState.ready"
// +kubebuilder:printcolumn:name="Worker",type=string,JSONPath=".status.workerState.ready"
// +kubebuilder:printcolumn:name="Admin",type=string,JSONPath=".status.adminState.ready"
// +kubebuilder:printcolumn:name="State",type=string,JSONPath=".status.state"
// +kubebuilder:printcolumn:name="Message",type=string,JSONPath=".status.message"
// +kubebuilder:resource:scope=Namespaced
Expand Down
200 changes: 0 additions & 200 deletions internal/controller/predicate.go

This file was deleted.

7 changes: 1 addition & 6 deletions internal/controller/store_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ type StoreReconciler struct {

// SetupWithManager sets up the controller with the Manager.
func (r *StoreReconciler) SetupWithManager(mgr ctrl.Manager, logger *zap.SugaredLogger) error {
skipStatusUpdates, err := NewSkipStatusUpdates(logger, &appsv1.Deployment{})
if err != nil {
return err
}
return ctrl.NewControllerManagedBy(mgr).
For(&v1.Store{}).
// We get triggerd by every update on the created resources, this leeads to high reconciles at the start.
Expand All @@ -74,8 +70,7 @@ func (r *StoreReconciler) SetupWithManager(mgr ctrl.Manager, logger *zap.Sugared
Owns(&appsv1.Deployment{}).
Owns(&batchv1.Job{}).
Owns(&batchv1.CronJob{}).
// Skip status updates of all resources
WithEventFilter(skipStatusUpdates).
WithEventFilter(predicate.GenerationChangedPredicate{}).
// This will watch the db secret and run a reconcile if the db secret will change.
Watches(
&corev1.Secret{},
Expand Down
9 changes: 2 additions & 7 deletions internal/controller/storesnapshot_create_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"k8s.io/apimachinery/pkg/types"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/predicate"

v1 "github.com/shopware/shopware-operator/api/v1"
)
Expand All @@ -35,17 +36,11 @@ type StoreSnapshotCreateReconciler struct {
StoreSnapshotBaseReconciler
}

// TODO: Filter if the state is failed or succeeded, because then we don't reconcile finished snapshots
// SetupWithManager sets up the controller with the Manager.
func (r *StoreSnapshotCreateReconciler) SetupWithManager(mgr ctrl.Manager) error {
skipStatusUpdates, err := NewSkipStatusUpdates(r.Logger)
if err != nil {
return err
}
return ctrl.NewControllerManagedBy(mgr).
For(&v1.StoreSnapshotCreate{}).
Owns(&batchv1.Job{}).
WithEventFilter(skipStatusUpdates).
WithEventFilter(predicate.GenerationChangedPredicate{}).
Complete(r)
}

Expand Down
7 changes: 2 additions & 5 deletions internal/controller/storesnapshot_restore_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"k8s.io/apimachinery/pkg/types"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/predicate"

v1 "github.com/shopware/shopware-operator/api/v1"
)
Expand All @@ -36,14 +37,10 @@ type StoreSnapshotRestoreReconciler struct {

// SetupWithManager sets up the controller with the Manager.
func (r *StoreSnapshotRestoreReconciler) SetupWithManager(mgr ctrl.Manager) error {
skipStatusUpdates, err := NewSkipStatusUpdates(r.Logger)
if err != nil {
return err
}
return ctrl.NewControllerManagedBy(mgr).
For(&v1.StoreSnapshotRestore{}).
Owns(&batchv1.Job{}).
WithEventFilter(skipStatusUpdates).
WithEventFilter(predicate.GenerationChangedPredicate{}).
Complete(r)
}

Expand Down