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

add bundle size validator check #210

Merged
merged 7 commits into from Feb 8, 2022
Merged

add bundle size validator check #210

merged 7 commits into from Feb 8, 2022

Conversation

camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Jan 8, 2022

Description

  • add bundle size validator check
  • fix warn level that was as error type

Co-authored-by: Brett Tofel btofel@redhat.com

Closes: #163

Related to: operator-framework/operator-registry#685

@openshift-ci openshift-ci bot requested review from estroz and jmrodri January 8, 2022 08:20
@@ -15,6 +17,9 @@ import (

var BundleValidator interfaces.Validator = interfaces.ValidatorFunc(validateBundles)

// max_bundle_sized_allowed defines the max size of the bundle
const max_bundle_sized_allowed = 1048576
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kevinrizza could you please help out just by double-checking that is the correct amount?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

c/c @perdasilva @njhale @anik120 could you please help us check if that amount is the right one and etc?

@camilamacedo86
Copy link
Contributor Author

c/c @bentito @gallettilance @perdasilva

pkg/validation/internal/bundle.go Outdated Show resolved Hide resolved
pkg/validation/internal/bundle.go Outdated Show resolved Hide resolved
pkg/validation/internal/bundle.go Outdated Show resolved Hide resolved
pkg/validation/internal/bundle.go Outdated Show resolved Hide resolved
pkg/validation/internal/bundle.go Show resolved Hide resolved
pkg/validation/internal/bundle.go Outdated Show resolved Hide resolved
pkg/validation/internal/bundle.go Outdated Show resolved Hide resolved
@@ -15,6 +17,9 @@ import (

var BundleValidator interfaces.Validator = interfaces.ValidatorFunc(validateBundles)

// max_bundle_sized_allowed defines the max size of the bundle
const max_bundle_sized_allowed = 1048576
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const max_bundle_sized_allowed = 1048576
// max_bundle_size is the maximum size of a bundle in bytes.
// This ensures the bundle can be staged in a single ConfigMap by OLM during installation. The value is derived from the standard upper bound for k8s resources (~1MB).
const max_bundle_size = 1048576

Copy link
Member

Choose a reason for hiding this comment

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

This looks like the number of bits, not bytes.

Copy link
Member

@njhale njhale Jan 10, 2022

Choose a reason for hiding this comment

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

There are two variables that change this:

  • decrease: overhead of storing in a ConfigMap; i.e. it should really be 1MB - |ConfigMap metadata|
  • increase: newer versions of OLM use gzip to compress bundle content on cluster

Doing some napkin math based on the results cited in original gzip PR yields a compression ratio of ~5.6:1; i.e. a space saving of ~82%. If we assume that bundle is representative of the entire population, then a ~4MB cap seems reasonable (5.61MB$SAFETY_BUFFER, where SAFETY_BUFFER=.75).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, do you think that we can safely increase this amount to ~4MB?
I know that currently if the bundle is too big that fails in the deploy right?
The validator here would give the opportunity we alert and give a proper message before that happens.

@kevinrizza
Copy link
Member

Is it also worth checking each file to ensure that they can be applied by etcd? Even if OLM can unpack it, if a single crd hits the default etcd file limit on clusters (1MB), then the bundle won't be applied just a little further into install

go.mod Outdated
@@ -9,6 +9,7 @@ require (
github.com/go-bindata/go-bindata/v3 v3.1.3
github.com/google/cel-go v0.9.0
github.com/mikefarah/yq/v3 v3.0.0-20201202084205-8846255d1c37
github.com/operator-framework/operator-registry v1.19.5
Copy link
Member

Choose a reason for hiding this comment

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

this is a circular dependency. the api project shouldn't depend on the operator-registry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, it shows for me that the code to do the zip ought to be shipped here and we do a follow up for opm get it from here. Tks
/hold

Copy link
Contributor Author

Choose a reason for hiding this comment

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

HI @kevinrizza,

That is changed.

/hold cancel

@openshift-ci openshift-ci bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jan 17, 2022
@jmrodri
Copy link
Member

jmrodri commented Jan 21, 2022

@camilamacedo86 rename this file: pkg/encoding/enconding.go I think it should be encoding.go

Copy link
Member

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2022
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2022
Copy link
Member

@jmrodri jmrodri left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 8, 2022
Copy link
Member

@njhale njhale left a comment

Choose a reason for hiding this comment

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

/approve

@openshift-ci
Copy link

openshift-ci bot commented Feb 8, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, njhale

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 8, 2022
@openshift-merge-robot openshift-merge-robot merged commit e8208e3 into operator-framework:master Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants