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

Kyverno mutate eks-prow-build-cluster to pull images from ecr #4994

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

junshun
Copy link

@junshun junshun commented Mar 21, 2023

This uses Kyverno to address issue #4928

This was tested using a fake pod manifest and applying the kyverno policy in clusterpolicy.yaml

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: gcr.io/k8s-prow/nginx:1.14.1
  - name: nginx-staging
    image: gcr.io/k8s-staging-test-infra/nginx:1.14.1
  - name: nginx-others
    image: gcr.io/k8s-others-test-infra/nginx:1.14.1
  - name: nginx-fail
    image: gcr.io/k8s-staging/nginx:1.14.1

It was able to mutate the images to

k describe pod | grep Image:
    Image:          468814281478.dkr.ecr.us-east-2.amazonaws.com/k8s-prow/nginx:1.14.1
    Image:          468814281478.dkr.ecr.us-east-2.amazonaws.com/k8s-staging-test-infra/nginx:1.14.1
    Image:          gcr.io/k8s-others-test-infra/nginx:1.14.1
    Image:          gcr.io/k8s-staging/nginx:1.14.1

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 21, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Mar 21, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @junshun!

It looks like this is your first PR to kubernetes/k8s.io 🎉. 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/k8s.io 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 k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/infra Infrastructure management, infrastructure design, code in infra/ labels Mar 21, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @junshun. Thanks for your PR.

I'm waiting for a 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 k8s-ci-robot added area/infra/aws Issues or PRs related to Kubernetes AWS infrastructure sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra. labels Mar 21, 2023
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 21, 2023
@upodroid
Copy link
Member

/ok-to-test

Thanks. Please sign the CLA

@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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Mar 21, 2023
@TerryHowe
Copy link
Member

yaml lint isn't digging it.

@upodroid
Copy link
Member

@xmudrii Hi, can you deploy these manifests (except the clusterpolicy.yaml file)?

/assign @xmudrii

Copy link
Member

Choose a reason for hiding this comment

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

Please change PodDisruptionBudget apiVersion to policy/v1. policy/v1beta1 doesn't exist in Kubernetes 1.25:

resource mapping not found for name: "kyverno" namespace: "kyverno" from "kyverno.yaml": no matches for kind "PodDisruptionBudget" in version "policy/v1beta1"

Copy link
Author

Choose a reason for hiding this comment

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

done. Added section to readme about this as well.

@xmudrii
Copy link
Member

xmudrii commented Mar 25, 2023

@upodroid @junshun Applied:

NAME                                          READY   STATUS    RESTARTS        AGE
kyverno-6bfcb5cdfc-99dgp                      1/1     Running   0               2m35s
kyverno-6bfcb5cdfc-lkhgk                      1/1     Running   2 (2m25s ago)   2m35s
kyverno-6bfcb5cdfc-lldts                      1/1     Running   0               2m35s
kyverno-cleanup-controller-85cf97fb88-j9h7v   1/1     Running   0               2m35s

(pod restarts are due to missing CRDs; server-side apply or kubectl create is required because of the annotation length)

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 27, 2023
@xmudrii
Copy link
Member

xmudrii commented Mar 28, 2023

@junshun The PR needs a rebase (probably because of namespaces.yaml). Can you please rebase it and then we can merge it?

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 28, 2023
@junshun
Copy link
Author

junshun commented Mar 28, 2023

@xmudrii rebased should be good now

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

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: junshun, xmudrii
Once this PR has been reviewed and has the lgtm label, please assign spiffxp 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

@xmudrii
Copy link
Member

xmudrii commented Mar 28, 2023

/assign @ameukam
for approval

@dims
Copy link
Member

dims commented Mar 28, 2023

/hold

Let's make sure we won't see this problem in our build cluster before we land this change - kyverno/kyverno#5830

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 28, 2023
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 3, 2023
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 19, 2024
@xmudrii
Copy link
Member

xmudrii commented Jan 19, 2024

We should eventually get back to this
/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 19, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 18, 2024
@xmudrii
Copy link
Member

xmudrii commented Apr 19, 2024

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/infra/aws Issues or PRs related to Kubernetes AWS infrastructure area/infra Infrastructure management, infrastructure design, code in infra/ cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra. 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.

None yet

8 participants