Skip to content

Commit

Permalink
Add image type to API spec
Browse files Browse the repository at this point in the history
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
  • Loading branch information
somtochiama committed Dec 9, 2020
1 parent cf8bf1f commit d0b87cc
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 0 deletions.
19 changes: 19 additions & 0 deletions api/v1beta1/kustomization_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ type KustomizationSpec struct {
// +optional
HealthChecks []CrossNamespaceObjectReference `json:"healthChecks,omitempty"`

// A list of images that is used for changing the image name/tag in the kustomization yaml.
// +optional
Images []Image `json:"images,omitempty"`

// The name of the Kubernetes service account to impersonate
// when reconciling this Kustomization.
// +optional
Expand Down Expand Up @@ -113,6 +117,21 @@ type Decryption struct {
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
}

// Image contains the name, new name and new tag that will replace the original image.
type Image struct {
// Name of the image to be replaced.
// +required
Name string `json:"name"`

// NewName is the name of the image used to replace the original one.
// +required
NewName string `json:"newName"`

// NewTag is the tag used to replace the original tag.
// +required
NewTag string `json:"newTag"`
}

// KubeConfig references a Kubernetes secret that contains a kubeconfig file.
type KubeConfig struct {
// SecretRef holds the name to a secret that contains a 'value' key with
Expand Down
20 changes: 20 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,30 @@ spec:
- name
type: object
type: array
images:
description: A list of images that is used for changing the image
name/tag in the kustomization yaml.
items:
description: Image contains the name, new name and new tag that
will replace the original image.
properties:
name:
description: Name of the image to be replaced.
type: string
newName:
description: NewName is the name of the image used to replace
the original one.
type: string
newTag:
description: NewTag is the tag used to replace the original
tag.
type: string
required:
- name
- newName
- newTag
type: object
type: array
interval:
description: The interval at which to reconcile the kustomization.
type: string
Expand Down
82 changes: 82 additions & 0 deletions docs/api/kustomize.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,20 @@ bool
</tr>
<tr>
<td>
<code>images</code><br>
<em>
<a href="#kustomize.toolkit.fluxcd.io/v1beta1.Image">
[]Image
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>A list of images that is used for changing the image name/tag in the kustomization yaml.</p>
</td>
</tr>
<tr>
<td>
<code>serviceAccountName</code><br>
<em>
string
Expand Down Expand Up @@ -443,6 +457,60 @@ Kubernetes core/v1.LocalObjectReference
</table>
</div>
</div>
<h3 id="kustomize.toolkit.fluxcd.io/v1beta1.Image">Image
</h3>
<p>
(<em>Appears on:</em>
<a href="#kustomize.toolkit.fluxcd.io/v1beta1.KustomizationSpec">KustomizationSpec</a>)
</p>
<p>Image contains the name, new name and new tag that will replace the original image.</p>
<div class="md-typeset__scrollwrap">
<div class="md-typeset__table">
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>name</code><br>
<em>
string
</em>
</td>
<td>
<p>Name of the image to be replaced.</p>
</td>
</tr>
<tr>
<td>
<code>newName</code><br>
<em>
string
</em>
</td>
<td>
<p>NewName is the name of the image used to replace the original one.</p>
</td>
</tr>
<tr>
<td>
<code>newTag</code><br>
<em>
string
</em>
</td>
<td>
<p>NewTag is the tag used to replace the original tag.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3 id="kustomize.toolkit.fluxcd.io/v1beta1.KubeConfig">KubeConfig
</h3>
<p>
Expand Down Expand Up @@ -597,6 +665,20 @@ bool
</tr>
<tr>
<td>
<code>images</code><br>
<em>
<a href="#kustomize.toolkit.fluxcd.io/v1beta1.Image">
[]Image
</a>
</em>
</td>
<td>
<em>(Optional)</em>
<p>A list of images that is used for changing the image name/tag in the kustomization yaml.</p>
</td>
</tr>
<tr>
<td>
<code>serviceAccountName</code><br>
<em>
string
Expand Down

0 comments on commit d0b87cc

Please sign in to comment.