Skip to content

Commit

Permalink
Updating cluster policy to mutate gcr.io-k8s-prow/staging to ecr repo
Browse files Browse the repository at this point in the history
  • Loading branch information
junshun committed Mar 21, 2023
1 parent ff6c00e commit e308a97
Show file tree
Hide file tree
Showing 3 changed files with 31,450 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
spec:
containers:
- name: "{{ element.name }}"
image: "{{ replace_all('{{element.image}}', 'gcr.io/k8s-prow/', '468814281478.dkr.ecr.us-east-2.amazonaws.com/k8s-prow/' )}}"
image: "{{ regex_replace_all('gcr.io/k8s-(prow/|staging-)', '{{ element.image }}', '468814281478.dkr.ecr.us-east-2.amazonaws.com/k8s-${1}' )}}"
- name: replace-image-registry-gcr-k8s-prow-to-ecr-pod-initcontainers
match:
any:
Expand All @@ -37,37 +37,5 @@ spec:
spec:
initContainers:
- name: "{{ element.name }}"
image: "{{ replace_all('{{element.image}}', 'gcr.io/k8s-prow/', '468814281478.dkr.ecr.us-east-2.amazonaws.com/k8s-prow/' )}}"
- name: replace-image-registry-gcr-k8s-staging-to-ecr-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}}', 'gcr.io/k8s-staging-', '468814281478.dkr.ecr.us-east-2.amazonaws.com/k8s-staging-' )}}"
- name: replace-image-registry-gcr-k8s-staging-to-ecr-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}}', 'gcr.io/k8s-staging-', '468814281478.dkr.ecr.us-east-2.amazonaws.com/k8s-staging-' )}}"
image: "{{ regex_replace_all('gcr.io/k8s-(prow/|staging-)', '{{ element.image }}', '468814281478.dkr.ecr.us-east-2.amazonaws.com/k8s-${1}' )}}"

Loading

0 comments on commit e308a97

Please sign in to comment.