Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@
- The methods `ctx.GetOperatorNamespace()` and `ctx.GetWatchNamespace()` was added `pkg/test` in order to replace `ctx.GetNamespace()` which is deprecated. ([#2617](https://github.com/operator-framework/operator-sdk/pull/2617))
- The `--crd-version` flag was added to the `new`, `add api`, `add crd`, and `generate crds` commands so that users can opt-in to `v1` CRDs. ([#2684](https://github.com/operator-framework/operator-sdk/pull/2684))
- The printout for the compatible Kubernetes Version [#2446](https://github.com/operator-framework/operator-sdk/pull/2446)
- The `--output-dir` flag instructs [`operator-sdk bundle create`](./doc/cli/operator-sdk_bundle_create.md) to write manifests and metadata to a non-default directory. ([#2715](https://github.com/operator-framework/operator-sdk/pull/2715))
- The `--overwrite` flag instructs [`operator-sdk bundle create`](./doc/cli/operator-sdk_bundle_create.md) to overwrite metadata, manifests, and `bundle.Dockerfile`. ([#2715](https://github.com/operator-framework/operator-sdk/pull/2715))

### Changed

- The scorecard when creating a Custom Resource, will produce a message to the user if that CR already exists. ([#2683](https://github.com/operator-framework/operator-sdk/pull/2683))
- Upgrade Kubernetes dependency versions from `v1.16.2` to `v1.17.4`. ([#2715](https://github.com/operator-framework/operator-sdk/pull/2715))
- Upgrade `controller-runtime` version from `v0.4.0` to `v0.5.2`. ([#2715](https://github.com/operator-framework/operator-sdk/pull/2715))
- Upgrade `controller-tools` version from `v0.2.4` to `v0.2.8`. ([#2715](https://github.com/operator-framework/operator-sdk/pull/2715))
- Upgrade `helm` version from `v3.0.2` to `v3.1.2`. ([#2715](https://github.com/operator-framework/operator-sdk/pull/2715))
- Upgrade `prometheus-operator` version from `v0.34.0` to `v0.38.0`. ([#2715](https://github.com/operator-framework/operator-sdk/pull/2715))
- Upgrade `operator-registry` version from `v1.5.7`to `v1.6.2`. ([#2715](https://github.com/operator-framework/operator-sdk/pull/2715))
- **Breaking Change:** [`operator-sdk bundle create`](./doc/cli/operator-sdk_bundle_create.md) now creates a `manifests/` directory under the parent directory of the argument passed to `--directory`, and setting `--generate-only=true` writes a Dockerfile to `<project-root>/bundle.Dockerfile` that copies bundle manifests from that `manifests/` directory. ([#2715](https://github.com/operator-framework/operator-sdk/pull/2715))

### Deprecated

Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endif

VERSION = $(shell git describe --dirty --tags --always)
GIT_COMMIT = $(shell git rev-parse HEAD)
K8S_VERSION = v1.16.3
K8S_VERSION = v1.17.2
REPO = github.com/operator-framework/operator-sdk
BUILD_PATH = $(REPO)/cmd/operator-sdk
PKGS = $(shell go list ./... | grep -v /vendor/)
Expand Down Expand Up @@ -218,6 +218,7 @@ test-ci: test-markdown test-sanity test-unit install test-subcommand test-e2e ##
.PHONY: test-subcommand test-subcommand-local test-subcommand-scorecard test-subcommand-olm-install

test-subcommand: test-subcommand-local test-subcommand-scorecard test-subcommand-olm-install
./hack/tests/subcommand-bundle.sh

test-subcommand-local:
./hack/tests/subcommand.sh
Expand Down
51 changes: 11 additions & 40 deletions cmd/operator-sdk/bundle/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@
package bundle

import (
"os"
"path/filepath"

"github.com/operator-framework/operator-registry/pkg/lib/bundle"
"github.com/spf13/cobra"
)

//nolint:structcheck
type bundleCmd struct {
directory string
packageName string
imageTag string
imageBuilder string
defaultChannel string
channels string
generateOnly bool
}

func NewCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "bundle",
Expand All @@ -39,39 +46,3 @@ https://github.com/openshift/enhancements/blob/master/enhancements/olm/operator-
)
return cmd
}

type bundleCmd struct {
directory string
packageName string
imageTag string
imageBuilder string
defaultChannel string
channels []string
generateOnly bool
}

// cleanupFuncs returns a set of general funcs to clean up after a bundle
// subcommand.
func (c bundleCmd) cleanupFuncs() (fs []func()) {
metaDir := filepath.Join(c.directory, bundle.MetadataDir)
dockerFile := filepath.Join(c.directory, bundle.DockerFile)
metaExists := isExist(metaDir)
dockerFileExists := isExist(dockerFile)
fs = append(fs,
func() {
if !metaExists {
_ = os.RemoveAll(metaDir)
}
},
func() {
if !dockerFileExists {
_ = os.RemoveAll(dockerFile)
}
})
return fs
}

func isExist(path string) bool {
_, err := os.Stat(path)
return os.IsExist(err)
}
Loading