Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup orphaned func, new image-name calculation #1962

Merged
merged 53 commits into from
Feb 27, 2024

Conversation

gauron99
Copy link
Contributor

@gauron99 gauron99 commented Sep 4, 2023

Changes

  • 🧹 Delete old image on ns change
  • Add new image field in deploy section - recalculate image name unless it was explicitly given

Whats new

  1. In case user explicitly specifies --namespace in a subsequent func deploy, the "old" func deployed will be deleted after the new one is deployed successfully.
  2. New field added as .Build.Image which will serve as the new .Image currently with few changes. -> this serves as further following the idea that Func.yaml shouldnt be possibly manipulated with at all (.Build fields shouldnt be manipulated with now same as .Deploy).
  • Instead the .Image now is empty UNLESS its specified by user using --image flag in which case it will be used in all subsequent builds because by specifying this flag user says "I know what Im doing" and no image name calculation will be performed.
  1. new field in runtime metadata directory .func/ called built-image now serves as runtime last built image name. Once pushed this also contains a sha (This is temporary, either will be fixed in this PR or separately. -- the issue is that sha is fetched from Push action instead of Build, where it should be possible to get it)

  1. Namespace structure updated: Now f.Namespace describes namespace TO BE deployed in (user defined) and f.Deploy.Namespace describes namespace Function WAS deployed in; in other words, one is the desired namespace and the other is the current status, where the Function is already deployed.

additional

new error definitions
test updates and fixups to fit new structures

TODO

  • fix new errors in tests

/kind cleanup

Fixes #1953

@knative-prow
Copy link

knative-prow bot commented Sep 4, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@knative-prow knative-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Sep 4, 2023
@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 4, 2023
@gauron99 gauron99 changed the title forced namespace change, deletes old func, kind works Cleanup orphaned func, new image-name calculation Sep 4, 2023
@matejvasek matejvasek requested review from lkingland and matejvasek and removed request for navidshaikh September 4, 2023 12:51
@codecov
Copy link

codecov bot commented Sep 4, 2023

Codecov Report

Attention: Patch coverage is 68.78453% with 113 lines in your changes are missing coverage. Please review.

Project coverage is 63.21%. Comparing base (b97d841) to head (483bd36).
Report is 7 commits behind head on main.

❗ Current head 483bd36 differs from pull request most recent head 5cb7e1a. Consider uploading reports for the commit 5cb7e1a to get more accurate results

Files Patch % Lines
pkg/functions/client.go 56.57% 23 Missing and 10 partials ⚠️
pkg/pipelines/tekton/pipelines_provider.go 50.94% 24 Missing and 2 partials ⚠️
pkg/functions/function.go 74.57% 10 Missing and 5 partials ⚠️
cmd/deploy.go 81.81% 8 Missing and 4 partials ⚠️
pkg/knative/remover.go 40.00% 5 Missing and 1 partial ⚠️
pkg/k8s/persistent_volumes.go 0.00% 4 Missing and 1 partial ⚠️
pkg/pipelines/tekton/client.go 28.57% 4 Missing and 1 partial ⚠️
pkg/pipelines/tekton/pac/client.go 44.44% 4 Missing and 1 partial ⚠️
cmd/build.go 0.00% 1 Missing ⚠️
pkg/docker/pusher.go 80.00% 0 Missing and 1 partial ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1962      +/-   ##
==========================================
- Coverage   64.21%   63.21%   -1.01%     
==========================================
  Files         108      108              
  Lines       13918    14026     +108     
==========================================
- Hits         8937     8866      -71     
- Misses       4108     4282     +174     
- Partials      873      878       +5     
Flag Coverage Δ
e2e-test 37.36% <38.95%> (-0.02%) ⬇️
e2e-test-oncluster 30.66% <43.09%> (+0.16%) ⬆️
e2e-test-oncluster-runtime 26.85% <25.69%> (?)
e2e-test-runtime-go 25.66% <35.08%> (?)
e2e-test-runtime-node 26.66% <35.63%> (?)
e2e-test-runtime-python 26.66% <35.63%> (?)
e2e-test-runtime-quarkus 26.78% <35.63%> (?)
e2e-test-runtime-rust 25.68% <35.08%> (?)
e2e-test-runtime-springboot 25.81% <35.08%> (?)
e2e-test-runtime-typescript 26.78% <35.63%> (?)
integration-tests ?
unit-tests-macos-latest 48.93% <52.69%> (+0.08%) ⬆️
unit-tests-ubuntu-latest 49.67% <52.69%> (+0.08%) ⬆️
unit-tests-windows-latest 48.98% <52.97%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@knative-prow knative-prow bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 6, 2023
cmd/deploy.go Outdated Show resolved Hide resolved
cmd/deploy.go Outdated Show resolved Hide resolved
pkg/knative/integration_test.go Show resolved Hide resolved
@gauron99 gauron99 marked this pull request as ready for review December 13, 2023 09:47
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 13, 2023
@knative-prow knative-prow bot requested review from nainaz and rhuss December 13, 2023 09:47
@knative-prow knative-prow bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 15, 2023
@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 18, 2023
Copy link
Member

@lkingland lkingland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great, and all the pertinent tests are passing! (a couple of timeouts notwithstanding).

I requested a couple small changes moving logic around, but generally looks GTG to me! 🥳

cmd/deploy.go Outdated Show resolved Hide resolved
cmd/deploy.go Outdated Show resolved Hide resolved
cmd/deploy.go Outdated Show resolved Hide resolved
cmd/deploy.go Show resolved Hide resolved
cmd/deploy.go Outdated Show resolved Hide resolved
cmd/root.go Show resolved Hide resolved
pkg/functions/client_test.go Outdated Show resolved Hide resolved
pkg/functions/client_test.go Outdated Show resolved Hide resolved
pkg/functions/function.go Outdated Show resolved Hide resolved
pkg/knative/integration_test.go Show resolved Hide resolved
Signed-off-by: gauron99 <[email protected]>
Signed-off-by: gauron99 <[email protected]>
Signed-off-by: gauron99 <[email protected]>
Signed-off-by: gauron99 <[email protected]>
Signed-off-by: gauron99 <[email protected]>
Signed-off-by: gauron99 <[email protected]>
@knative-prow knative-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 27, 2024
Copy link
Member

@lkingland lkingland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Feb 27, 2024
Copy link

knative-prow bot commented Feb 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gauron99, lkingland

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot merged commit 7e95ca2 into knative:main Feb 27, 2024
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Cleanup orphaned Function instance on namespace change
3 participants