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

Mutate eks-prow-build-cluster image pulls to use ECR #4928

Open
Tracked by #5167
upodroid opened this issue Mar 13, 2023 · 7 comments
Open
Tracked by #5167

Mutate eks-prow-build-cluster image pulls to use ECR #4928

upodroid opened this issue Mar 13, 2023 · 7 comments
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra.

Comments

@upodroid
Copy link
Member

Can we look in to using Kyverno to mutate image pulls on the eks-prow-build-cluster?

It will be faster and cheaper to pull images from ECR than the staging GCR registries.

Good candidates for sync to ECR would would be

  • gcr.io/k8s-prow/*
  • gcr.io/k8s-staging-test-infra/*
  • gcr.io/k8s-staging-*/*

Kyverno would rewrite the image that the submitted from gcr.io/k8s-staging-test-infra/kubekins-e2e:v20230222-b5208facd4-master to ACCOUNT_NUMBER.dkr.ecr.us-east-2.amazonaws.com/[REPO_NAME]/kubekins-e2e:v20230222-b5208facd4-master

We would also have a prowjob that syncs that ECR repo with images from the staging repos.

Sample Kyverno policy:

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: kubernetes-gcr-to-registry    
spec:
  background: false
  rules:
    - name: replace-image-registry-pod-containers
      match:
        any:
        - resources:
            kinds:
            - Pod
      mutate:
        foreach:
        - list: "request.object.spec.containers"
          patchStrategicMerge:
            spec:
              containers:
              - name: "{{ element.name }}"
                image: "{{ replace_all('{{element.image}}', 'k8s.gcr.io', 'registry.k8s.io' )}}"
    - name: replace-image-registry-pod-initcontainers
      match:
        any:
        - resources:
            kinds:
            - Pod
      preconditions:
        all:
        - key: "{{ request.object.spec.initContainers[] || `[]` | length(@) }}"
          operator: GreaterThanOrEquals
          value: 1
      mutate:
        foreach:
        - list: "request.object.spec.initContainers"
          patchStrategicMerge:
            spec:
              initContainers:
              - name: "{{ element.name }}"
                image: "{{ replace_all('{{element.image}}', 'k8s.gcr.io', 'registry.k8s.io' )}}"

/cc @ameukam @xmudrii

@upodroid upodroid added the sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra. label Mar 13, 2023
@sftim
Copy link
Contributor

sftim commented Mar 20, 2023

Is ECR pull-through cache useful here?

I'm thinking we might need to switch to specifying hashes rather than tags to benefit. Not sure, haven't thought this through.

@BenTheElder
Copy link
Member

Is ECR pull-through cache useful here?

I think this came up previously, but lost the thread. Unfortunately it's not because:

Amazon ECR currently supports creating pull through cache rules for Amazon ECR Public and Quay.

@k8s-triage-robot
Copy link

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

This bot triages un-triaged issues 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 issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue 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 Jun 18, 2023
@xmudrii
Copy link
Member

xmudrii commented Jun 19, 2023

/remove-lifecycle stale

ECR now supports registry.k8s.io, we should revisit this.

/assign

@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 Jun 19, 2023
@k8s-triage-robot
Copy link

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

This bot triages un-triaged issues 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 issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue 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 22, 2024
@xmudrii
Copy link
Member

xmudrii commented Jan 23, 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 Jan 23, 2024
@xmudrii
Copy link
Member

xmudrii commented Feb 12, 2024

/unassign
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra.
Projects
None yet
Development

No branches or pull requests

6 participants