Skip to content

Sync remaining API and operator-registry 4.10 commit(s) downstream #217

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
84f7ca5
feat: add new validator to only check the usage of deprecate apis (#156)
camilamacedo86 Sep 16, 2021
6af63ed
Add Service Account Config to Scorecard (#153)
Sep 24, 2021
840c913
Validate SA names do not match csv deployment spec (#144)
kevinrizza Aug 4, 2021
509e672
fix(validators): check object GVK in bundle service account validator…
Oct 5, 2021
ad3f395
chore(docs): emphasize release versioning requirements (#162)
Oct 5, 2021
704d0ad
doc operatorhub validator (#159)
camilamacedo86 Oct 6, 2021
8a250a5
fix: add missing allowed category (#164)
camilamacedo86 Oct 18, 2021
798dfd6
fix: Scorecard configuration ServiceAccount tag (#166)
sergioifg94 Nov 3, 2021
a28216b
fix: clarifies message error regards service account (#174)
camilamacedo86 Nov 17, 2021
ccc08ed
use static distroless image instead of base (#778)
joelanford Sep 14, 2021
41c7be4
feat(opm): include arbitrary packages, channels, and versions in diff…
Sep 17, 2021
a4fe185
opm serve: pre-compute and store api.Bundles to disk; requests read f…
joelanford Sep 22, 2021
121ef6b
Update CASE to match resource. (#694)
Jamstah Sep 23, 2021
8dca80f
fix: Unable to deprecate bundles that are head of a NOT default chann…
camilamacedo86 Sep 23, 2021
80e4a92
feat(diff): optionally include bundle names (#787)
Sep 23, 2021
47cee9b
fix(alpha): update long description indentation (#789)
tylerslaton Sep 23, 2021
4947f34
fix: update opm commands to specify if they don't take args (#786)
tylerslaton Sep 23, 2021
52e9001
handle deprecating branch points (#767)
ankitathomas Sep 24, 2021
b8e5cc2
migrate: add subcommand to migrate sqlite catalogs to file-based cata…
joelanford Sep 28, 2021
a7fdfdf
Enable cgo in multiarch builds (#793)
mnencia Sep 29, 2021
254dfdd
render: populate related images even when CSV has none explicitly def…
joelanford Sep 29, 2021
6f0b8eb
Use the proper grpc_health_probe command per architectures. (#796)
sxd Sep 30, 2021
ed6edb3
Check only for new bundles on add (#798)
ankitathomas Oct 1, 2021
e1229be
Makefile: fix major and major-minor docker release tags (#801)
joelanford Oct 1, 2021
f85f312
ensure use of bash as Makefile shell (#802)
joelanford Oct 1, 2021
bbdb874
registry: vacuum db on commands that remove data (#803)
joelanford Oct 1, 2021
3ac5969
(opm) Introduce deprecatetruncate for `opm registry` (#804)
anik120 Oct 4, 2021
ea627a9
build(deps): bump github.com/containerd/containerd from 1.4.8 to 1.4.…
dependabot[bot] Oct 5, 2021
6b326f9
fix(opm): ignore empty include file args (#808)
Oct 5, 2021
67d84fd
Makefile: Add a .PHONY target for the opm build target (#813)
timflannagan Oct 8, 2021
8f7c153
alpha/declcfg: Include bundle name in version parsing failure message…
timflannagan Oct 8, 2021
ed34489
bump grpc dependency to latest (#810)
exdx Oct 11, 2021
48e171c
e2e local test for mac (#785)
akihikokuroda Oct 11, 2021
541d826
retain single bundle default channel for overwrite (#812)
ankitathomas Oct 11, 2021
5e06e01
Log a warning when loading bundle manifests with multiple documents (…
omertuc Oct 29, 2021
25d2806
.github/workflows/goreleaser.yaml: fix cross-compiler install step (#…
joelanford Oct 29, 2021
a977840
render: include olm.bundle.object properties in rendered bundle image…
joelanford Nov 1, 2021
7116230
goreleaser: use netgo and osusergo to ensure completely static binary…
joelanford Nov 5, 2021
7091bf7
feat(diff): change default behavior to prune by omission (#819)
Nov 5, 2021
4d000a2
opm validate: fail on duplicate packages, channels, and bundles (#824)
joelanford Nov 10, 2021
95edbda
Adding equivalent opm index flags to opm registry (#827)
gallettilance Nov 15, 2021
51acb61
Block cross-package skips/replaces on add (#826)
ankitathomas Nov 17, 2021
10c3f2f
(fix) database is locked during removal (#828)
gallettilance Nov 17, 2021
e8e04d1
pkg/sqlite: use consistent starting depth when building channel_entry…
joelanford Nov 24, 2021
c6a17ab
drop trailing slash for catalog directory on opm alpha generate docke…
ankitathomas Nov 30, 2021
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
5 changes: 4 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
Expand Down Expand Up @@ -315,6 +316,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ=
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
Expand Down Expand Up @@ -1650,8 +1652,9 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E=
google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v0.0.0-20200709232328-d8193ee9cc3e/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
Expand Down
5 changes: 4 additions & 1 deletion staging/api/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ post to the [operator-framework group][of-ggroup].
## Tags

As per semver, all releases containing new features must map to a major or minor version increase.
Patch releases must only contain fixes to features released in a prior release.

**Patch releases must only contain bug fixes. Releases containing features must be major or minor releases.**

## Process

Expand All @@ -31,6 +32,8 @@ Then create release notes while still on the `master` branch:
while read -r line; do echo $line | awk '{f = $1; $1 = ""; print "-"$0; }'; done <<< $(git log $PREVIOUS_RELEASE_TAG..$RELEASE_TAG --format=oneline --no-merges)
```

**You cannot cut a patch release if any of these release notes start with `feat:` or `feature:`.**

Copy them into the Github release [description form][release-desc-page],
select `vX.Y.Z` in the `Tag version` form, and click `Publish release`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ type Configuration struct {

// Storage is the optional storage configuration
Storage Storage `json:"storage,omitempty" yaml:"storage,omitempty"`

// ServiceAccount is the service account under which scorecard tests are run. This field is optional. If left unset, the `default` service account will be used.
ServiceAccount string `json:"serviceaccount,omitempty" yaml:"serviceaccount,omitempty"`
}

// StageConfiguration configures a set of tests to be run.
Expand Down
35 changes: 35 additions & 0 deletions staging/api/pkg/validation/internal/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/operator-framework/api/pkg/validation/errors"
interfaces "github.com/operator-framework/api/pkg/validation/interfaces"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)

Expand All @@ -26,9 +28,42 @@ func validateBundles(objs ...interface{}) (results []errors.ManifestResult) {
func validateBundle(bundle *manifests.Bundle) (result errors.ManifestResult) {
result = validateOwnedCRDs(bundle, bundle.CSV)
result.Name = bundle.CSV.Spec.Version.String()
saErrors := validateServiceAccounts(bundle)
if saErrors != nil {
result.Add(saErrors...)
}
return result
}

func validateServiceAccounts(bundle *manifests.Bundle) []errors.Error {
// get service account names defined in the csv
saNamesFromCSV := make(map[string]struct{}, 0)
for _, deployment := range bundle.CSV.Spec.InstallStrategy.StrategySpec.DeploymentSpecs {
saName := deployment.Spec.Template.Spec.ServiceAccountName
saNamesFromCSV[saName] = struct{}{}
}

// find any hardcoded service account objects are in the bundle, then check if they match any sa definition in the csv
var errs []errors.Error
for _, obj := range bundle.Objects {
if obj.GroupVersionKind() != v1.SchemeGroupVersion.WithKind("ServiceAccount") {
continue
}
sa := v1.ServiceAccount{}
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(obj.Object, &sa); err == nil {
if _, ok := saNamesFromCSV[sa.Name]; ok {
errs = append(errs, errors.ErrInvalidBundle(fmt.Sprintf("invalid service account found in bundle. " +
"This service account %s in your bundle is not valid, because a service account with the same name " +
"was already specified in your CSV. If this was unintentional, please remove the service account " +
"manifest from your bundle. If it was intentional to specify a separate service account, " +
"please rename the SA in either the bundle manifest or the CSV.",sa.Name), sa.Name))
}
}
}

return errs
}

func validateOwnedCRDs(bundle *manifests.Bundle, csv *operatorsv1alpha1.ClusterServiceVersion) (result errors.ManifestResult) {
ownedKeys := getOwnedCustomResourceDefintionKeys(csv)

Expand Down
114 changes: 107 additions & 7 deletions staging/api/pkg/validation/internal/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"testing"

"github.com/operator-framework/api/pkg/manifests"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -43,20 +45,118 @@ func TestValidateBundle(t *testing.T) {
hasError: true,
errString: `duplicate CRD "test.example.com/v1alpha1, Kind=Test" in bundle "test-operator.v0.0.1"`,
},
{
description: "invalid bundle service account can't match sa in csv",
directory: "./testdata/invalid_bundle_sa",
hasError: true,
errString: `invalid service account found in bundle. This service account etcd-operator in your bundle is not valid, because a service account with the same name was already specified in your CSV. If this was unintentional, please remove the service account manifest from your bundle. If it was intentional to specify a separate service account, please rename the SA in either the bundle manifest or the CSV.`,
},
}

for _, tt := range table {
// Validate the bundle object
bundle, err := manifests.GetBundleFromDir(tt.directory)
require.NoError(t, err)
t.Run(tt.description, func(t *testing.T) {
// Validate the bundle object
bundle, err := manifests.GetBundleFromDir(tt.directory)
require.NoError(t, err)

results := BundleValidator.Validate(bundle)
results := BundleValidator.Validate(bundle)

if len(results) > 0 {
require.Equal(t, results[0].HasError(), tt.hasError)
if results[0].HasError() {
require.Greater(t, len(results), 0)
if tt.hasError {
require.True(t, results[0].HasError(), "found no error when an error was expected")
require.Contains(t, results[0].Errors[0].Error(), tt.errString)
} else {
require.False(t, results[0].HasError(), "found error when an error was not expected")
}
})
}
}

func TestValidateServiceAccount(t *testing.T) {
csvWithSAs := func(saNames ...string) *v1alpha1.ClusterServiceVersion {
csv := &v1alpha1.ClusterServiceVersion{}
depSpecs := make([]v1alpha1.StrategyDeploymentSpec, len(saNames))
for i, saName := range saNames {
depSpecs[i].Spec.Template.Spec.ServiceAccountName = saName
}
csv.Spec.InstallStrategy.StrategySpec.DeploymentSpecs = depSpecs
return csv
}

var table = []struct {
description string
bundle *manifests.Bundle
hasError bool
errString string
}{
{
description: "an object with the same name as the service account",
bundle: &manifests.Bundle{
CSV: csvWithSAs("foo"),
Objects: []*unstructured.Unstructured{
{Object: map[string]interface{}{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": map[string]interface{}{
"name": "foo",
},
"spec": map[string]interface{}{
"template": map[string]interface{}{
"spec": map[string]interface{}{
"serviceAccountName": "foo",
},
},
},
}},
},
},
hasError: false,
},
{
description: "service account included in both CSV and bundle",
bundle: &manifests.Bundle{
CSV: csvWithSAs("foo"),
Objects: []*unstructured.Unstructured{
{Object: map[string]interface{}{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": map[string]interface{}{
"name": "foo",
},
"spec": map[string]interface{}{
"template": map[string]interface{}{
"spec": map[string]interface{}{
"serviceAccountName": "foo",
},
},
},
}},
{Object: map[string]interface{}{
"apiVersion": "v1",
"kind": "ServiceAccount",
"metadata": map[string]interface{}{
"name": "foo",
},
}},
},
},
hasError: true,
errString: `invalid service account found in bundle. This service account foo in your bundle is not valid, because a service account with the same name was already specified in your CSV. If this was unintentional, please remove the service account manifest from your bundle. If it was intentional to specify a separate service account, please rename the SA in either the bundle manifest or the CSV.`,
},
}

for _, tt := range table {
t.Run(tt.description, func(t *testing.T) {
// Validate the bundle object
results := BundleValidator.Validate(tt.bundle)

require.Greater(t, len(results), 0)
if tt.hasError {
require.True(t, results[0].HasError(), "found no error when an error was expected")
require.Contains(t, results[0].Errors[0].Error(), tt.errString)
} else {
require.False(t, results[0].HasError(), "found error when an error was not expected")
}
})
}
}
3 changes: 3 additions & 0 deletions staging/api/pkg/validation/internal/community.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const IndexImagePathKey = "index-path"
// where the bundle will be distributed
const ocpLabelindex = "com.redhat.openshift.versions"

// OCP version where the apis v1beta1 is no longer supported
const ocpVerV1beta1Unsupported = "4.9"

// CommunityOperatorValidator validates the bundle manifests against the required criteria to publish
// the projects on the community operators
//
Expand Down
Loading