Skip to content

Commit 3a67f96

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

12 files changed

+79
-157
lines changed

api/go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/fluxcd/helm-controller/api
33
go 1.15
44

55
require (
6+
github.com/fluxcd/pkg/apis/kustomize v0.0.0-20210203170140-c9274a8cd235
67
github.com/fluxcd/pkg/apis/meta v0.7.0
78
github.com/fluxcd/pkg/runtime v0.6.2
89
k8s.io/apiextensions-apiserver v0.20.2

api/go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
113113
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
114114
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
115115
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
116+
github.com/fluxcd/pkg/apis/kustomize v0.0.0-20210203162456-8b60f01eda32 h1:1aMt0EQ7Wd6sJhH/VjNo2l9JvC24zNFi00XF7Hw/A6Q=
117+
github.com/fluxcd/pkg/apis/kustomize v0.0.0-20210203162456-8b60f01eda32/go.mod h1:JAFPfnRmcrAoG1gNiA8kmEXsnOBuDyZ/F5X4DAQcVV0=
118+
github.com/fluxcd/pkg/apis/kustomize v0.0.0-20210203170140-c9274a8cd235 h1:IBxiuFeaECdJKqBTEHPkQs4wybA9b3rSbRe7w2FAOvk=
119+
github.com/fluxcd/pkg/apis/kustomize v0.0.0-20210203170140-c9274a8cd235/go.mod h1:JAFPfnRmcrAoG1gNiA8kmEXsnOBuDyZ/F5X4DAQcVV0=
116120
github.com/fluxcd/pkg/apis/meta v0.5.0/go.mod h1:aEUuZIawboAAFLlYz/juVJ7KNmlWbBtJFYkOWWmGUR4=
117121
github.com/fluxcd/pkg/apis/meta v0.7.0 h1:5e8gm4OLqjuKWdrOIY5DEEsjcwzyJFK8rCDesJ+V8IY=
118122
github.com/fluxcd/pkg/apis/meta v0.7.0/go.mod h1:yHuY8kyGHYz22I0jQzqMMGCcHViuzC/WPdo9Gisk8Po=

api/v2beta1/helmrelease_types.go

+3-11
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,14 @@ import (
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2626
"k8s.io/apimachinery/pkg/types"
2727

28+
"github.com/fluxcd/pkg/apis/kustomize"
2829
"github.com/fluxcd/pkg/apis/meta"
2930
"github.com/fluxcd/pkg/runtime/dependency"
3031
)
3132

3233
const HelmReleaseKind = "HelmRelease"
3334
const HelmReleaseFinalizer = "finalizers.fluxcd.io"
3435

35-
// PatchJSON6902 contains a JSON patch and the target it applies to.
36-
type PatchJSON6902 struct {
37-
// Patch is the YAML content of a patch.
38-
Patch []apiextensionsv1.JSON `json:"patch,omitempty" yaml:"patch,omitempty"`
39-
40-
// Target points to the resources that the patch is applied to.
41-
Target Selector `json:"target,omitempty" yaml:"target,omitempty"`
42-
}
43-
4436
// Kustomize Helm PostRenderer specification.
4537
type Kustomize struct {
4638
// Strategic merge patches, defined as inline YAML objects.
@@ -49,13 +41,13 @@ type Kustomize struct {
4941

5042
// JSON 6902 patches, defined as inline YAML objects.
5143
// +optional
52-
PatchesJSON6902 []PatchJSON6902 `json:"patchesJson6902,omitempty"`
44+
PatchesJSON6902 []kustomize.JSON6902Patch `json:"patchesJson6902,omitempty"`
5345

5446
// Images is a list of (image name, new name, new tag or digest)
5547
// for changing image names, tags or digests. This can also be achieved with a
5648
// patch, but this operator is simpler to specify.
5749
// +optional
58-
Images []Image `json:"images,omitempty" yaml:"images,omitempty"`
50+
Images []kustomize.Image `json:"images,omitempty" yaml:"images,omitempty"`
5951
}
6052

6153
// PostRenderer contains a Helm PostRenderer specification.

api/v2beta1/kustomization_types.go

-65
This file was deleted.

api/v2beta1/zz_generated.deepcopy.go

+4-72
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controllers/helmrelease_types_test.go

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
1+
/*
2+
Copyright 2021 The Flux authors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package controllers
218

319
import (
420
"encoding/json"
521
"testing"
622

23+
"github.com/fluxcd/pkg/apis/kustomize"
24+
725
v2 "github.com/fluxcd/helm-controller/api/v2beta1"
826
)
927

1028
func TestHelmReleaseTypes_unmarshal_PatchJSON6902(t *testing.T) {
11-
var p v2.PatchJSON6902
29+
var p kustomize.JSON6902Patch
1230
err := json.Unmarshal([]byte(`{"target": {"namespace": "ns", "name": "x", "kind": "k", "version": "v"},"patch": [{"op": "add", "path": "/some/new/path", "value": "value"}]}`), &p)
1331
if err != nil {
1432
t.Error(err)

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ replace github.com/fluxcd/helm-controller/api => ./api
66

77
require (
88
github.com/fluxcd/helm-controller/api v0.6.1
9+
github.com/fluxcd/pkg/apis/kustomize v0.0.0-20210203170140-c9274a8cd235
910
github.com/fluxcd/pkg/apis/meta v0.7.0
1011
github.com/fluxcd/pkg/runtime v0.8.0
1112
github.com/fluxcd/source-controller/api v0.7.0

go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZM
241241
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
242242
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
243243
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
244+
github.com/fluxcd/pkg/apis/kustomize v0.0.0-20210203162456-8b60f01eda32 h1:1aMt0EQ7Wd6sJhH/VjNo2l9JvC24zNFi00XF7Hw/A6Q=
245+
github.com/fluxcd/pkg/apis/kustomize v0.0.0-20210203162456-8b60f01eda32/go.mod h1:JAFPfnRmcrAoG1gNiA8kmEXsnOBuDyZ/F5X4DAQcVV0=
246+
github.com/fluxcd/pkg/apis/kustomize v0.0.0-20210203170140-c9274a8cd235 h1:IBxiuFeaECdJKqBTEHPkQs4wybA9b3rSbRe7w2FAOvk=
247+
github.com/fluxcd/pkg/apis/kustomize v0.0.0-20210203170140-c9274a8cd235/go.mod h1:JAFPfnRmcrAoG1gNiA8kmEXsnOBuDyZ/F5X4DAQcVV0=
244248
github.com/fluxcd/pkg/apis/meta v0.5.0/go.mod h1:aEUuZIawboAAFLlYz/juVJ7KNmlWbBtJFYkOWWmGUR4=
245249
github.com/fluxcd/pkg/apis/meta v0.7.0 h1:5e8gm4OLqjuKWdrOIY5DEEsjcwzyJFK8rCDesJ+V8IY=
246250
github.com/fluxcd/pkg/apis/meta v0.7.0/go.mod h1:yHuY8kyGHYz22I0jQzqMMGCcHViuzC/WPdo9Gisk8Po=

hack/boilerplate.go.txt

+1-1
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.

internal/runner/post_renderer.go

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2021 The Flux authors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package runner
218

319
import (

internal/runner/post_renderer_kustomize.go

+25-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
1+
/*
2+
Copyright 2021 The Flux authors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package runner
218

319
import (
420
"bytes"
521
"encoding/json"
622

7-
v2 "github.com/fluxcd/helm-controller/api/v2beta1"
823
"sigs.k8s.io/kustomize/api/filesys"
924
"sigs.k8s.io/kustomize/api/konfig"
1025
"sigs.k8s.io/kustomize/api/krusty"
1126
kustypes "sigs.k8s.io/kustomize/api/types"
27+
28+
"github.com/fluxcd/pkg/apis/kustomize"
29+
30+
v2 "github.com/fluxcd/helm-controller/api/v2beta1"
1231
)
1332

1433
type postRendererKustomize struct {
@@ -45,7 +64,7 @@ func writeFile(fs filesys.FileSystem, path string, content *bytes.Buffer) error
4564
return nil
4665
}
4766

48-
func adaptImages(images []v2.Image) (output []kustypes.Image) {
67+
func adaptImages(images []kustomize.Image) (output []kustypes.Image) {
4968
for _, image := range images {
5069
output = append(output, kustypes.Image{
5170
Name: image.Name,
@@ -57,12 +76,12 @@ func adaptImages(images []v2.Image) (output []kustypes.Image) {
5776
return
5877
}
5978

60-
func adaptSelector(selector *v2.Selector) (output *kustypes.Selector) {
79+
func adaptSelector(selector *kustomize.Selector) (output *kustypes.Selector) {
6180
if selector != nil {
6281
output = &kustypes.Selector{}
63-
output.Gvk.Group = selector.Gvk.Group
64-
output.Gvk.Kind = selector.Gvk.Kind
65-
output.Gvk.Version = selector.Gvk.Version
82+
output.Gvk.Group = selector.Group
83+
output.Gvk.Kind = selector.Kind
84+
output.Gvk.Version = selector.Version
6685
output.Name = selector.Name
6786
output.Namespace = selector.Namespace
6887
output.LabelSelector = selector.LabelSelector

0 commit comments

Comments
 (0)