projectcontour / contour-operator

Experimental repository to explore an operator for deploying Contour
Apache License 2.0
43 stars 34 forks source link

Contour Controller Should Get GatewayClass Before Syncing GatewayClass Status. #218

Open danehans opened 3 years ago

danehans commented 3 years ago

Please describe the problem you have The Contour controller is hitting the following error because the gatewayclass is getting mutated during reconciliation. The controller should get the latest gatewayclass from the api server before syncing.

2021-02-23T16:19:57.878-0800    INFO    contour_controller  reconciling {"request": "contour-operator/contour-gateway-sample"}
2021-02-23T16:19:57.906-0800    INFO    contour_controller  finalized contour   {"namespace": "contour-operator", "name": "contour-gateway-sample"}
2021-02-23T16:19:57.906-0800    INFO    contour_controller  reconciling {"request": "contour-operator/contour-gateway-sample"}
2021-02-23T16:19:57.913-0800    INFO    gatewayclass_controller reconciling {"request": "/sample-gatewayclass"}
2021-02-23T16:19:57.916-0800    INFO    contour_controller  contour finalized   {"namespace": "contour-operator", "name": "contour-gateway-sample"}
2021-02-23T16:19:57.971-0800    INFO    gateway_controller  reconciling {"request": "projectcontour/contour"}
2021-02-23T16:19:57.972-0800    INFO    gatewayclass_controller synced status for gatewayclass  {"name": "sample-gatewayclass"}
2021-02-23T16:19:58.012-0800    INFO    gateway_controller  added finalizer to gateway  {"namespace": "projectcontour", "name": "contour"}
2021-02-23T16:19:58.012-0800    INFO    gateway_controller  reconciling {"request": "projectcontour/contour"}
2021-02-23T16:19:58.046-0800    INFO    contour_controller  synced status for contour   {"namespace": "contour-operator", "name": "contour-gateway-sample"}
2021-02-23T16:19:58.047-0800    ERROR   controller-runtime.manager.controller.contour_controller    Reconciler error    {"name": "contour-gateway-sample", "namespace": "contour-operator", "error": "failed to sync status for gatewayclass sample-gatewayclass: failed to update gatewayclass sample-gatewayclass status: Operation cannot be fulfilled on gatewayclasses.networking.x-k8s.io \"sample-gatewayclass\": the object has been modified; please apply your changes to the latest version and try again", "errorCauses": [{"error": "failed to sync status for gatewayclass sample-gatewayclass: failed to update gatewayclass sample-gatewayclass status: Operation cannot be fulfilled on gatewayclasses.networking.x-k8s.io \"sample-gatewayclass\": the object has been modified; please apply your changes to the latest version and try again"}]}
github.com/go-logr/zapr.(*zapLogger).Error
    /Users/daneyonhansen/code/go/src/github.com/projectcontour/contour-operator/vendor/github.com/go-logr/zapr/zapr.go:132
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
    /Users/daneyonhansen/code/go/src/github.com/projectcontour/contour-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:297
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
    /Users/daneyonhansen/code/go/src/github.com/projectcontour/contour-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:248
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.1
    /Users/daneyonhansen/code/go/src/github.com/projectcontour/contour-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:211
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1
    /Users/daneyonhansen/code/go/src/github.com/projectcontour/contour-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:185
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1
    /Users/daneyonhansen/code/go/src/github.com/projectcontour/contour-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:155
k8s.io/apimachinery/pkg/util/wait.BackoffUntil
    /Users/daneyonhansen/code/go/src/github.com/projectcontour/contour-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:156
k8s.io/apimachinery/pkg/util/wait.JitterUntil
    /Users/daneyonhansen/code/go/src/github.com/projectcontour/contour-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133
k8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext
    /Users/daneyonhansen/code/go/src/github.com/projectcontour/contour-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:185
k8s.io/apimachinery/pkg/util/wait.UntilWithContext
    /Users/daneyonhansen/code/go/src/github.com/projectcontour/contour-operator/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:99
danehans commented 3 years ago

Removing milestone until the community achieves a consensus on the Gateway API implementation plan.