fix: forward CLI overrides to in-cluster deploy for Git-based remote deploys#3777
Conversation
This commit enhances the deployment process by allowing CLI-specified overrides for image pull secrets, service accounts, and deployer types to be forwarded to the in-cluster deployment step. The changes include: - Updated `main.go` to read environment variables for `FUNC_IMAGE_PULL_SECRET`, `FUNC_SERVICE_ACCOUNT`, and `FUNC_DEPLOYER`. - Modified Tekton task templates (`task-buildpack.yaml.tmpl`, `task-s2i.yaml.tmpl`) to include new parameters for these overrides. - Adjusted template data structures in `templates_pack.go` and `templates_s2i.go` to accommodate the new parameters. These enhancements ensure that user-defined configurations are properly applied during deployment, improving flexibility and usability.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Ankitsinghsisodya The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Ankitsinghsisodya. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3777 +/- ##
==========================================
+ Coverage 57.03% 57.04% +0.01%
==========================================
Files 182 182
Lines 21376 21380 +4
==========================================
+ Hits 12191 12196 +5
+ Misses 7953 7952 -1
Partials 1232 1232
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/ok-to-test |
Fixes #3768
Problem
When
func deployuses a Git-based pipeline (f.Build.Git.URLis set), CLI flags like--image-pull-secret,--service-account, and--deployerare silently ignored. The on-clusterfunc-deploytask step readsfunc.yamldirectly from the cloned Git repo, which never contains in-memory CLI overrides — unlike the PVC-upload path fixed by #3663.Solution
Forward the three CLI overrides as discrete Tekton params on the pipeline run and apply them as environment variables on the
func-deploytask step. The in-clusterdeploybinary reads these env vars and applies them over the values loaded fromfunc.yaml.How it works
The env vars are only applied when non-empty, so existing behaviour is unchanged when no overrides are passed.
Changes
cmd/func-util/main.go— readFUNC_IMAGE_PULL_SECRET,FUNC_SERVICE_ACCOUNT,FUNC_DEPLOYERenv vars after loadingfunc.yamland apply them over the struct before deployingtask-buildpack.yaml.tmpl/task-s2i.yaml.tmpl— addIMAGE_PULL_SECRET,SERVICE_ACCOUNT,DEPLOYERparams; set correspondingFUNC_*env vars on thefunc-deploysteptemplates_pack.go/templates_s2i.go— add the three params to the Pipeline spec and thread them to the task; add them to the PipelineRun paramstemplates.go— addImagePullSecret,ServiceAccountName,DeployertotemplateData; populate fromf.Deploy.*increateAndApplyPipelineRunTemplateNotes
DeployerImageisscratch-based with no shell, so env vars are used instead of a bash script with conditional flag appending.func.yamlbefore remote deploy upload #3663, which fixed the same bug for the PVC-upload path.