You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Best practices for updating a CRD's metadata #1127
Triggering a generation bump becomes inherently expensive for certain CRDs. For a Configuration this will trigger a new revision and it's subsequent pods, services etc. to be created.
Whether a generation bump occurs will depend on the CRD definition.
Few approaches to resolve this
(maybe not possible) update the CRD definitions to make sure marshalling always produces the same output. ie. When creating a CRD via kubectl, if a user omits a field in the spec of a CRD, when a controller marshals that CRD it should also omit that field. We shouldn't see null or empty fields from the controller
(easiest) use the clientset's Patch call to only update the label
Related:
Best practices for updating [CRD] status (#1107)
Best practices for updating a CRD's spec (#1128)
Triggering a generation bump becomes inherently expensive for certain CRDs. For a Configuration this will trigger a new revision and it's subsequent pods, services etc. to be created.
How do we avoid this today? Is the webhook only called for edits to spec?
Today the configuration controller uses Spec.Generation to detect when a configuration has changed, ignoring Metadata.Generation. The webhook only updates Spec.Generation when Spec has changed:
@dprotaso is the only place that we do this today the Route controller's labelling of Configurations? (note: this previously included Revisions, but @mdemirhan removed it).
To repeat my earlier question can we tackle this even before we transition to 1.11?
Activity
mattmoor commentedon Jun 11, 2018
@dprotaso @bsnchan We need this when 1.11 lands, but we could adopt this now, correct?
mattmoor commentedon Jun 11, 2018
How do we avoid this today? Is the webhook only called for edits to spec?
grantr commentedon Jun 11, 2018
Today the configuration controller uses
Spec.Generationto detect when a configuration has changed, ignoringMetadata.Generation. The webhook only updatesSpec.GenerationwhenSpechas changed:serving/pkg/webhook/webhook.go
Line 540 in e1b3aae
mattmoor commentedon Jul 8, 2018
@dprotaso is the only place that we do this today the Route controller's labelling of Configurations? (note: this previously included Revisions, but @mdemirhan removed it).
To repeat my earlier question can we tackle this even before we transition to 1.11?
dprotaso commentedon Jul 11, 2018
Yup - just the route controller sets labels
Yes - I think we can use the config's clientset's
Patch. I'll take it on/assign @dprotaso
Use PATCH in order to update a Configuration's Route Label
Use PATCH when updating a Configuration's Route label
Use PATCH when updating a Configuration's Route label
Use PATCH when updating a Configuration's Route label
Use PATCH when updating a Configuration's Route label (#1704)
Use PATCH when updating a Configuration's Route label (knative#1704)
Use PATCH when updating a Configuration's Route label (knative#1704)