Skip to content

Commit c6e33ae

Browse files
committed
fix: make pre-commit hooks pass for global image prefix overrides and rewrite small parts of the introduction
1 parent 64c030b commit c6e33ae

File tree

1 file changed

+59
-22
lines changed

1 file changed

+59
-22
lines changed

content/en/docs/advanced_features/global-prefix-override.md

Lines changed: 59 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,42 @@ title: Global Image Prefix Override
33
weight: 2001
44
---
55

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.
79

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.
913

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.
1119

1220
## Implementation
1321

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
23+
to the `package-operator-manager` binary:
24+
1525
- Environment variable: `PKO_IMAGE_PREFIX_OVERRIDES`
1626
- Command-line flag: `image-prefix-overrides`
1727

18-
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.
28+
Both accept mappings in `from=to` format
29+
(e.g., `quay.io/my-org/=mirror.example.com/mirror-org/`).
30+
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.
1934

2035
## Usage Example
2136

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
41+
`quay.io/erdii-test/pko-mirror`).
2342

2443
```bash
2544
#!/bin/bash
@@ -57,38 +76,56 @@ yq -i 'with(
5776
.image |= sub("quay.io/package-operator", "quay.io/erdii-test/pko-mirror"),
5877
.args[0] |= sub("quay.io/package-operator", "quay.io/erdii-test/pko-mirror")
5978
)
60-
)' self-bootstrap-job.yaml
79+
)' self-bootstrap-job.yaml
6180
```
6281

6382
## Key Components Explained
6483

65-
### Image Mirroring:
66-
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.
6789

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
7191

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
95+
of the templated image address outputs of the
96+
[image digest feature](https://github.com/package-operator/website/blob/904d2c0a90d53e01ed59b602181d47b314925b8b/content/en/docs/guides/image-digests.md).
97+
Example template directive: {{.images.someNamedImage}}
7398

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:
76106

77107
Modifying the container's `.image` field
78108
Updating the first command-line argument in .args[0]
79109

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.
81113

82114
The package image location also gets replaced for readability reasons.
83-
84-
# Deployment Process
85115

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
88119

89-
## 2. Monitor progress until the ClusterPackage CRD becomes available
90-
## 3. Verification:
120+
```bash
121+
kubectl apply -f self-bootstrap-job.yaml
91122
```
123+
124+
### 2. Monitor progress until the ClusterPackage CRD becomes available
125+
126+
### 3. Verification
127+
128+
```bash
92129
# Verify package image source
93130
kubectl get clusterpackage package-operator -o yaml | yq .spec.image
94131

0 commit comments

Comments
 (0)