Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConstraintTemplate CRD Metadata.Generation and Observed Generation Constantly Incrementing #467

Closed
RyPeck opened this issue Feb 10, 2020 · 8 comments

Comments

@RyPeck
Copy link
Contributor

RyPeck commented Feb 10, 2020

Running gatekeeper:v3.1.0-beta.6 when creating any ConstraintTemplate I immediately see the Metadata.Generation and Status.By Pod.Observed Generation value constantly increment. Observed Generation is always Metadata.Generation-1.

Logs related to this -

2020-02-10T15:07:17.470Z	INFO	controller	making sure constraint is in watcher registry	{"kind": "ConstraintTemplate", "process": "constraint_template_controller", "name": "k8sallowedrepos", "crdName": "k8sallowedrepos.constraints.gatekeeper.sh"}
2020-02-10T15:07:17.471Z	INFO	controller	difference in spec found, updating	{"kind": "ConstraintTemplate", "process": "constraint_template_controller", "name": "k8sallowedrepos", "crdName": "k8sallowedrepos.constraints.gatekeeper.sh"}
2020-02-10T15:07:17.485Z	INFO	controller	template was updated	{"kind": "ConstraintTemplate", "process": "constraint_template_controller", "event_type": "template_updated", "template_name": "k8sallowedrepos"}
2020-02-10T15:07:17.485Z	DEBUG	controller-runtime.controller	Successfully Reconciled	{"controller": "constrainttemplate-controller", "request": "/k8sallowedrepos"}
2020-02-10T15:07:17.502Z	INFO	controller	loading constraint code into OPA	{"kind": "ConstraintTemplate", "process": "constraint_template_controller", "name": "k8sallowedrepos", "crdName": "k8sallowedrepos.constraints.gatekeeper.sh"}
2020-02-10T15:07:17.502Z	INFO	controller	making sure constraint is in watcher registry	{"kind": "ConstraintTemplate", "process": "constraint_template_controller", "name": "k8sallowedrepos", "crdName": "k8sallowedrepos.constraints.gatekeeper.sh"}
2020-02-10T15:07:17.503Z	INFO	controller	difference in spec found, updating	{"kind": "ConstraintTemplate", "process": "constraint_template_controller", "name": "k8sallowedrepos", "crdName": "k8sallowedrepos.constraints.gatekeeper.sh"}
2020-02-10T15:07:17.513Z	ERROR	controller	update error	{"kind": "ConstraintTemplate", "process": "constraint_template_controller", "name": "k8sallowedrepos", "crdName": "k8sallowedrepos.constraints.gatekeeper.sh", "error": "Operation cannot be fulfilled on constrainttemplates.templates.gatekeeper.sh \"k8sallowedrepos\": the object has been modified; please apply your changes to the latest version and try again"}
github.com/go-logr/zapr.(*zapLogger).Error
	/go/src/github.com/open-policy-agent/gatekeeper/vendor/github.com/go-logr/zapr/zapr.go:128
github.com/open-policy-agent/gatekeeper/pkg/controller/constrainttemplate.(*ReconcileConstraintTemplate).handleUpdate
	/go/src/github.com/open-policy-agent/gatekeeper/pkg/controller/constrainttemplate/constrainttemplate_controller.go:368
github.com/open-policy-agent/gatekeeper/pkg/controller/constrainttemplate.(*ReconcileConstraintTemplate).Reconcile
	/go/src/github.com/open-policy-agent/gatekeeper/pkg/controller/constrainttemplate/constrainttemplate_controller.go:221
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/go/src/github.com/open-policy-agent/gatekeeper/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:256
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/go/src/github.com/open-policy-agent/gatekeeper/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:232
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker
	/go/src/github.com/open-policy-agent/gatekeeper/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:211
k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1
	/go/src/github.com/open-policy-agent/gatekeeper/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:152
k8s.io/apimachinery/pkg/util/wait.JitterUntil
	/go/src/github.com/open-policy-agent/gatekeeper/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:153
k8s.io/apimachinery/pkg/util/wait.Until
	/go/src/github.com/open-policy-agent/gatekeeper/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88
2020-02-10T15:07:17.523Z	INFO	controller	loading constraint code into OPA	{"kind": "ConstraintTemplate", "process": "constraint_template_controller", "name": "k8sallowedrepos", "crdName": "k8sallowedrepos.constraints.gatekeeper.sh"}
2020-02-10T15:07:17.523Z	INFO	controller	making sure constraint is in watcher registry	{"kind": "ConstraintTemplate", "process": "constraint_template_controller", "name": "k8sallowedrepos", "crdName": "k8sallowedrepos.constraints.gatekeeper.sh"}
2020-02-10T15:07:17.524Z	INFO	controller	difference in spec found, updating	{"kind": "ConstraintTemplate", "process": "constraint_template_controller", "name": "k8sallowedrepos", "crdName": "k8sallowedrepos.constraints.gatekeeper.sh"}
2020-02-10T15:07:17.541Z	INFO	controller	template was updated	{"kind": "ConstraintTemplate", "process": "constraint_template_controller", "event_type": "template_updated", "template_name": "k8sallowedrepos"}
2020-02-10T15:07:17.541Z	DEBUG	controller-runtime.controller	Successfully Reconciled	{"controller": "constrainttemplate-controller", "request": "/k8sallowedrepos"}
@ritazh
Copy link
Member

ritazh commented Feb 10, 2020

This should be addressed in #455

@RyPeck
Copy link
Contributor Author

RyPeck commented Feb 10, 2020

@ritazh I did a build off of the branch for #455 and created a new Constraint Template. I am still seeing the Generation integer incrementing constantly and the same error message.

@ekitson
Copy link

ekitson commented Feb 10, 2020

This should actually be addressed by #458 (although #455 is also important).

@RyPeck
Copy link
Contributor Author

RyPeck commented Feb 10, 2020

@ekitson using code from #458 fixed the constant incrementing.

@ritazh
Copy link
Member

ritazh commented Feb 10, 2020

awesome thank you for confirming! sorry I got my numbers mixed up.

@ritazh
Copy link
Member

ritazh commented Feb 11, 2020

Closed via #458

@ritazh ritazh closed this as completed Feb 11, 2020
@RyPeck
Copy link
Contributor Author

RyPeck commented Feb 11, 2020

I would argue fixing this issue is worth a new beta release - .6 is not something I want to run given the constant logging.

@ritazh
Copy link
Member

ritazh commented Feb 12, 2020

v3.1.0-beta.7 is out now! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants