Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
deps: align ginkgo CLI to lib, use available helm-operator-plugins AP…
Browse files Browse the repository at this point in the history
…I improvements

Signed-off-by: Joe Lanford <[email protected]>
  • Loading branch information
joelanford committed Apr 9, 2024
1 parent 08f272f commit 3277fda
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 36 deletions.
6 changes: 3 additions & 3 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ $(CONTROLLER_GEN): $(BINGO_DIR)/controller-gen.mod
@echo "(re)installing $(GOBIN)/controller-gen-v0.14.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=controller-gen.mod -o=$(GOBIN)/controller-gen-v0.14.0 "sigs.k8s.io/controller-tools/cmd/controller-gen"

GINKGO := $(GOBIN)/ginkgo-v2.15.0
GINKGO := $(GOBIN)/ginkgo-v2.17.1
$(GINKGO): $(BINGO_DIR)/ginkgo.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/ginkgo-v2.15.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=ginkgo.mod -o=$(GOBIN)/ginkgo-v2.15.0 "github.com/onsi/ginkgo/v2/ginkgo"
@echo "(re)installing $(GOBIN)/ginkgo-v2.17.1"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=ginkgo.mod -o=$(GOBIN)/ginkgo-v2.17.1 "github.com/onsi/ginkgo/v2/ginkgo"

GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.53.2
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
Expand Down
2 changes: 1 addition & 1 deletion .bingo/ginkgo.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.20

require github.com/onsi/ginkgo/v2 v2.15.0 // ginkgo
require github.com/onsi/ginkgo/v2 v2.17.1 // ginkgo
4 changes: 4 additions & 0 deletions .bingo/ginkgo.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ github.com/onsi/ginkgo/v2 v2.14.0 h1:vSmGj2Z5YPb9JwCWT6z6ihcUvDhuXLc3sJiqd3jMKAY
github.com/onsi/ginkgo/v2 v2.14.0/go.mod h1:JkUdW7JkN0V6rFvsHcJ478egV3XH9NxpD27Hal/PhZw=
github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY=
github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM=
github.com/onsi/ginkgo/v2 v2.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8=
github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
Expand All @@ -35,6 +37,8 @@ golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA=
golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc=
golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion .bingo/variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BINGO="${GOBIN}/bingo-v0.8.0"

CONTROLLER_GEN="${GOBIN}/controller-gen-v0.14.0"

GINKGO="${GOBIN}/ginkgo-v2.15.0"
GINKGO="${GOBIN}/ginkgo-v2.17.1"

GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.53.2"

Expand Down
24 changes: 3 additions & 21 deletions internal/controllers/bundledeployment/bundledeployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,7 @@ func (c *controller) reconcile(ctx context.Context, bd *rukpakv1alpha2.BundleDep
rel, err = cl.Install(bd.Name, c.releaseNamespace, chrt, values, func(install *action.Install) error {
install.CreateNamespace = false
return nil
},
// To be refactored issue https://github.com/operator-framework/rukpak/issues/534
func(install *action.Install) error {
post.cascade = install.PostRenderer
install.PostRenderer = post
return nil
})
}, helmclient.AppendInstallPostRenderer(post))
if err != nil {
if isResourceNotFoundErr(err) {
err = errRequiredResourceNotFound{err}
Expand All @@ -347,13 +341,7 @@ func (c *controller) reconcile(ctx context.Context, bd *rukpakv1alpha2.BundleDep
return ctrl.Result{}, err
}
case stateNeedsUpgrade:
rel, err = cl.Upgrade(bd.Name, c.releaseNamespace, chrt, values,
// To be refactored issue https://github.com/operator-framework/rukpak/issues/534
func(upgrade *action.Upgrade) error {
post.cascade = upgrade.PostRenderer
upgrade.PostRenderer = post
return nil
})
rel, err = cl.Upgrade(bd.Name, c.releaseNamespace, chrt, values, helmclient.AppendUpgradePostRenderer(post))
if err != nil {
if isResourceNotFoundErr(err) {
err = errRequiredResourceNotFound{err}
Expand Down Expand Up @@ -475,13 +463,7 @@ func (c *controller) getReleaseState(cl helmclient.ActionInterface, obj metav1.O
desiredRelease, err := cl.Upgrade(obj.GetName(), c.releaseNamespace, chrt, values, func(upgrade *action.Upgrade) error {
upgrade.DryRun = true
return nil
},
// To be refactored issue https://github.com/operator-framework/rukpak/issues/534
func(upgrade *action.Upgrade) error {
post.cascade = upgrade.PostRenderer
upgrade.PostRenderer = post
return nil
})
}, helmclient.AppendUpgradePostRenderer(post))
if err != nil {
return currentRelease, stateError, err
}
Expand Down
10 changes: 3 additions & 7 deletions internal/provisioner/plain/plain.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ const (
manifestsDir = "manifests"
)

func HandleBundleDeployment(_ context.Context, fsys fs.FS, bd *rukpakv1alpha2.BundleDeployment) (*chart.Chart, chartutil.Values, error) {
func HandleBundleDeployment(_ context.Context, fsys fs.FS, _ *rukpakv1alpha2.BundleDeployment) (*chart.Chart, chartutil.Values, error) {
if err := ValidateBundle(fsys); err != nil {
return nil, nil, err
}

chrt, err := chartFromBundle(fsys, bd)
chrt, err := chartFromBundle(fsys)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -78,7 +78,7 @@ func getObjects(bundle fs.FS, manifest fs.DirEntry) ([]client.Object, error) {
return util.ManifestObjects(manifestReader, manifestPath)
}

func chartFromBundle(fsys fs.FS, bd *rukpakv1alpha2.BundleDeployment) (*chart.Chart, error) {
func chartFromBundle(fsys fs.FS) (*chart.Chart, error) {
objects, err := getBundleObjects(fsys)
if err != nil {
return nil, fmt.Errorf("read bundle objects from bundle: %v", err)
Expand All @@ -88,10 +88,6 @@ func chartFromBundle(fsys fs.FS, bd *rukpakv1alpha2.BundleDeployment) (*chart.Ch
Metadata: &chart.Metadata{},
}
for _, obj := range objects {
obj.SetLabels(util.MergeMaps(obj.GetLabels(), map[string]string{
util.CoreOwnerKindKey: rukpakv1alpha2.BundleDeploymentKind,
util.CoreOwnerNameKey: bd.Name,
}))
yamlData, err := yaml.Marshal(obj)
if err != nil {
return nil, err
Expand Down
5 changes: 2 additions & 3 deletions internal/util/labels.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package util

const (
CoreOwnerKindKey = "core.rukpak.io/owner-kind"
CoreOwnerNameKey = "core.rukpak.io/owner-name"
CoreBundleTemplateHashKey = "core.rukpak.io/bundle-template-hash"
CoreOwnerKindKey = "core.rukpak.io/owner-kind"
CoreOwnerNameKey = "core.rukpak.io/owner-name"
)

0 comments on commit 3277fda

Please sign in to comment.