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

add apiClient make requests to the api server and not the cache #609

Closed
wants to merge 2 commits into from

Conversation

@fanux
Copy link

commented Sep 18, 2019

kubernetes-sigs/kubebuilder#947

If we want to query and write CRD in some agents, like CNI. or create a command line (not long live process). apiClient without cache is needed

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2019

Welcome @fanux!

It looks like this is your first PR to kubernetes-sigs/controller-runtime 🎉. 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/controller-runtime 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

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2019

Hi @fanux. Thanks for your PR.

I'm waiting for a kubernetes-sigs or kubernetes 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

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2019

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fanux
To complete the pull request process, please assign droot
You can assign the PR to them by writing /assign @droot in a comment when ready.

The full list of commands accepted by this bot can be found 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 size/S label Sep 18, 2019
@fanux fanux changed the title :sparkles: add apiClient make requests to the api server and not the cache add apiClient make requests to the api server and not the cache Sep 18, 2019
@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2019

@fanux: The label(s) /label :sparkles: cannot be applied. These labels are supported: api-review, community/discussion, community/maintenance, community/question, cuj/build-train-deploy, cuj/multi-user, platform/aws, platform/azure, platform/gcp, platform/minikube, platform/other

In response to this:

/label

kubernetes-sigs/kubebuilder#947

If we want to query and write CRD in some agents, like CNI. or create a command line (not long live process). apiClient without cache is needed

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.

@DirectXMan12

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2019

Please see my response on the corresponding issue

/hold

@fanux

This comment has been minimized.

Copy link
Author

commented Sep 19, 2019

client.New is not good enough to use. See my response.

@fanux

This comment has been minimized.

Copy link
Author

commented Sep 20, 2019

Using client:

cl, err := client.New(config.GetConfigOrDie(), client.Options{})
if err != nil {
    fmt.Println("failed to create client")
    os.Exit(1)
}

podList := &corev1.PodList{}

err = cl.List(context.Background(), podList, client.InNamespace("default"))
if err != nil {
    fmt.Printf("failed to list pods in namespace default: %v\n", err)
    os.Exit(1)
}

https://godoc.org/sigs.k8s.io/controller-runtime/pkg/client#New

@fanux fanux closed this Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.