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

exclude openshift namespaces via regex #382

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

Conversation

zfrhv
Copy link
Contributor

@zfrhv zfrhv commented Jun 10, 2024

Adding --included-namespace-regex option to the helm chart.
as mentioned in the docs there is only --included-namespace-regex or --excluded-namespace.
so in order to exclude all openshift.* namespaces I used the --included-namespace-regex as mentioned in this issue, this is added as an example in values.yaml

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zfrhv
Once this PR has been reviewed and has the lgtm label, please assign adrianludwin for approval. For more information see the Kubernetes Code Review Process.

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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 10, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @zfrhv. 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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 10, 2024
@zfrhv
Copy link
Contributor Author

zfrhv commented Jun 10, 2024

@mochizuki875 can you please tell if you like it?

@mochizuki875
Copy link
Member

mochizuki875 commented Jun 10, 2024

@zfrhv

Thank you for your suggestion and PR!

There is just one thing to note.
Now, to generate Helm Chart, we need to execute make charts.
It is for keeping up-to-date with changes in HCN manifests(manifests/*.yaml generated by make manifests), which was barrier to create Helm chart previously.

Then, all files in charts/hnc/templates are re-generated by make charts like this, so you should not edit charts/hnc/templates/xxx.yaml directly.
Sorry, I should left comment somewhere...

So in this case, it's good to update hack/helm_patches/update-helm.sh to update template like that.

@zfrhv zfrhv force-pushed the exclude-openshift-namespaces branch from bfc1c00 to 2a95760 Compare June 10, 2024 08:47
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 10, 2024
@zfrhv zfrhv force-pushed the exclude-openshift-namespaces branch 2 times, most recently from 22601d9 to 8815241 Compare June 10, 2024 09:39
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 10, 2024
@zfrhv zfrhv force-pushed the exclude-openshift-namespaces branch from 8815241 to d04cc02 Compare June 10, 2024 09:42
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 10, 2024
@zfrhv
Copy link
Contributor Author

zfrhv commented Jun 10, 2024

@mochizuki875
thank you for mentioning.
I updated the files accordingly, after running make charts it did updated the templates as expected.
i didnt added the make charts result to the PR because it also modified many other files

let me know if you want me to include the make charts result in the PR

@mochizuki875
Copy link
Member

@zfrhv
IMO, I think it's better to add make charts result if it works as expected, because I think latest charts are expected to be in charts dir of project and some users may use the chart without make charts.

Ideally, make charts should be executed automatically and the helm chart should be updated to charts dir and github pages as commented here, but I’ve not started working yet...

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 11, 2024
@zfrhv
Copy link
Contributor Author

zfrhv commented Jun 11, 2024

in values.yaml the image repository seems to be broken
am I supposed to dig in and figure out why?

@mochizuki875
Copy link
Member

Have you set some environment values? (see here)

By setting these values as below,

$ export HNC_REGISTRY=gcr.io/k8s-staging-multitenancy
$ export HNC_IMG_NAME=hnc-manager
$ export HNC_IMG_TAG=v1.1.0 

values.yaml should be generated like this as a result of make charts.

image:
  repository: gcr.io/k8s-staging-multitenancy/hnc-manager
  tag: v1.1.0
  imagePullPolicy: {}
  ...

@zfrhv zfrhv force-pushed the exclude-openshift-namespaces branch from 4aa86ce to 2ca63f0 Compare June 11, 2024 19:52
Signed-off-by: Zakhar Pecherichny <zfrhv2010@gmail.com>
Signed-off-by: Zakhar Pecherichny <zfrhv2010@gmail.com>
@zfrhv zfrhv force-pushed the exclude-openshift-namespaces branch from 2ca63f0 to af675aa Compare June 11, 2024 20:18
@zfrhv
Copy link
Contributor Author

zfrhv commented Jun 11, 2024

sorry for making you feed me with a spoon

@mochizuki875
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 18, 2024
@mochizuki875
Copy link
Member

@zfrhv
Thank you for your work!
This PR seems to make sense.
/lgtm
/cc @rjbez17

Related this PR, I have two questions.
If you have some information, please let me know.

  1. Some ClusterRoles(admin, edit, view) templates are replaced from admin-role in this PR.
    However, there doesn’t seems to be Binding resource to bind them.
    Is this intentional?
    It comes from Add permissions on hnc CRDs to default clusterRoles: cluster-reader, view, edit, admin #318.

  2. (NIT) At first, I thought the range operation should be used for --included-namespace-regex like --excluded-namespace.
    However, includedNamespacesRegex which comes from --included-namespace-regex is defined as string not arrayArg, so we can't.
    How do you think?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 19, 2024
@zfrhv
Copy link
Contributor Author

zfrhv commented Jun 19, 2024

@mochizuki875

  1. those roles are the default permissions that users will get.
    for example if someone has view on his namespace, then he will also be able to view the hnc resources on his namespace.
    if someone has edit then he can edit and also admin.
    the clusterRoles are not supposed to be bound to anything, they have the label rbac.authorization.k8s.io/aggregate-to-edit: "true" which kubernetes uses to merge the cluster role into the default clusterRole edit.
    its just better permissions assignment instead of just giving admin to admin
  2. im not good at go but when I checked how to use the includeNamespaceRegex I saw the pr that added it, and it mentions that its a string and not arrayArg here lines 69-70

@mochizuki875
Copy link
Member

@zfrhv Thanks your information;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants