Skip to content

Commit

Permalink
Merge pull request #273 from fluxcd/update-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddeco authored Jun 9, 2021
2 parents 0c8958d + 5f3d3ec commit 92b8183
Show file tree
Hide file tree
Showing 12 changed files with 467 additions and 737 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.15.x
go-version: 1.16.x
- name: Setup Kubernetes
uses: engineerd/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Docker buildkit multi-arch build requires golang alpine
FROM golang:1.15-alpine as builder
FROM golang:1.16-alpine as builder

WORKDIR /workspace

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ ifeq (, $(shell which controller-gen))
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1 ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.5.0 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
Expand All @@ -112,7 +112,7 @@ ifeq (, $(shell which gen-crd-api-reference-docs))
API_REF_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$API_REF_GEN_TMP_DIR ;\
go mod init tmp ;\
go get github.com/ahmetb/gen-crd-api-reference-docs@v0.2.0 ;\
go get github.com/ahmetb/gen-crd-api-reference-docs@v0.3.0 ;\
rm -rf $$API_REF_GEN_TMP_DIR ;\
}
API_REF_GEN=$(GOBIN)/gen-crd-api-reference-docs
Expand Down
14 changes: 7 additions & 7 deletions api/go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/fluxcd/helm-controller/api

go 1.15
go 1.16

require (
github.com/fluxcd/pkg/apis/kustomize v0.0.1
github.com/fluxcd/pkg/apis/meta v0.9.0
github.com/fluxcd/pkg/runtime v0.11.0
k8s.io/apiextensions-apiserver v0.20.2
k8s.io/apimachinery v0.20.2
sigs.k8s.io/controller-runtime v0.8.3
github.com/fluxcd/pkg/apis/kustomize v0.1.0
github.com/fluxcd/pkg/apis/meta v0.10.0
github.com/fluxcd/pkg/runtime v0.12.0
k8s.io/apiextensions-apiserver v0.21.1
k8s.io/apimachinery v0.21.1
sigs.k8s.io/controller-runtime v0.9.0
)
207 changes: 124 additions & 83 deletions api/go.sum

Large diffs are not rendered by default.

414 changes: 105 additions & 309 deletions config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: helm-system
resources:
- https://github.com/fluxcd/source-controller/releases/download/v0.12.2/source-controller.crds.yaml
- https://github.com/fluxcd/source-controller/releases/download/v0.12.2/source-controller.deployment.yaml
- https://github.com/fluxcd/source-controller/releases/download/v0.14.0/source-controller.crds.yaml
- https://github.com/fluxcd/source-controller/releases/download/v0.14.0/source-controller.deployment.yaml
- ../crd
- ../rbac
- ../manager
Expand Down
31 changes: 16 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
module github.com/fluxcd/helm-controller

go 1.15
go 1.16

replace github.com/fluxcd/helm-controller/api => ./api

require (
github.com/fluxcd/helm-controller/api v0.10.1
github.com/fluxcd/pkg/apis/kustomize v0.0.1
github.com/fluxcd/pkg/apis/meta v0.9.0
github.com/fluxcd/pkg/runtime v0.11.0
github.com/fluxcd/source-controller/api v0.12.2
github.com/fluxcd/pkg/apis/kustomize v0.1.0
github.com/fluxcd/pkg/apis/meta v0.10.0
github.com/fluxcd/pkg/runtime v0.12.0
github.com/fluxcd/source-controller/api v0.14.0
github.com/go-logr/logr v0.4.0
github.com/hashicorp/go-retryablehttp v0.6.8
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.13.0
github.com/spf13/pflag v1.0.5
helm.sh/helm/v3 v3.5.4
k8s.io/api v0.20.4
k8s.io/apiextensions-apiserver v0.20.4
k8s.io/apimachinery v0.20.4
k8s.io/cli-runtime v0.20.4
k8s.io/client-go v0.20.4
sigs.k8s.io/controller-runtime v0.8.3
sigs.k8s.io/kustomize/api v0.7.2
helm.sh/helm/v3 v3.6.0
k8s.io/api v0.21.1
k8s.io/apiextensions-apiserver v0.21.1
k8s.io/apimachinery v0.21.1
k8s.io/cli-runtime v0.21.1
k8s.io/client-go v0.21.1
sigs.k8s.io/controller-runtime v0.9.0
sigs.k8s.io/kustomize/api v0.8.8
sigs.k8s.io/yaml v1.2.0
)

Expand Down
485 changes: 188 additions & 297 deletions go.sum

Large diffs are not rendered by default.

30 changes: 16 additions & 14 deletions internal/runner/post_renderer_kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package runner
import (
"bytes"
"encoding/json"
"sync"

"sigs.k8s.io/kustomize/api/filesys"
"sigs.k8s.io/kustomize/api/konfig"
"sigs.k8s.io/kustomize/api/krusty"
"sigs.k8s.io/kustomize/api/resmap"
kustypes "sigs.k8s.io/kustomize/api/types"
Expand Down Expand Up @@ -141,25 +141,27 @@ func (k *postRendererKustomize) Run(renderedManifests *bytes.Buffer) (modifiedMa
return bytes.NewBuffer(yaml), nil
}

// TODO: remove mutex when kustomize fixes the concurrent map read/write panic
var kustomizeRenderMutex sync.Mutex

// buildKustomization wraps krusty.MakeKustomizer with the following settings:
// - disable kyaml due to critical bugs like:
// - https://github.com/kubernetes-sigs/kustomize/issues/3446
// - https://github.com/kubernetes-sigs/kustomize/issues/3480
// - reorder the resources just before output (Namespaces and Cluster roles/role bindings first, CRDs before CRs, Webhooks last)
// - load files from outside the kustomization.yaml root
// - disable plugins except for the builtin ones
// - prohibit changes to resourceIds, patch name/kind don't overwrite target name/kind
func buildKustomization(fs filesys.FileSystem, dirPath string) (resmap.ResMap, error) {
// Temporary workaround for concurrent map read and map write bug
// https://github.com/kubernetes-sigs/kustomize/issues/3659
kustomizeRenderMutex.Lock()
defer kustomizeRenderMutex.Unlock()

buildOptions := &krusty.Options{
UseKyaml: false,
DoLegacyResourceSort: true,
LoadRestrictions: kustypes.LoadRestrictionsNone,
AddManagedbyLabel: false,
DoPrune: false,
PluginConfig: konfig.DisabledPluginConfig(),
AllowResourceIdChanges: false,
DoLegacyResourceSort: true,
LoadRestrictions: kustypes.LoadRestrictionsNone,
AddManagedbyLabel: false,
DoPrune: false,
PluginConfig: kustypes.DisabledPluginConfig(),
}

k := krusty.MakeKustomizer(fs, buildOptions)
return k.Run(dirPath)
k := krusty.MakeKustomizer(buildOptions)
return k.Run(fs, dirPath)
}
4 changes: 2 additions & 2 deletions internal/runner/post_renderer_kustomize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ spec:
kind: Pod
metadata:
annotations:
d: 42
e: 42
d: "42"
e: "42"
name: json6902
`,
},
Expand Down
7 changes: 3 additions & 4 deletions internal/runner/post_renderer_origin_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ import (
"fmt"

"sigs.k8s.io/kustomize/api/builtins"
"sigs.k8s.io/kustomize/api/k8sdeps/kunstruct"
"sigs.k8s.io/kustomize/api/provider"
"sigs.k8s.io/kustomize/api/resmap"
"sigs.k8s.io/kustomize/api/resource"
kustypes "sigs.k8s.io/kustomize/api/types"

v2 "github.com/fluxcd/helm-controller/api/v2beta1"
Expand All @@ -42,8 +41,8 @@ type postRendererOriginLabels struct {
}

func (k *postRendererOriginLabels) Run(renderedManifests *bytes.Buffer) (modifiedManifests *bytes.Buffer, err error) {
resFactory := resource.NewFactory(kunstruct.NewKunstructuredFactoryImpl())
resMapFactory := resmap.NewFactory(resFactory, nil)
resFactory := provider.NewDefaultDepProvider().GetResourceFactory()
resMapFactory := resmap.NewFactory(resFactory)

resMap, err := resMapFactory.NewResMapFromBytes(renderedManifests.Bytes())
if err != nil {
Expand Down

0 comments on commit 92b8183

Please sign in to comment.