Skip to content

Generic controller #75

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

Merged
merged 13 commits into from
Aug 16, 2020

Conversation

somtochiama
Copy link
Member

No description provided.

@k8s-ci-robot k8s-ci-robot added do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 23, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @somtochiama. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 23, 2020
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 23, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Jul 23, 2020
@dholbach
Copy link

/ok-to-test
/uncc
/cc @stealthybox

@k8s-ci-robot k8s-ci-robot removed the request for review from dholbach July 24, 2020 07:07
@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jul 24, 2020
@k8s-ci-robot k8s-ci-robot requested a review from stealthybox July 24, 2020 07:07
@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 24, 2020
generic/main.go Outdated
func init() {
_ = clientgoscheme.AddToScheme(scheme)

_ = addonsv1alpha1.AddToScheme(scheme) // <--------
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: We can remove the <--- marker :-)

os.Exit(1)
}

for i := range genericList.Items {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think we should have a TODO to say "add a watch on Generic, respond to changes" or something like that

Channel string
}

// +kubebuilder:rbac:groups=addons.x-k8s.io,resources=generics,verbs=get;list;watch;create;update;patch;delete
Copy link
Contributor

Choose a reason for hiding this comment

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

I actually don't think we need these rbac permissions. I guess we want get/list/watch on generics, but you could also move than to main.go.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there any difference, moving it to main.go

return err
}

// Watch for changes to Generic
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think this should say "Watch for changes to the objectKind" or something like that

@justinsb
Copy link
Contributor

This is looking really good! We do need the tools to generate the RBAC & the manifests, but then this is going to be a really nice experience for users!

@cmoulliard
Copy link

Can you please add a README.md file under the tools in order to explain how to use them with some concrete examples ?

FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
COPY addons/ addons/
Copy link

@cmoulliard cmoulliard Aug 6, 2020

Choose a reason for hiding this comment

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

Error. The line COPY addons/ addons/ should be changed to COPY channels/ channels/ otherwise docker build will fail. @somtochiama

@cmoulliard
Copy link

I got this error when I run the generic controller under a kind cluster using the command make deploy

kc logs generic-controller-manager-5d9cf5db7b-mnfc2 -n generic-system -c manager
2020-08-06T10:27:56.581Z	INFO	controller-runtime.metrics	metrics server is starting to listen	{"addr": "127.0.0.1:8080"}
Please create a `Generic` resource

Why should we do then deploy first a Generic CRD before to start the controler ?

@somtochiama
Copy link
Member Author

I got this error when I run the generic controller under a kind cluster using the command make deploy

kc logs generic-controller-manager-5d9cf5db7b-mnfc2 -n generic-system -c manager
2020-08-06T10:27:56.581Z	INFO	controller-runtime.metrics	metrics server is starting to listen	{"addr": "127.0.0.1:8080"}
Please create a `Generic` resource

Why should we do then deploy first a Generic CRD before to start the controler ?

The generic controller is different because it is used as a general controller for other simple addons that don't require any extra configuration.
The Generic resource is used to tell the generic controller these addons are and where to find their channels

@somtochiama
Copy link
Member Author

Can you please add a README.md file under the tools in order to explain how to use them with some concrete examples ?

I will definitely do so

@cmoulliard
Copy link

The Generic resource is used to tell the generic controller these addons are and where to find their channels

Maybe then review the message logged to make it more explicit about root cause of the error and what is it needed to be done to avoid it. As the controller will crash, then we must find a way to make it healthy if a Generic CR has been deployed ...

@somtochiama somtochiama requested a review from justinsb August 7, 2020 08:07
@somtochiama
Copy link
Member Author

Maybe then review the message logged to make it more explicit about root cause of the error and what is it needed to be done to avoid it.

I changed the message and added a REAME.md for the tools. Please review whenever you can! Thanks

@justinsb
Copy link
Contributor

This is really cool and it sounds like people want to start trying it out, so let's merge it and iterate with further improvements!

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 16, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, SomtochiAma

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 Aug 16, 2020
@k8s-ci-robot k8s-ci-robot merged commit 55b1092 into kubernetes-sigs:master Aug 16, 2020
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

5 participants