Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
Controller-runtime has been updated to `v0.9.0`, K8s dependencies to
`v0.21.1`, and all `fluxcd/pkg` and other dependencies to the versions
that have matching dependencies and/or build constraints.

This includes an update of Helm to `v3.6.0`, and an update of the
Kustomize API to match `v4.1.x`.

Signed-off-by: Hidde Beydals <[email protected]>
  • Loading branch information
hiddeco committed Jun 9, 2021
1 parent 0c8958d commit 44ea1d9
Show file tree
Hide file tree
Showing 9 changed files with 461 additions and 731 deletions.
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
12 changes: 6 additions & 6 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/fluxcd/helm-controller/api
go 1.15

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
29 changes: 15 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@ 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)
}
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 44ea1d9

Please sign in to comment.