Skip to content

Commit 188e4a3

Browse files
Fix fnrunner and controllers not setting image prefix from .env for local deployment
Signed-off-by: Rendre Greyling <rendre.greyling@nokia.com>
1 parent 7d4fc47 commit 188e4a3

2 files changed

Lines changed: 32 additions & 3 deletions

File tree

scripts/create-deployment-blueprint.sh

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ for resource in ctx.resource_list["items"]:
187187
'
188188
}
189189

190-
function add_image_args_porch_server() {
190+
function add_default_image_prefix() {
191191
kpt fn eval ${DESTINATION} \
192192
--image ${STARLARK_IMG} \
193193
--match-kind Deployment \
@@ -199,6 +199,35 @@ for resource in ctx.resource_list['items']:
199199
for container in containers:
200200
container['args'].append('--default-image-prefix=${GHCR_IMAGE_PREFIX}')
201201
"
202+
203+
kpt fn eval ${DESTINATION} \
204+
--image ${STARLARK_IMG} \
205+
--match-kind Deployment \
206+
--match-name function-runner \
207+
--match-namespace porch-system \
208+
-- "source=
209+
for resource in ctx.resource_list['items']:
210+
containers = resource['spec']['template']['spec']['containers']
211+
for container in containers:
212+
container['command'].append('--default-image-prefix=${GHCR_IMAGE_PREFIX}')
213+
"
214+
215+
kpt fn eval ${DESTINATION} \
216+
--image ${STARLARK_IMG} \
217+
--match-kind Deployment \
218+
--match-name porch-controllers \
219+
--match-namespace porch-system \
220+
-- "source=
221+
for resource in ctx.resource_list['items']:
222+
for container in resource['spec']['template']['spec']['containers']:
223+
if container['name'] == 'porch-controllers':
224+
if container['env'] == None:
225+
container['env'] = []
226+
container['env'].append({
227+
'name': 'DEFAULT_IMAGE_PREFIX',
228+
'value': '${GHCR_IMAGE_PREFIX}'
229+
})
230+
"
202231
}
203232

204233
function disable_fn_runner_warm_up_pod_cache() {
@@ -368,7 +397,7 @@ function main() {
368397
cp ${PORCH_DIR}/controllers/config/rbac/role.yaml "${DESTINATION}/9-porch-controller-clusterrole.yaml"
369398

370399
if [[ -n "${GHCR_IMAGE_PREFIX}" ]]; then
371-
add_image_args_porch_server
400+
add_default_image_prefix
372401
fi
373402

374403
if [[ "${FN_RUNNER_WARM_UP_POD_CACHE}" == "false" ]]; then

test/performance/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ Tests handle `SIGINT`/`SIGTERM` gracefully: in-flight work stops and results col
235235
| `-gitea-username` | `porch` | Gitea username |
236236
| `-gitea-password` | `secret` | Gitea password |
237237

238-
The KRM function registry URL is configured via `PORCH_GHCR_PREFIX_URL` in the repo root `.env` file. It is applied to porch-server and function-runner at deploy time (`make run-in-kind` reads `.env` automatically). Package `Kptfile` images use short names (for example `set-namespace:v0.4.1`); function-runner resolves them with `--default-image-prefix`. The `CHANGE_NAMESPACE` placeholder in Kptfiles is substituted at test runtime.
238+
The KRM function registry URL is configured via `PORCH_GHCR_PREFIX_URL` in the repo root `.env` file. It is applied at deploy time to porch-server, function-runner, and porch-controllers (`make run-in-kind`, `make run-in-kind-db-cache`, and `make run-in-kind-v1alpha2` all read `.env` automatically via `make deployment-config`). Package `Kptfile` images use short names (for example `set-namespace:v0.4.1`); porch-server and function-runner resolve them with `--default-image-prefix`, and controllers use the `DEFAULT_IMAGE_PREFIX` environment variable. The `CHANGE_NAMESPACE` placeholder in Kptfiles is substituted at test runtime.
239239

240240
## 6. Output Files
241241

0 commit comments

Comments
 (0)