Skip to content

Commit 02de763

Browse files
committed
Depend on the Kustomize API from fluxcd/pkg
Signed-off-by: Hidde Beydals <hello@hidde.co>
1 parent 975534b commit 02de763

9 files changed

Lines changed: 55 additions & 107 deletions

File tree

api/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ module github.com/fluxcd/kustomize-controller/api
33
go 1.15
44

55
require (
6+
github.com/fluxcd/pkg/apis/kustomize v0.0.1
67
github.com/fluxcd/pkg/apis/meta v0.7.0
78
github.com/fluxcd/pkg/runtime v0.8.0
9+
k8s.io/apiextensions-apiserver v0.20.2
810
k8s.io/apimachinery v0.20.2
911
sigs.k8s.io/controller-runtime v0.8.0
1012
)

api/go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
8888
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
8989
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
9090
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
91+
github.com/fluxcd/pkg/apis/kustomize v0.0.1 h1:TkA80R0GopRY27VJqzKyS6ifiKIAfwBd7OHXtV3t2CI=
92+
github.com/fluxcd/pkg/apis/kustomize v0.0.1/go.mod h1:JAFPfnRmcrAoG1gNiA8kmEXsnOBuDyZ/F5X4DAQcVV0=
9193
github.com/fluxcd/pkg/apis/meta v0.7.0 h1:5e8gm4OLqjuKWdrOIY5DEEsjcwzyJFK8rCDesJ+V8IY=
9294
github.com/fluxcd/pkg/apis/meta v0.7.0/go.mod h1:yHuY8kyGHYz22I0jQzqMMGCcHViuzC/WPdo9Gisk8Po=
9395
github.com/fluxcd/pkg/runtime v0.8.0 h1:cnSBZJLcXlKgjXpFFFExu+4ZncIxmPgNIx+ErLcCLnA=
@@ -634,21 +636,27 @@ k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo=
634636
k8s.io/api v0.20.2 h1:y/HR22XDZY3pniu9hIFDLpUCPq2w5eQ6aV/VFQ7uJMw=
635637
k8s.io/api v0.20.2/go.mod h1:d7n6Ehyzx+S+cE3VhTGfVNNqtGc/oL9DCdYYahlurV8=
636638
k8s.io/apiextensions-apiserver v0.20.1/go.mod h1:ntnrZV+6a3dB504qwC5PN/Yg9PBiDNt1EVqbW2kORVk=
639+
k8s.io/apiextensions-apiserver v0.20.2 h1:rfrMWQ87lhd8EzQWRnbQ4gXrniL/yTRBgYH1x1+BLlo=
640+
k8s.io/apiextensions-apiserver v0.20.2/go.mod h1:F6TXp389Xntt+LUq3vw6HFOLttPa0V8821ogLGwb6Zs=
637641
k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
638642
k8s.io/apimachinery v0.20.2 h1:hFx6Sbt1oG0n6DZ+g4bFt5f6BoMkOjKWsQFu077M3Vg=
639643
k8s.io/apimachinery v0.20.2/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU=
640644
k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU=
645+
k8s.io/apiserver v0.20.2/go.mod h1:2nKd93WyMhZx4Hp3RfgH2K5PhwyTrprrkWYnI7id7jA=
641646
k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y=
642647
k8s.io/client-go v0.20.2/go.mod h1:kH5brqWqp7HDxUFKoEgiI4v8G1xzbe9giaCenUWJzgE=
643648
k8s.io/code-generator v0.20.1/go.mod h1:UsqdF+VX4PU2g46NC2JRs4gc+IfrctnwHb76RNbWHJg=
649+
k8s.io/code-generator v0.20.2/go.mod h1:UsqdF+VX4PU2g46NC2JRs4gc+IfrctnwHb76RNbWHJg=
644650
k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk=
651+
k8s.io/component-base v0.20.2/go.mod h1:pzFtCiwe/ASD0iV7ySMu8SYVJjCapNM9bjvk7ptpKh0=
645652
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
646653
k8s.io/gengo v0.0.0-20201113003025-83324d819ded/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
647654
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
648655
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
649656
k8s.io/klog/v2 v2.4.0 h1:7+X0fUguPyrKEC4WjH8iGDg3laWgMo5tMnRTIGTTxGQ=
650657
k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
651658
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM=
659+
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 h1:CbnUZsM497iRC5QMVkHwyl8s2tB3g7yaSHkYPkpgelw=
652660
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
653661
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
654662
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=

api/v1beta1/kustomization_types.go

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2424
"k8s.io/apimachinery/pkg/types"
2525

26+
"github.com/fluxcd/pkg/apis/kustomize"
2627
"github.com/fluxcd/pkg/apis/meta"
2728
"github.com/fluxcd/pkg/runtime/dependency"
2829
)
@@ -74,9 +75,11 @@ type KustomizationSpec struct {
7475
// +optional
7576
HealthChecks []meta.NamespacedObjectKindReference `json:"healthChecks,omitempty"`
7677

77-
// A list of images used to override or set the name and tag for container images.
78+
// Images is a list of (image name, new name, new tag or digest)
79+
// for changing image names, tags or digests. This can also be achieved with a
80+
// patch, but this operator is simpler to specify.
7881
// +optional
79-
Images []Image `json:"images,omitempty"`
82+
Images []kustomize.Image `json:"images,omitempty"`
8083

8184
// The name of the Kubernetes service account to impersonate
8285
// when reconciling this Kustomization.
@@ -124,21 +127,6 @@ type Decryption struct {
124127
SecretRef *meta.LocalObjectReference `json:"secretRef,omitempty"`
125128
}
126129

127-
// Image contains the name, new name and new tag that will replace the original container image.
128-
type Image struct {
129-
// Name of the image to be replaced.
130-
// +required
131-
Name string `json:"name"`
132-
133-
// NewName is the name of the image used to replace the original one.
134-
// +required
135-
NewName string `json:"newName"`
136-
137-
// NewTag is the image tag used to replace the original tag.
138-
// +required
139-
NewTag string `json:"newTag"`
140-
}
141-
142130
// KubeConfig references a Kubernetes secret that contains a kubeconfig file.
143131
type KubeConfig struct {
144132
// SecretRef holds the name to a secret that contains a 'value' key with

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 3 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,27 +114,30 @@ spec:
114114
type: object
115115
type: array
116116
images:
117-
description: A list of images used to override or set the name and
118-
tag for container images.
117+
description: Images is a list of (image name, new name, new tag or
118+
digest) for changing image names, tags or digests. This can also
119+
be achieved with a patch, but this operator is simpler to specify.
119120
items:
120-
description: Image contains the name, new name and new tag that
121-
will replace the original container image.
121+
description: Image contains an image name, a new name, a new tag
122+
or digest, which will replace the original name and tag.
122123
properties:
124+
digest:
125+
description: Digest is the value used to replace the original
126+
image tag. If digest is present NewTag value is ignored.
127+
type: string
123128
name:
124-
description: Name of the image to be replaced.
129+
description: Name is a tag-less image name.
125130
type: string
126131
newName:
127-
description: NewName is the name of the image used to replace
128-
the original one.
132+
description: NewName is the value used to replace the original
133+
name.
129134
type: string
130135
newTag:
131-
description: NewTag is the image tag used to replace the original
136+
description: NewTag is the value used to replace the original
132137
tag.
133138
type: string
134139
required:
135140
- name
136-
- newName
137-
- newTag
138141
type: object
139142
type: array
140143
interval:

docs/api/kustomize.md

Lines changed: 10 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,16 @@ bool
185185
<td>
186186
<code>images</code><br>
187187
<em>
188-
<a href="#kustomize.toolkit.fluxcd.io/v1beta1.Image">
189-
[]Image
188+
<a href="https://godoc.org/github.com/fluxcd/pkg/apis/kustomize#Image">
189+
[]github.com/fluxcd/pkg/apis/kustomize.Image
190190
</a>
191191
</em>
192192
</td>
193193
<td>
194194
<em>(Optional)</em>
195-
<p>A list of images used to override or set the name and tag for container images.</p>
195+
<p>Images is a list of (image name, new name, new tag or digest)
196+
for changing image names, tags or digests. This can also be achieved with a
197+
patch, but this operator is simpler to specify.</p>
196198
</td>
197199
</tr>
198200
<tr>
@@ -408,60 +410,6 @@ github.com/fluxcd/pkg/apis/meta.LocalObjectReference
408410
</table>
409411
</div>
410412
</div>
411-
<h3 id="kustomize.toolkit.fluxcd.io/v1beta1.Image">Image
412-
</h3>
413-
<p>
414-
(<em>Appears on:</em>
415-
<a href="#kustomize.toolkit.fluxcd.io/v1beta1.KustomizationSpec">KustomizationSpec</a>)
416-
</p>
417-
<p>Image contains the name, new name and new tag that will replace the original container image.</p>
418-
<div class="md-typeset__scrollwrap">
419-
<div class="md-typeset__table">
420-
<table>
421-
<thead>
422-
<tr>
423-
<th>Field</th>
424-
<th>Description</th>
425-
</tr>
426-
</thead>
427-
<tbody>
428-
<tr>
429-
<td>
430-
<code>name</code><br>
431-
<em>
432-
string
433-
</em>
434-
</td>
435-
<td>
436-
<p>Name of the image to be replaced.</p>
437-
</td>
438-
</tr>
439-
<tr>
440-
<td>
441-
<code>newName</code><br>
442-
<em>
443-
string
444-
</em>
445-
</td>
446-
<td>
447-
<p>NewName is the name of the image used to replace the original one.</p>
448-
</td>
449-
</tr>
450-
<tr>
451-
<td>
452-
<code>newTag</code><br>
453-
<em>
454-
string
455-
</em>
456-
</td>
457-
<td>
458-
<p>NewTag is the image tag used to replace the original tag.</p>
459-
</td>
460-
</tr>
461-
</tbody>
462-
</table>
463-
</div>
464-
</div>
465413
<h3 id="kustomize.toolkit.fluxcd.io/v1beta1.KubeConfig">KubeConfig
466414
</h3>
467415
<p>
@@ -637,14 +585,16 @@ bool
637585
<td>
638586
<code>images</code><br>
639587
<em>
640-
<a href="#kustomize.toolkit.fluxcd.io/v1beta1.Image">
641-
[]Image
588+
<a href="https://godoc.org/github.com/fluxcd/pkg/apis/kustomize#Image">
589+
[]github.com/fluxcd/pkg/apis/kustomize.Image
642590
</a>
643591
</em>
644592
</td>
645593
<td>
646594
<em>(Optional)</em>
647-
<p>A list of images used to override or set the name and tag for container images.</p>
595+
<p>Images is a list of (image name, new name, new tag or digest)
596+
for changing image names, tags or digests. This can also be achieved with a
597+
patch, but this operator is simpler to specify.</p>
648598
</td>
649599
</tr>
650600
<tr>

go.sum

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwo
189189
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
190190
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
191191
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
192+
github.com/fluxcd/pkg/apis/kustomize v0.0.1 h1:TkA80R0GopRY27VJqzKyS6ifiKIAfwBd7OHXtV3t2CI=
193+
github.com/fluxcd/pkg/apis/kustomize v0.0.1/go.mod h1:JAFPfnRmcrAoG1gNiA8kmEXsnOBuDyZ/F5X4DAQcVV0=
192194
github.com/fluxcd/pkg/apis/meta v0.7.0 h1:5e8gm4OLqjuKWdrOIY5DEEsjcwzyJFK8rCDesJ+V8IY=
193195
github.com/fluxcd/pkg/apis/meta v0.7.0/go.mod h1:yHuY8kyGHYz22I0jQzqMMGCcHViuzC/WPdo9Gisk8Po=
194196
github.com/fluxcd/pkg/runtime v0.8.0 h1:cnSBZJLcXlKgjXpFFFExu+4ZncIxmPgNIx+ErLcCLnA=
@@ -1151,8 +1153,9 @@ k8s.io/api v0.20.2 h1:y/HR22XDZY3pniu9hIFDLpUCPq2w5eQ6aV/VFQ7uJMw=
11511153
k8s.io/api v0.20.2/go.mod h1:d7n6Ehyzx+S+cE3VhTGfVNNqtGc/oL9DCdYYahlurV8=
11521154
k8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783/go.mod h1:xvae1SZB3E17UpV59AWc271W/Ph25N+bjPyR63X6tPY=
11531155
k8s.io/apiextensions-apiserver v0.17.2/go.mod h1:4KdMpjkEjjDI2pPfBA15OscyNldHWdBCfsWMDWAmSTs=
1154-
k8s.io/apiextensions-apiserver v0.20.1 h1:ZrXQeslal+6zKM/HjDXLzThlz/vPSxrfK3OqL8txgVQ=
11551156
k8s.io/apiextensions-apiserver v0.20.1/go.mod h1:ntnrZV+6a3dB504qwC5PN/Yg9PBiDNt1EVqbW2kORVk=
1157+
k8s.io/apiextensions-apiserver v0.20.2 h1:rfrMWQ87lhd8EzQWRnbQ4gXrniL/yTRBgYH1x1+BLlo=
1158+
k8s.io/apiextensions-apiserver v0.20.2/go.mod h1:F6TXp389Xntt+LUq3vw6HFOLttPa0V8821ogLGwb6Zs=
11561159
k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655/go.mod h1:nL6pwRT8NgfF8TT68DBI8uEePRt89cSvoXUVqbkWHq4=
11571160
k8s.io/apimachinery v0.0.0-20191214185652-442f8fb2f03a/go.mod h1:Ng1IY8TS7sC44KJxT/WUR6qFRfWwahYYYpNXyYRKOCY=
11581161
k8s.io/apimachinery v0.0.0-20191216025728-0ee8b4573e3a/go.mod h1:Ng1IY8TS7sC44KJxT/WUR6qFRfWwahYYYpNXyYRKOCY=
@@ -1164,6 +1167,7 @@ k8s.io/apimachinery v0.20.2/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRp
11641167
k8s.io/apiserver v0.0.0-20190918160949-bfa5e2e684ad/go.mod h1:XPCXEwhjaFN29a8NldXA901ElnKeKLrLtREO9ZhFyhg=
11651168
k8s.io/apiserver v0.17.2/go.mod h1:lBmw/TtQdtxvrTk0e2cgtOxHizXI+d0mmGQURIHQZlo=
11661169
k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU=
1170+
k8s.io/apiserver v0.20.2/go.mod h1:2nKd93WyMhZx4Hp3RfgH2K5PhwyTrprrkWYnI7id7jA=
11671171
k8s.io/cli-runtime v0.0.0-20191214191754-e6dc6d5c8724/go.mod h1:wzlq80lvjgHW9if6MlE4OIGC86MDKsy5jtl9nxz/IYY=
11681172
k8s.io/cli-runtime v0.17.2/go.mod h1:aa8t9ziyQdbkuizkNLAw3qe3srSyWh9zlSB7zTqRNPI=
11691173
k8s.io/cli-runtime v0.20.2 h1:W0/FHdbApnl9oB7xdG643c/Zaf7TZT+43I+zKxwqvhU=
@@ -1180,11 +1184,13 @@ k8s.io/code-generator v0.0.0-20190912054826-cd179ad6a269/go.mod h1:V5BD6M4CyaN5m
11801184
k8s.io/code-generator v0.0.0-20191214185510-0b9b3c99f9f2/go.mod h1:BjGKcoq1MRUmcssvHiSxodCco1T6nVIt4YeCT5CMSao=
11811185
k8s.io/code-generator v0.17.2/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s=
11821186
k8s.io/code-generator v0.20.1/go.mod h1:UsqdF+VX4PU2g46NC2JRs4gc+IfrctnwHb76RNbWHJg=
1187+
k8s.io/code-generator v0.20.2/go.mod h1:UsqdF+VX4PU2g46NC2JRs4gc+IfrctnwHb76RNbWHJg=
11831188
k8s.io/component-base v0.0.0-20190918160511-547f6c5d7090/go.mod h1:933PBGtQFJky3TEwYx4aEPZ4IxqhWh3R6DCmzqIn1hA=
11841189
k8s.io/component-base v0.0.0-20191214190519-d868452632e2/go.mod h1:wupxkh1T/oUDqyTtcIjiEfpbmIHGm8By/vqpSKC6z8c=
11851190
k8s.io/component-base v0.17.2/go.mod h1:zMPW3g5aH7cHJpKYQ/ZsGMcgbsA/VyhEugF3QT1awLs=
1186-
k8s.io/component-base v0.20.1 h1:6OQaHr205NSl24t5wOF2IhdrlxZTWEZwuGlLvBgaeIg=
11871191
k8s.io/component-base v0.20.1/go.mod h1:guxkoJnNoh8LNrbtiQOlyp2Y2XFCZQmrcg2n/DeYNLk=
1192+
k8s.io/component-base v0.20.2 h1:LMmu5I0pLtwjpp5009KLuMGFqSc2S2isGw8t1hpYKLE=
1193+
k8s.io/component-base v0.20.2/go.mod h1:pzFtCiwe/ASD0iV7ySMu8SYVJjCapNM9bjvk7ptpKh0=
11881194
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
11891195
k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
11901196
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=

hack/api-docs/config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
"typeMatchPrefix": "^github.com/fluxcd/pkg/runtime/dependency\\.CrossNamespaceDependencyReference$",
2020
"docsURLTemplate": "https://godoc.org/github.com/fluxcd/pkg/runtime/dependency#CrossNamespaceDependencyReference"
2121
},
22+
{
23+
"typeMatchPrefix": "^github.com/fluxcd/pkg/apis/kustomize",
24+
"docsURLTemplate": "https://godoc.org/github.com/fluxcd/pkg/apis/kustomize#{{ .TypeIdentifier }}"
25+
},
2226
{
2327
"typeMatchPrefix": "^github.com/fluxcd/pkg/apis/meta",
2428
"docsURLTemplate": "https://godoc.org/github.com/fluxcd/pkg/apis/meta#{{ .TypeIdentifier }}"
@@ -28,6 +32,7 @@
2832
"k8s.io/api/": "Kubernetes ",
2933
"k8s.io/apimachinery/pkg/apis/": "Kubernetes ",
3034
"github.com/fluxcd/pkg/runtime/": "Runtime ",
35+
"github.com/fluxcd/pkg/apis/kustomize/": "Kustomize ",
3136
"github.com/fluxcd/pkg/apis/meta/": "Meta "
3237
},
3338
"markdownDisabled": false

hack/boilerplate.go.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020 The Flux authors
2+
Copyright 2021 The Flux authors
33

44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)