feat(cli): add gc command to manage IntegrationKits #3979
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi all,
This PR proposes a solution at our IntegrationKit cleanup problem (see #2736, #254).
This adds a new

gccommand in the kamel CLI that will cleanup unused integration kits. For example, in @joes use case, runningkamel gc -rywith Image Repository rights will result in the following IntegrationKit hierarchy:Images will be deleted from the Image repository and intermediate layers in
camel-k-kit-c68qat0oipt5te3mr3h0will be squashed into a single layer . This will trigger the integration camel-integration-platform/oep-invoices to be redeployed with the new squashed image.If we don't have Image Repository delete rights then only the unused Integration Kits CRs will be removed. An integration kit is considered unused if not referenced by an integration.
The command will return an error if new IntegrationKits are being built.
This eventually should be running in the Operator but for more control and awaiting initial feedback, it's only in the CLI.
kamel kit gcif no other resources are being garbage collectedThis begs the question of how far we want to go with this? Do we want to simply delete IntegrationKit CRs or do we want to also manage the Images ? I added an option to switch between the two strategies but the bulk of the code is for managing images.
Proposal #2:
A completely different way of dealing with this would be to add a
--devoption when running integrations. This would put the integration and integrationkit into adevstate:devstate can not be used as a base image due to it's changing natureRemoving the
devstate would revert to the current behavior. I feel like this approach goes well with CI/CD and should results in less complexity.All in all #2 seems like a better way of dealing with the issue but the two solutions aren't necessarily mutually exclusive.
Let me know what you think ! Thanks!
Release Note