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

metadata.observedGeneration behaves differently across CRDs #4937

Closed
dgerd opened this issue Jul 25, 2019 · 8 comments
Closed

metadata.observedGeneration behaves differently across CRDs #4937

dgerd opened this issue Jul 25, 2019 · 8 comments
Assignees
Labels
area/API API objects and controllers kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@dgerd
Copy link

dgerd commented Jul 25, 2019

In what area(s)?

/area API

/area autoscale
/area build
/area monitoring
/area networking
/area test-and-release

What version of Knative?

0.2.x
0.3.x
Output of git describe --dirty

0.7

Expected Behavior

From Kubernetes Guidance,

If the primary resource your controller is reconciling supports ObservedGeneration in its status, make sure you correctly set it to metadata.Generation whenever the values between the two fields mismatches.

This lets clients know that the controller has processed a resource. Make sure that your controller is the main controller that is responsible for that resource, otherwise if you need to communicate observation via your own controller, you will need to create a different kind of ObservedGeneration in the Status of the resource.

I expect observedGeneration to always be bumped when a controller picks up a new spec to reconcile regardless of what happens later in the reconcile loop.

Actual Behavior

Many of our controllers wait until the end before bumping observedGeneration or bump it only in certain situations. This can lead to:

  1. Our status changes, but our observedGeneration does not increment
  2. Our status doesn't change due to an error processing and our observedGeneration doesn't increment

In the first case the client will believe that we are still reflecting the status of the previous spec which is false. While in the second case the client will sit there waiting (potentially forever) depending on the type of error ( #4561 fixed one particular example of this case )

Given the coupling between client's (including the Service controller) use of observedGeneration and Conditions, this may likely require changes to either how we report reconcile errors (some of them are not reported in sub-conditions) or how we consume observedGeneration.

Steps to Reproduce the Problem

An example of this:

  1. Put in a bad domainTemplate in the ConfigMap
  2. Update the Route with a new spec
    • As observedGeneration is not updating it looks like the controller is not running, but really it is spinning attempting to retry

We have similar areas in Configuration reconciler where an err can occur before ObservedGeneration is updated resulting in spinning without update.

https://github.com/knative/serving/blob/master/pkg/reconciler/configuration/configuration.go#L129

@dgerd dgerd added the kind/bug Categorizes issue or PR as related to a bug. label Jul 25, 2019
@knative-prow-robot knative-prow-robot added the area/API API objects and controllers label Jul 25, 2019
@dgerd
Copy link
Author

dgerd commented Jul 25, 2019

/assign

@dgerd
Copy link
Author

dgerd commented Oct 23, 2019

@dgerd to scope this down further this release. Most likely work will and in 0.11.

dgerd pushed a commit to dgerd/serving that referenced this issue Dec 5, 2019
Move observedGeneration bump to the top of reconcile()

Fixes knative#4937
@dgerd dgerd removed their assignment Feb 24, 2020
@dgerd dgerd modified the milestones: Serving 0.13.x, Serving 0.14.x Feb 24, 2020
@dgerd
Copy link
Author

dgerd commented Feb 24, 2020

This has tumbled through the milestones and I have not been able to get to it so unassigning.

@vagababov
Copy link
Contributor

/cc @whaught
Weston, is this something you're doing now with gen reconciler?

@whaught
Copy link
Contributor

whaught commented May 19, 2020

/assign

@whaught
Copy link
Contributor

whaught commented May 19, 2020

Yes this is an issue I am aiming to solve.

The precursor is in /pkg with knative/pkg#1226

fmount added a commit to fmount/designate-operator that referenced this issue Apr 9, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/octavia-operator that referenced this issue Apr 9, 2024
This patch does a few things:

1. it adds observedGeneration to the sub custom resources

2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)

3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)

4. before marking the DeploymentReadyCondition as True, the ObservedGeneration
   is compared with the Generation of the Deployment/DaemonSets

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 10, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 10, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 15, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 16, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/designate-operator that referenced this issue Apr 16, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/designate-operator that referenced this issue Apr 16, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 16, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 16, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 16, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 16, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 17, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 17, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s) and, if it's the
   last version, mirrors the subConditions.
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 17, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 17, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 17, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s)
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 17, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s), and if it's the
   last version it mirrors the ReadyConditions
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/octavia-operator that referenced this issue Apr 17, 2024
This patch does a few things:

1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s), and if it's the
   last version it mirrors the Conditions
4. before marking the DeploymentReadyCondition as True, the ObservedGeneration
   is compared with the Generation of the Deployment/DaemonSets

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/octavia-operator that referenced this issue Apr 17, 2024
This patch does a few things:

1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s), and if it's the
   last version it mirrors the Conditions
4. before marking the DeploymentReadyCondition as True, the ObservedGeneration
   is compared with the Generation of the Deployment/DaemonSets

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/designate-operator that referenced this issue Apr 17, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s); if it's the latest
   version, the condition is mirrored
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 17, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s), and if it's the
   last version it mirrors the ReadyConditions
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/swift-operator that referenced this issue Apr 17, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s), and if it's the
   last version it mirrors the ReadyConditions
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/designate-operator that referenced this issue Apr 18, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s); if it's the latest
   version, the condition is mirrored
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/ironic-operator that referenced this issue Apr 19, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s); if it's the latest
   version, the condition is mirrored
4. before marking the DeploymentReadyCondition as True in the subCRs,
   the ObservedGeneration is compared with the Generation of the
   Deployment/ Statefulset
5. it updates the functional tests and bumps both lib-common test and
   common modules

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/ironic-operator that referenced this issue Apr 25, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s); if it's the latest
   version, the condition is mirrored
4. before marking the DeploymentReadyCondition as True in the subCRs,
   the ObservedGeneration is compared with the Generation of the
   Deployment/ Statefulset
5. it updates the functional tests and bumps both lib-common test and
   common modules

Signed-off-by: Francesco Pantano <[email protected]>
fmount added a commit to fmount/designate-operator that referenced this issue Apr 29, 2024
This patch does a few things:
1. it adds observedGeneration to the sub custom resources
2. it proposes to bump the observedGeneration at the beginning of the
   reconciliation loop (knative/serving#4937)
3. it checks, at the top level, if the ObservedGeneration matches with
   the metadata.generation assigned to the subCR(s); if it's the latest
   version, the condition is mirrored
4. before marking the DeploymentReadyCondition as True, the
   ObservedGeneration is compared with the Generation of the Deployment

Signed-off-by: Francesco Pantano <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/API API objects and controllers kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants