Skip to content

Restrict visibility of prometheus packages #84302

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

Conversation

serathius
Copy link
Contributor

/kind feature

What this PR does / why we need it:
This PR restricts visibility of prometheus packages which no longer should be directly imported.

Which issue(s) this PR fixes:
Refer kubernetes/enhancements#1238

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
/milestone v1.17
/priority important-soon
/assign RainbowMango

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Oct 24, 2019
@k8s-ci-robot
Copy link
Contributor

@serathius: You must be a member of the kubernetes/milestone-maintainers GitHub team to set the milestone. If you believe you should be able to issue the /milestone command, please contact your and have them propose you as an additional delegate for this responsibility.

In response to this:

/kind feature

What this PR does / why we need it:
This PR restricts visibility of prometheus packages which no longer should be directly imported.

Which issue(s) this PR fixes:
Refer kubernetes/enhancements#1238

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
/milestone v1.17
/priority important-soon
/assign RainbowMango

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 kind/feature Categorizes issue or PR as related to a new feature. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 24, 2019
@liggitt
Copy link
Member

liggitt commented Oct 24, 2019

/assign @logicalhan

@RainbowMango
Copy link
Member

I don't know too much about bazel rule.
I'm not quite sure if we can modify files under vendor/.

And I think we should wait for all migration done.

@serathius serathius force-pushed the restrict-prometheus-import branch 2 times, most recently from 195a9bd to db4a3fa Compare November 6, 2019 15:01
@munnerz
Copy link
Member

munnerz commented Nov 6, 2019

This seems like a fairly reasonable approach, although it does mean that if a user runs rm -Rf vendor/ and hack/update-vendor.sh, their vendor directory will be incorrect/not up to date with what it was before.

Alternatively, could you define:

package_group(
    name = "allow_list",
    includes = [":internal"],
    packages = [
        "//cluster/images/etcd-version-monitor",
        "//pkg/controller/endpointslice",
        "//pkg/controller/volume/attachdetach/metrics",
        "//pkg/controller/volume/persistentvolume/metrics",
        "//pkg/kubelet/metrics/collectors",
        "//pkg/kubelet/pleg",
        "//pkg/kubelet/pluginmanager/metrics",
        "//pkg/kubelet/server",
        "//pkg/kubelet/server/stats",
        "//pkg/kubelet/volumemanager/metrics",
        "//pkg/master",
        "//pkg/scheduler/framework/v1alpha1",
        "//pkg/volume/util/operationexecutor",
        "//staging/src/k8s.io/apiserver/pkg/admission/metrics",
        "//staging/src/k8s.io/component-base/metrics/...",
        "//test/e2e",
        "//test/e2e/storage",
        "//test/e2e_node",
        "//vendor/...",
    ],
)

in a package not in vendor/, and then use buildozer to update the visibility setting in all packages under vendor/github.com/prometheus to be the required value? You would likely want to add the additional call to buildozer here: https://github.com/kubernetes/kubernetes/blob/master/hack/update-bazel.sh#L82

This would then mean that git clone k/k.git && rm -Rf vendor/ && ./hack/update-vendor.sh would result in a clean tree.

@serathius
Copy link
Contributor Author

@munnerz This is a great suggestion! Thanks!

@serathius serathius force-pushed the restrict-prometheus-import branch from db4a3fa to 4982678 Compare November 6, 2019 15:49
@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 6, 2019
@munnerz
Copy link
Member

munnerz commented Nov 6, 2019

From a Bazel and general repo management, this looks good to me 😄 with regards to whether or not sig-instrumentation want to do this/whether this should be approved is not up to me 😄

So adding my lgtm and leaving to the appropriate OWNERS to decide on approval...

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 6, 2019
@serathius
Copy link
Contributor Author

/retest

@RainbowMango
Copy link
Member

/milestone v1.17

@k8s-ci-robot k8s-ci-robot added this to the v1.17 milestone Nov 7, 2019
@serathius serathius force-pushed the restrict-prometheus-import branch from 4982678 to e7d5659 Compare November 7, 2019 08:13
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 7, 2019
@serathius
Copy link
Contributor Author

/assign @BenTheElder @logicalhan

@BenTheElder
Copy link
Member

/approve
for hack/

@serathius
Copy link
Contributor Author

/retest

Copy link
Member

@logicalhan logicalhan left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, logicalhan, serathius

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 Nov 8, 2019
@k8s-ci-robot k8s-ci-robot merged commit e4fdb82 into kubernetes:master Nov 8, 2019
@serathius serathius deleted the restrict-prometheus-import branch July 11, 2020 12:06
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants