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

Sync olm 12-10-21 #223

Merged
merged 8 commits into from
Dec 12, 2021
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: ci
name: build
on:
pull_request:
paths-ignore:
- '**/*.md'
jobs:
image:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: ci
name: e2e
on:
push:
branches:
- master
pull_request:
paths-ignore:
- '**/*.md'
jobs:
e2e-tests:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'v*'

jobs:
build:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: ci
name: run-olm-kind
on:
pull_request:
paths-ignore:
- '**/*.md'
schedule:
- cron: '0 0 * * *' # daily to pick up releases
jobs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: ci
name: run-olm-minikube
on:
pull_request:
paths-ignore:
- '**/*.md'
schedule:
- cron: '0 0 * * *' # daily to pick up releases
jobs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
name: ci

name: sanity
on:
push:
branches:
- '**'
pull_request:
paths-ignore:
- '**/*.md'

jobs:
sanity:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: ci
name: unit
on:
push:
branches:
- master
pull_request:
paths-ignore:
- '**/*.md'
jobs:
unit:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: ci
name: verify
on:
push:
branches:
- master
pull_request:
paths-ignore:
- '**/*.md'
jobs:
verify:
runs-on: ubuntu-latest
Expand Down
9 changes: 7 additions & 2 deletions staging/operator-lifecycle-manager/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

This project uses the built-in testing support for golang.

Envtest is also used and needs to be set up. Follow [controller-runtime instructions] and set `KUBEBUILDER_ASSETS` environment variable to point to the installation directory, for instance: `/usr/local/kubebuilder/bin`.

To run the tests for all go packages outside of the vendor directory, run:
```sh
$ make test
Expand All @@ -46,11 +48,14 @@ To run a specific e2e test locally:
$ make e2e-local TEST=TestCreateInstallPlanManualApproval
```

[controller-runtime instructions]: https://pkg.go.dev/sigs.k8s.io/controller-runtime/tools/setup-envtest#section-readme

#### Building

Ensure your version of go is up to date; check that you're running v1.9 with the
command:
Ensure your version of go is up to date; check that you're running the same version as in go.mod with the
commands:
```sh
$ head go.mod
$ go version
```

Expand Down
12 changes: 12 additions & 0 deletions staging/operator-lifecycle-manager/MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This page lists all active maintainers of this repository.

See [CONTRIBUTING.md](https://github.com/operator-framework/operator-lifecycle-manager/blob/master/CONTRIBUTING.md)
for general contribution guidelines.

## Maintainers (in alphabetical order)

- [Alexander Greene](github.com/awgreene), Red Hat
- [Evan Cordell](github.com/ecordell), Authzed
- [Kevin Rizza](github.com/kevinrizza), Red Hat
- [Nick Hale](github.com/njhale), Red Hat
- [Vu Dinh](github.com/dinhxuanvu), Red Hat
8 changes: 3 additions & 5 deletions staging/operator-lifecycle-manager/cmd/catalog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ func main() {
// Check if version flag was set
if *version {
fmt.Print(olmversion.String())

// Exit early
os.Exit(0)
}

Expand All @@ -111,7 +109,7 @@ func main() {

listenAndServe, err := server.GetListenAndServeFunc(server.WithLogger(logger), server.WithTLS(tlsCertPath, tlsKeyPath, clientCAPath), server.WithDebug(*debug))
if err != nil {
logger.Fatal("Error setting up health/metric/pprof service: %v", err)
logger.Fatalf("Error setting up health/metric/pprof service: %v", err)
}

go func() {
Expand All @@ -138,12 +136,12 @@ func main() {
// Create a new instance of the operator.
op, err := catalog.NewOperator(ctx, *kubeConfigPath, utilclock.RealClock{}, logger, *wakeupInterval, *configmapServerImage, *opmImage, *utilImage, *catalogNamespace, k8sscheme.Scheme, *installPlanTimeout, *bundleUnpackTimeout)
if err != nil {
log.Panicf("error configuring catalog operator: %s", err.Error())
log.Fatalf("error configuring catalog operator: %s", err.Error())
}

opCatalogTemplate, err := catalogtemplate.NewOperator(ctx, *kubeConfigPath, logger, *wakeupInterval, *catalogNamespace)
if err != nil {
log.Panicf("error configuring catalog template operator: %s", err.Error())
log.Fatalf("error configuring catalog template operator: %s", err.Error())
}

op.Run(ctx)
Expand Down
10 changes: 5 additions & 5 deletions staging/operator-lifecycle-manager/cmd/olm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func main() {

listenAndServe, err := server.GetListenAndServeFunc(server.WithLogger(logger), server.WithTLS(tlsCertPath, tlsKeyPath, clientCAPath), server.WithDebug(*debug))
if err != nil {
logger.Fatal("Error setting up health/metric/pprof service: %v", err)
logger.Fatalf("Error setting up health/metric/pprof service: %v", err)
}

go func() {
Expand All @@ -131,7 +131,7 @@ func main() {

mgr, err := Manager(ctx, *debug)
if err != nil {
logger.WithError(err).Fatalf("error configuring controller manager")
logger.WithError(err).Fatal("error configuring controller manager")
}
config := mgr.GetConfig()

Expand Down Expand Up @@ -164,7 +164,7 @@ func main() {
olm.WithConfigClient(versionedConfigClient),
)
if err != nil {
logger.WithError(err).Fatalf("error configuring operator")
logger.WithError(err).Fatal("error configuring operator")
return
}

Expand All @@ -182,12 +182,12 @@ func main() {
openshift.WithOLMOperator(),
)
if err != nil {
logger.WithError(err).Fatalf("error configuring openshift integration")
logger.WithError(err).Fatal("error configuring openshift integration")
return
}

if err := reconciler.SetupWithManager(mgr); err != nil {
logger.WithError(err).Fatalf("error configuring openshift integration")
logger.WithError(err).Fatal("error configuring openshift integration")
return
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func (i *StrategyDeploymentInstaller) checkForDeployments(deploymentSpecs []v1al
// compare deployments to see if any need to be created/updated
existingMap := map[string]*appsv1.Deployment{}
for _, d := range existingDeployments {
existingMap[d.GetName()] = d
existingMap[d.GetName()] = d.DeepCopy()
}
for _, spec := range deploymentSpecs {
dep, exists := existingMap[spec.Name]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
utilclock "k8s.io/apimachinery/pkg/util/clock"
k8syaml "k8s.io/apimachinery/pkg/util/yaml"
utilyaml "k8s.io/apimachinery/pkg/util/yaml"
"k8s.io/apiserver/pkg/storage/names"
fakedynamic "k8s.io/client-go/dynamic/fake"
Expand Down Expand Up @@ -1302,7 +1301,7 @@ func TestValidateExistingCRs(t *testing.T) {
unstructuredForFile := func(file string) *unstructured.Unstructured {
data, err := ioutil.ReadFile(file)
require.NoError(t, err)
dec := k8syaml.NewYAMLOrJSONDecoder(strings.NewReader(string(data)), 30)
dec := utilyaml.NewYAMLOrJSONDecoder(strings.NewReader(string(data)), 30)
k8sFile := &unstructured.Unstructured{}
require.NoError(t, dec.Decode(k8sFile))
return k8sFile
Expand All @@ -1311,7 +1310,7 @@ func TestValidateExistingCRs(t *testing.T) {
unversionedCRDForV1beta1File := func(file string) *apiextensions.CustomResourceDefinition {
data, err := ioutil.ReadFile(file)
require.NoError(t, err)
dec := k8syaml.NewYAMLOrJSONDecoder(strings.NewReader(string(data)), 30)
dec := utilyaml.NewYAMLOrJSONDecoder(strings.NewReader(string(data)), 30)
k8sFile := &apiextensionsv1beta1.CustomResourceDefinition{}
require.NoError(t, dec.Decode(k8sFile))
convertedCRD := &apiextensions.CustomResourceDefinition{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

"github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/registry/resolver/cache"
"github.com/operator-framework/operator-registry/pkg/registry"
opregistry "github.com/operator-framework/operator-registry/pkg/registry"
extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
extv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
Expand Down Expand Up @@ -98,7 +97,7 @@ func labelSetsForCRDv1beta1(crd *extv1beta1.CustomResourceDefinition) ([]labels.

// Add label sets for each version
for _, version := range crd.Spec.Versions {
hash, err := cache.APIKeyToGVKHash(registry.APIKey{
hash, err := cache.APIKeyToGVKHash(opregistry.APIKey{
Group: crd.Spec.Group,
Version: version.Name,
Kind: crd.Spec.Names.Kind,
Expand Down Expand Up @@ -129,7 +128,7 @@ func labelSetsForCRDv1(crd *extv1.CustomResourceDefinition) ([]labels.Set, error

// Add label sets for each version
for _, version := range crd.Spec.Versions {
hash, err := cache.APIKeyToGVKHash(registry.APIKey{
hash, err := cache.APIKeyToGVKHash(opregistry.APIKey{
Group: crd.Spec.Group,
Version: version.Name,
Kind: crd.Spec.Names.Kind,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

v1 "github.com/operator-framework/api/pkg/operators/v1"
"github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
Expand Down Expand Up @@ -2033,7 +2032,7 @@ func (a *Operator) apiServiceOwnerConflicts(csv *v1alpha1.ClusterServiceVersion)

adoptable, err := install.IsAPIServiceAdoptable(a.lister, csv, apiService)
if err != nil {
a.logger.WithFields(log.Fields{"obj": "apiService", "labels": apiService.GetLabels()}).Errorf("adoption check failed - %v", err)
a.logger.WithFields(logrus.Fields{"obj": "apiService", "labels": apiService.GetLabels()}).Errorf("adoption check failed - %v", err)
}

if !adoptable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
k8serror "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
Expand Down Expand Up @@ -326,7 +325,7 @@ func (c *GrpcRegistryReconciler) ensureService(source grpcCatalogSourceDecorator
return err
}

func (c *GrpcRegistryReconciler) ensureSA(source grpcCatalogSourceDecorator) (*v1.ServiceAccount, error) {
func (c *GrpcRegistryReconciler) ensureSA(source grpcCatalogSourceDecorator) (*corev1.ServiceAccount, error) {
sa := source.ServiceAccount()
if _, err := c.OpClient.CreateServiceAccount(sa); err != nil {
return sa, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"

"github.com/operator-framework/api/pkg/lib/version"
opver "github.com/operator-framework/api/pkg/lib/version"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
listersv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/listers/operators/v1alpha1"
Expand Down Expand Up @@ -1515,7 +1514,7 @@ func TestInferProperties(t *testing.T) {
Name: "a",
},
Spec: v1alpha1.ClusterServiceVersionSpec{
Version: version.OperatorVersion{Version: semver.MustParse("1.2.3")},
Version: opver.OperatorVersion{Version: semver.MustParse("1.2.3")},
},
},
Subscriptions: []*v1alpha1.Subscription{
Expand Down Expand Up @@ -1556,7 +1555,7 @@ func TestInferProperties(t *testing.T) {
Name: "a",
},
Spec: v1alpha1.ClusterServiceVersionSpec{
Version: version.OperatorVersion{Version: semver.MustParse("1.2.3")},
Version: opver.OperatorVersion{Version: semver.MustParse("1.2.3")},
},
},
Subscriptions: []*v1alpha1.Subscription{
Expand Down Expand Up @@ -1585,7 +1584,7 @@ func TestInferProperties(t *testing.T) {
Name: "a",
},
Spec: v1alpha1.ClusterServiceVersionSpec{
Version: version.OperatorVersion{Version: semver.MustParse("1.2.3")},
Version: opver.OperatorVersion{Version: semver.MustParse("1.2.3")},
},
},
Subscriptions: []*v1alpha1.Subscription{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#! /bin/bash

set -o pipefail
set -o nounset
set -o errexit

: "${KUBECONFIG:?}"
: "${TEST_NAMESPACE:?}"
: "${TEST_ARTIFACTS_DIR:?}"

mkdir -p "${TEST_ARTIFACTS_DIR}"

commands=()
commands+=("get catalogsources -o yaml")
commands+=("get subscriptions -o yaml")
commands+=("get operatorgroups -o yaml")
commands+=("get clusterserviceversions -o yaml")
commands+=("get installplans -o yaml")
commands+=("get pods -o wide")
commands+=("get events --sort-by .lastTimestamp")

echo "Storing the test artifact output in the ${TEST_ARTIFACTS_DIR} directory"
for command in "${commands[@]}"; do
echo "Collecting ${command} output..."
COMMAND_OUTPUT_FILE=${TEST_ARTIFACTS_DIR}/${command// /_}
kubectl -n ${TEST_NAMESPACE} ${command} >> "${COMMAND_OUTPUT_FILE}"
done
Loading