Update kustomize image
Recipe ID
org.openrewrite.kubernetes.kustomize.UpdateImageTagArtifactorg.openrewrite.recipe:rewrite-kubernetesUpdate the newName, newTag or digest of an entry in a kustomization's images block, which is where kustomize edit set image and the sed, yq and Python scripts that stand in for it write an image pin. Only an entry that is already there is updated; an image the kustomization does not already override is left alone rather than added. A commented out entry stays a comment.
Single recipeProprietary
Usage
You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.kubernetes.kustomize.UpdateImageTag --recipe-option "imageName=controller"If the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-kubernetes:RELEASEOptions
| Name | Type | Description |
|---|---|---|
imageNamerequired | String | The name of the images entry to update, which is the image as it is written in the resources being overlaid rather than the image it is replaced with.e.g. controller |
newName | String | The image name to override with. Leave unset to change only the tag or digest. e.g. ghcr.io/telekom/das-schiff-network-operator |
newTag | String | The tag to override with. Mutually exclusive with digest, so setting it removes a digest the entry already has.e.g. v1.2.3 |
digest | String | The digest to override with, including its sha256: prefix. Mutually exclusive with newTag, so setting it removes a newTag the entry already has.e.g. sha256:cb5c1bddd1b5665e1867a7fa1b5fa843a47ee433bbb75d4293888b71def53229 |
fileMatcher | String | Matching files will be modified. This is a glob expression. When omitted, the file names kustomize itself recognizes are matched: kustomization.yaml, kustomization.yml and Kustomization.e.g. **/overlays/**/kustomization.yaml |
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats