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

feat(controller): add label counter controller as an example #2

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

feat(controller): add label counter controller as an example #2

wants to merge 7 commits into from

Conversation

liubog2008
Copy link
Contributor

@liubog2008 liubog2008 commented Sep 13, 2018

TODO:

  • e2e test
  • more unit tests
  • crd register
  • more docs

@caicloud-bot
Copy link
Contributor

@liubog2008: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@caicloud-bot caicloud-bot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. caicloud-cla: yes Indicates the PR's author has not signed the Caicloud CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 13, 2018
@caicloud-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: liubog2008

Assign the PR to them by writing /assign @liubog2008 in a comment when ready.

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

syncHandler func(key string) error
}

func NewLabelCounterController(options *LabelCounterControllerOptions) *LabelCounterController {
Copy link
Member

Choose a reason for hiding this comment

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

please add comment to exported method

return updated
}

func (lc *LabelCounterController) resolveNodeLabel(nodeLabels map[string]string) ([]*v1alpha1.LabelCounter, error) {
Copy link
Member

Choose a reason for hiding this comment

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

add comment to core logic

counters := []v1alpha1.Counter{}
for _, v := range labelCounter.Spec.Values {
selector := labels.SelectorFromSet(labels.Set{
v1alpha1.LabelPrefix + labelCounter.Name: v,
Copy link
Member

Choose a reason for hiding this comment

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

this is a bit magic?

if my crd is key:value, the final selector is not key:value, but prefix/key:value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only count labels with specified prefix...
That's just an example with less meaningful logic

Copy link
Member

Choose a reason for hiding this comment

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

嗯,那就把文档做细,不要让人产生误解。

@caicloud-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@caicloud-bot caicloud-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 24, 2018
@ddysher
Copy link
Member

ddysher commented Dec 24, 2018

/remove-lifecycle stale

@caicloud-bot caicloud-bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 24, 2018
@gaocegege
Copy link

Can we merge it now?

@ddysher
Copy link
Member

ddysher commented Aug 8, 2019

i dont think we have bandwidth to review this, do you want to base ur work on this?

@gaocegege
Copy link

Yeah, if it is not ready, I can write a demo controller for my work, it also works for me

@ddysher
Copy link
Member

ddysher commented Aug 8, 2019

i don't know the status to be honest... you can see if this helps you, if not, feel free to open a new one

Yeah, if it is not ready, I can write a demo controller for my work, it also works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
caicloud-cla: yes Indicates the PR's author has not signed the Caicloud CLA. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants