You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/advanced_features/global-prefix-override.md
+59-22Lines changed: 59 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,23 +3,42 @@ title: Global Image Prefix Override
3
3
weight: 2001
4
4
---
5
5
6
-
The Global Image Prefix Override feature allows using mirrored package and workload images from a private registry without needing to rebuild the images with new image references.
6
+
The Global Image Prefix Override feature allows using mirrored package and
7
+
workload images from a private registry without needing to rebuild the images
8
+
with new image references.
7
9
8
-
This feature solves the problem of mirroring upstream images while preserving their original deployment manifests, all without relying on the Package Operator's internal image digest feature.
10
+
This feature solves the problem of mirroring package images that reference
11
+
other images with the [image-digest feature](/docs/guides/image-digests/)
12
+
without having to rebuild the images.
9
13
10
-
For example, this enables deployment of upstream package-operator artifacts from private registries without rebuilding them in downstream pipelines. This solves the previously impossible scenario where organizations needed to mirror upstream images, because PKO's internal image digest feature insist on referencing images by their original address.
14
+
For example, this enables deployment of upstream package-operator artifacts
15
+
from private registries without rebuilding them in downstream pipelines.
16
+
This solves the previously impossible scenario where organizations needed
17
+
to mirror upstream images, because PKO's internal image digest feature insist
18
+
on referencing images by their original address.
11
19
12
20
## Implementation
13
21
14
-
Prefix overrides can be configured through either of these options supplied to the `package-operator-manager` binary:
22
+
Prefix overrides can be configured through either of these options supplied
Both accept mappings in `from=to` format (e.g., `quay.io/my-org/=mirror.example.com/mirror-org/`). A comma separataed list in the same format can also be provided for multiple overrides. When Package Operator encounters an image reference starting with the `from` prefix, it automatically substitutes it with the `to` prefix while preserving the remainder of the image path.
A comma separataed list in the same format can also be provided
31
+
for multiple overrides. When Package Operator encounters an image reference
32
+
starting with the `from` prefix, it automatically substitutes it with the
33
+
`to` prefix while preserving the remainder of the image path.
19
34
20
35
## Usage Example
21
36
22
-
The following `mirror.sh` script demonstrates the mirroring of the images and the modification of the bootstrap job manifests. (Images for version v1.82.2 are mirrored from the registry namespace `quay.io/package-operator` into the registry namespace `quay.io/erdii-test/pko-mirror`).
37
+
The following `mirror.sh` script demonstrates the mirroring of the images
38
+
and the modification of the bootstrap job manifests.
39
+
(Images for version v1.82.2 are mirrored from the registry namespace
40
+
`quay.io/package-operator` into the registry namespace
The `skopeo copy` commands create identical copies of all upstream PKO package images in your private registry, maintaining the original tags and manifests.
84
+
### Image Mirroring
85
+
86
+
The `skopeo copy` commands create identical copies of all upstream
87
+
PKO package images in your private registry,
88
+
maintaining the original tags and manifests.
67
89
68
-
### Prefix Override Injection:
69
-
The first `yq` command modifies the PKO_IMAGE_PREFIX_OVERRIDES environment variable to redirect all PKO package image pulls from quay.io/package-operator/ to quay.io/erdii-test/pko-mirror/
70
-
while additionally rewriting the prefixes of the templated image address outputs of the [image digest feature](https://github.com/package-operator/website/blob/904d2c0a90d53e01ed59b602181d47b314925b8b/content/en/docs/guides/image-digests.md). Example template directive: {{.images.someNamedImage}}
90
+
### Prefix Override Injection
71
91
72
-
The pattern `original-prefix/=new-prefix/` ensures complete prefix substitution while preserving image names and tags
92
+
The first `yq` command modifies the PKO_IMAGE_PREFIX_OVERRIDES environment
93
+
variable to redirect all PKO package image pulls from quay.io/package-operator/
94
+
to quay.io/erdii-test/pko-mirror/ while additionally rewriting the prefixes
Example template directive: {{.images.someNamedImage}}
73
98
74
-
### Direct Reference Updates:
75
-
The second `yq` command handles hardcoded image references that bypass the prefix override mechanism by:
99
+
The pattern `original-prefix/=new-prefix/` ensures complete prefix substitution
100
+
while preserving image names and tags.
101
+
102
+
### Direct Reference Updates
103
+
104
+
The second `yq` command handles hardcoded image references that
105
+
bypass the prefix override mechanism by:
76
106
77
107
Modifying the container's `.image` field
78
108
Updating the first command-line argument in .args[0]
79
109
80
-
To ensure that all artifacts required for PKO's bootstrap procedure are pulled correctly , it is required to reference the bootstrap job workload image directly from the mirrored location.
110
+
To ensure that all artifacts required for PKO's bootstrap procedure are
111
+
pulled correctly, it is required to reference the bootstrap job workload image
112
+
directly from the mirrored location.
81
113
82
114
The package image location also gets replaced for readability reasons.
83
-
84
-
# Deployment Process
85
115
86
-
## 1. Apply the prepared manifest on the target cluster:
87
-
```kubectl apply -f self-bootstrap-job.yaml```
116
+
## Deployment Process
117
+
118
+
### 1. Apply the prepared manifest on the target cluster
88
119
89
-
## 2. Monitor progress until the ClusterPackage CRD becomes available
90
-
## 3. Verification:
120
+
```bash
121
+
kubectl apply -f self-bootstrap-job.yaml
91
122
```
123
+
124
+
### 2. Monitor progress until the ClusterPackage CRD becomes available
125
+
126
+
### 3. Verification
127
+
128
+
```bash
92
129
# Verify package image source
93
130
kubectl get clusterpackage package-operator -o yaml | yq .spec.image
0 commit comments