Skip to content

Fixing namespace reconciler bugs#1128

Merged
knative-prow-robot merged 1 commit into
knative:masterfrom
shashwathi:ns-recon
May 3, 2019
Merged

Fixing namespace reconciler bugs#1128
knative-prow-robot merged 1 commit into
knative:masterfrom
shashwathi:ns-recon

Conversation

@shashwathi
Copy link
Copy Markdown
Contributor

@shashwathi shashwathi commented Apr 30, 2019

Addressed few issues mentioned in #1080

Proposed Changes

  • produces reconciliation successs/failure events
  • unit test for cleaning up resources and default broker in namespace

cc @n3wscott

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Apr 30, 2019
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 30, 2019
@Harwayne
Copy link
Copy Markdown
Contributor

I'm not sure we want to clean up the resources if the annotation is removed. That will instantaneously stop all Brokers in that namespace (by deleting a needed ServiceAccount and its RBAC permissions).

Copy link
Copy Markdown
Contributor

@n3wscott n3wscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! And Nacho just added back the watchers on these dependents (but not the cleanup like this). Couple comments.

/cc @nachocano

Comment thread pkg/reconciler/namespace/namespace.go Outdated
FieldSelector: fmt.Sprintf("metadata.name=%s", resources.DefaultBrokerName),
})
if err != nil && !k8serrors.IsNotFound(err) {
logging.FromContext(ctx).Error("Error deleting broker in namespace", zap.String("brokername", resources.DefaultBrokerName), zap.Error(err))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is an error? perhaps the user deleted it and disabled the namespace annotation?

Comment thread pkg/reconciler/namespace/namespace.go Outdated
FieldSelector: fmt.Sprintf("metadata.name=%s", resources.ServiceAccountName),
})
if serr != nil && !k8serrors.IsNotFound(serr) {
logging.FromContext(ctx).Error("Error deleting service account %s in namespace", zap.String("name", resources.ServiceAccountName), zap.Error(serr))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here? perhaps not an error. Log it and try to delete the other things too.

If one resource is missing you will miss out of deleting the others.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a good idea. I will update that

@Harwayne
Copy link
Copy Markdown
Contributor

/hold

I've outlined my concerns in the linked bug (#1080).

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 30, 2019
@shashwathi shashwathi force-pushed the ns-recon branch 2 times, most recently from 6f69701 to 51c7dcd Compare May 1, 2019 23:05
@shashwathi
Copy link
Copy Markdown
Contributor Author

@n3wscott @Harwayne I have removed the cleaning resources and updated the PR only for events and logging updates

Copy link
Copy Markdown
Contributor

@Harwayne Harwayne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/hold cancel

Comment thread pkg/reconciler/namespace/namespace.go Outdated
controllerAgentName = "knative-eventing-namespace-controller"
controllerAgentName = "knative-eventing-namespace-controller"
namespaceReconciled = "NamespaceReconciled"
namespaceReconcileFailure = "ReconcileReconcileFailure"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"ReconcileReconcileFailure" -> "NamespaceReconcileFailure"

Comment thread pkg/reconciler/namespace/namespace.go Outdated
if apierrs.IsNotFound(err) {
// The resource may no longer exist, in which case we stop processing.
logging.FromContext(ctx).Error("namespace key in work queue no longer exists")
logging.FromContext(ctx).Error("namespace key in work queue no longer exists", zap.String("key", key))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key is no longer needed, see #1135.

Comment thread pkg/reconciler/namespace/namespace.go Outdated
logging.FromContext(ctx).Error("Error reconciling Namespace", zap.Error(err))
} else {
logging.FromContext(ctx).Debug("Namespace reconciled")
logging.FromContext(ctx).Error("Error reconciling Namespace", zap.Error(err), zap.String("key", key))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key is no longer needed.

Comment thread pkg/reconciler/namespace/namespace.go Outdated

// Requeue if the resource is not ready:
return err
logging.FromContext(ctx).Debug("Namespace reconciled", zap.String("key", key))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key is no longer required.

InjectionLabelKey = "knative-eventing-injection"
InjectionEnabledLabelValue = "enabled"
InjectionDisabledLabelValue = "disabled"
ResourceInjectionLabel = "eventing.knative.dev/namespaceInjected"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InjectedResourceLabel

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 1, 2019
@shashwathi
Copy link
Copy Markdown
Contributor Author

@Harwayne : Addressed all your comments.

@shashwathi
Copy link
Copy Markdown
Contributor Author

/test pull-knative-eventing-integration-tests

Comment thread pkg/reconciler/namespace/namespace.go Outdated
logging.FromContext(ctx).Error("Error reconciling Namespace", zap.Error(err))
} else {
logging.FromContext(ctx).Debug("Namespace reconciled")
logging.FromContext(ctx).Error("Error reconciling Namespace")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zap.Error(error) should still be here.

- produces reconciliation sucesss/failure events
- unit test for default broker in namespace
@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on pkg/.
Say /test pull-knative-eventing-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/namespace/namespace.go Do not exist 75.0%

Copy link
Copy Markdown
Contributor

@Harwayne Harwayne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label May 2, 2019
Copy link
Copy Markdown
Contributor

@Harwayne Harwayne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@Harwayne
Copy link
Copy Markdown
Contributor

Harwayne commented May 2, 2019

/test pull-knative-eventing-integration-tests

@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Harwayne, shashwathi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 2, 2019
@evankanderson
Copy link
Copy Markdown
Member

evankanderson commented May 2, 2019 via email

@Harwayne
Copy link
Copy Markdown
Contributor

Harwayne commented May 2, 2019

/test pull-knative-eventing-integration-tests

@knative-prow-robot knative-prow-robot merged commit 2f73f38 into knative:master May 3, 2019
@shashwathi shashwathi deleted the ns-recon branch May 3, 2019 00:07
lberk added a commit to lberk/eventing that referenced this pull request Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants