Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: bump operator-registry to v1.13.4 #3602

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions changelog/fragments/bundle-validate-default-channel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
entries:
- description: >
The `generate bundle` subcommand no longer requires a default channel be set nor defaults
to the first channel provided to `--channels`.
kind: change
breaking: false
- description: >
The `bundle validate` subcommand no longer returns an error if a bundle does not have a default channel.
kind: change
breaking: false
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/onsi/gomega v1.10.1
github.com/operator-framework/api v0.3.8
github.com/operator-framework/operator-lib v0.0.0-20200724203809-f6728cc91ac6
github.com/operator-framework/operator-registry v1.12.6-0.20200611222234-275301b779f8
github.com/operator-framework/operator-registry v1.13.4
github.com/prometheus/client_golang v1.5.1
github.com/sergi/go-diff v1.0.0
github.com/sirupsen/logrus v1.5.0
Expand All @@ -27,8 +27,6 @@ require (
go.uber.org/zap v1.14.1
golang.org/x/tools v0.0.0-20200403190813-44a64ad78b9b
gomodules.xyz/jsonpatch/v3 v3.0.1
gopkg.in/yaml.v2 v2.3.0
gopkg.in/yaml.v3 v3.0.0-20190905181640-827449938966
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I loved 👍

helm.sh/helm/v3 v3.2.4
k8s.io/api v0.18.4
k8s.io/apiextensions-apiserver v0.18.4
Expand Down
58 changes: 52 additions & 6 deletions go.sum

Large diffs are not rendered by default.

13 changes: 1 addition & 12 deletions internal/cmd/operator-sdk/generate/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"strings"

"github.com/operator-framework/operator-registry/pkg/lib/bundle"
yaml "gopkg.in/yaml.v3"
"sigs.k8s.io/kubebuilder/pkg/model/config"
"sigs.k8s.io/yaml"

metricsannotations "github.com/operator-framework/operator-sdk/internal/annotations/metrics"
scorecardannotations "github.com/operator-framework/operator-sdk/internal/annotations/scorecard"
Expand Down Expand Up @@ -109,12 +109,6 @@ func (c *bundleCmd) setDefaults(cfg *config.Config) (err error) {
if c.projectName, err = genutil.GetOperatorName(cfg); err != nil {
return err
}

// A default channel can be inferred if there is only one channel. Don't infer
// default otherwise; the user must set this value.
if c.defaultChannel == "" && strings.Count(c.channels, ",") == 0 {
c.defaultChannel = c.channels
}
return nil
}

Expand Down Expand Up @@ -254,11 +248,6 @@ func writeScorecardConfig(dir string, cfg v1alpha3.Configuration) error {

// validateMetadata validates c for bundle metadata generation.
func (c bundleCmd) validateMetadata(*config.Config) (err error) {
// Ensure a default channel is present.
if c.defaultChannel == "" {
return fmt.Errorf("--default-channel must be set if setting multiple channels")
}

return nil
}

Expand Down
5 changes: 1 addition & 4 deletions internal/registry/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ import (
registrybundle "github.com/operator-framework/operator-registry/pkg/lib/bundle"
log "github.com/sirupsen/logrus"
"github.com/spf13/afero"

// TODO: replace `gopkg.in/yaml.v3` with `sigs.k8s.io/yaml` once operator-registry has `json` tags in the
// annotations struct.
yaml "gopkg.in/yaml.v3"
"sigs.k8s.io/yaml"
)

// Labels is a set of key:value labels from an operator-registry object.
Expand Down
5 changes: 3 additions & 2 deletions internal/registry/labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ var _ = Describe("Labels", func() {
It("returns a YAML error", func() {
writeMetadataHelper(fs, defaultPath, annotationsStringInvalidBadIndent)
_, _, err = findBundleMetadata(fs, "/bundle")
Expect(err).To(MatchError(fmt.Sprintf("error unmarshalling potential bundle metadata %s: ", defaultPath) +
"yaml: line 2: found character that cannot start any token"))
// err should contain both of the following parts.
Expect(err.Error()).To(ContainSubstring(fmt.Sprintf("error unmarshalling potential bundle metadata %s: ", defaultPath)))
Expect(err.Error()).To(ContainSubstring("yaml: line 2: found character that cannot start any token"))
})
It("returns an error for no metadata file (empty file)", func() {
writeMetadataHelper(fs, defaultPath, annotationsStringInvalidEmpty)
Expand Down
8 changes: 2 additions & 6 deletions internal/registry/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,18 @@ import (
apierrors "github.com/operator-framework/api/pkg/validation/errors"
registrybundle "github.com/operator-framework/operator-registry/pkg/lib/bundle"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
k8svalidation "k8s.io/apimachinery/pkg/api/validation"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation/field"
"sigs.k8s.io/yaml"
)

// ValidateBundleContent confirms that the CSV and CRD files inside the bundle
// directory are valid and can be installed in a cluster. Other GVK types are
// also validated to confirm if they are "kubectl-able" to a cluster meaning
// if they can be applied to a cluster using `kubectl` provided users have all
// necessary permissions and configurations.
func ValidateBundleContent(logger *log.Entry, bundle *apimanifests.Bundle,
mediaType string) []apierrors.ManifestResult {
func ValidateBundleContent(logger *log.Entry, bundle *apimanifests.Bundle, mediaType string) []apierrors.ManifestResult {

// Use errs to collect bundle-level validation errors.
errs := apierrors.ManifestResult{
Expand Down Expand Up @@ -167,9 +166,6 @@ func getAnnotationFileContents(filename string) (*registrybundle.AnnotationMetad
}

func writeAnnotationFile(filename string, annotation *registrybundle.AnnotationMetadata) error {
// TODO: replace `gopkg.in/yaml.v2` with `sigs.k8s.io/yaml`. Operator registry
// defines annotations with yaml format (using gopkg-yaml) and k8s-yaml takes name
// of field in the struct as the value of key in yaml.
file, err := yaml.Marshal(annotation)
if err != nil {
return err
Expand Down