Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Add Error Event for FederatedNamespace #1063

Merged
merged 1 commit into from
Jul 31, 2019

Conversation

qiujian16
Copy link
Contributor

@qiujian16 qiujian16 commented Jul 30, 2019

What this PR does / why we need it:
Add an error event when name and namespace of federatednamespace
are not same.

Which issue(s) this PR fixes:

Fixes #1037

Special notes for your reviewer:

Release note:


@k8s-ci-robot
Copy link
Contributor

Welcome @qiujian16!

It looks like this is your first PR to kubernetes-sigs/kubefed 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubefed has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 30, 2019
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 30, 2019
Copy link
Contributor

@marun marun left a comment

Choose a reason for hiding this comment

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

Thank you for pitching in! Functionally looks fine, just some wording suggestions inline.

// A FederatedNamespace is only valid for propagation
// if it has the same name as the containing namespace.
a.eventRecorder.Eventf(
resource, corev1.EventTypeWarning, "InConsistentNameNamespace", "Name and namespace are not consistent")
Copy link
Contributor

Choose a reason for hiding this comment

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

s/InConistentNameNamespace/InvalidName/

s/Name and namespace are not consistent/The name of a federated namespace must match the name of its containing namespace./

Copy link
Contributor

Choose a reason for hiding this comment

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

@font Maybe federated resource validation, in addition to dry-run, could have special handling for federated namespaces to prevent creation when the name doesn't match that of the containing namespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks for the comment.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 30, 2019
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jul 30, 2019
// A FederatedNamespace is only valid for propagation
// if it has the same name as the containing namespace.
a.eventRecorder.Eventf(
resource, corev1.EventTypeWarning, "InvalidName", ""+
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to include ""+?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right...fixed

Add an error event when name and namespace of federatednamespace
are not same.
@marun
Copy link
Contributor

marun commented Jul 31, 2019

Thank you!

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 31, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marun, qiujian16

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 31, 2019
@k8s-ci-robot k8s-ci-robot merged commit 610e80e into kubernetes-retired:master Jul 31, 2019
@qiujian16 qiujian16 deleted the add-error-event branch July 31, 2019 14:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An error event should be logged when the name of a FederatedNamespace doesn't match its namespace
3 participants