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

Consume Operator Registry from PackageManifest Server #650

Merged
merged 2 commits into from
Jan 11, 2019
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ all: test build
test: clean cover.out

unit:
go test $(MOD_FLAGS) -v -race ./pkg/...
go test $(MOD_FLAGS) -v -race -tags=json1 -count=1 ./pkg/...

schema-check:
go run $(MOD_FLAGS) ./cmd/validator/main.go ./deploy/chart/catalog_resources

cover.out: schema-check
go test $(MOD_FLAGS) -v -race -coverprofile=cover.out -covermode=atomic \
go test $(MOD_FLAGS) -v -race -tags=json1 -coverprofile=cover.out -covermode=atomic \
-coverpkg ./pkg/controller/... ./pkg/...

coverage: cover.out
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ require (
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
github.com/stretchr/testify v1.2.2
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 // indirect
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f // indirect
go.uber.org/atomic v1.3.2 // indirect
go.uber.org/multierr v1.1.0 // indirect
go.uber.org/zap v1.9.1 // indirect
Expand All @@ -52,5 +53,5 @@ require (
k8s.io/klog v0.1.0 // indirect
k8s.io/kube-aggregator v0.0.0-20181204002017-122bac39d429
k8s.io/kube-openapi v0.0.0-20181031203759-72693cb1fadd
k8s.io/kubernetes v1.11.7-beta.0.0.20190105100524-8bc0774147c7
k8s.io/kubernetes v1.11.7-beta.0.0.20190108024450-5a0d4e5b8d31
)
13 changes: 8 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
Expand Down Expand Up @@ -197,9 +198,11 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 h1:lYIiVDtZnyTWlNwiAxLj0bbpTcx1BWCFhXjfsvmPdNc=
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 h1:EICbibRW4JNKMcY+LsWmuwob+CRS1BmdRdjphAm9mH4=
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f h1:y3Vj7GoDdcBkxFa2RUUFKM25TrBbWVDnjRDI0u975zQ=
github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 h1:MPPkRncZLN9Kh4MEFmbnK4h3BD7AUmskWv2+EeZJCCs=
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4=
Expand Down Expand Up @@ -273,7 +276,7 @@ k8s.io/apimachinery v0.0.0-20181203235515-3d8ee2261517/go.mod h1:ccL7Eh7zubPUSh9
k8s.io/apiserver v0.0.0-20181026151315-13cfe3978170 h1:CqI85nZvPaV+7JFono0nAOGOx2brocqefcOhDPVhHKI=
k8s.io/apiserver v0.0.0-20181026151315-13cfe3978170/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w=
k8s.io/client-go v0.0.0-20180718001006-59698c7d9724/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
k8s.io/client-go v8.0.0+incompatible h1:2pUaSg2x6iEHr8cia6zmWhoCXG1EDG9TCx9s//Aq7HY=
k8s.io/client-go v8.0.0+incompatible h1:tTI4hRmb1DRMl4fG6Vclfdi6nTM82oIrTT7HfitmxC4=
k8s.io/client-go v8.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
k8s.io/code-generator v0.0.0-20181203235156-f8cba74510f3 h1:f/Aa24HPnPEDWia884BCF94E1b29KYjOTVTHcBzvT2Q=
k8s.io/code-generator v0.0.0-20181203235156-f8cba74510f3/go.mod h1:MYiN+ZJZ9HkETbgVZdWw2AsuAi9PZ4V80cwfuf2axe8=
Expand All @@ -288,5 +291,5 @@ k8s.io/kube-aggregator v0.0.0-20181204002017-122bac39d429/go.mod h1:8sbzT4QQKDEm
k8s.io/kube-openapi v0.0.0-20181031203759-72693cb1fadd h1:ggv/Vfza0i5xuhUZyYyxcc25AmQvHY8Zi1C2m8WgBvA=
k8s.io/kube-openapi v0.0.0-20181031203759-72693cb1fadd/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc=
k8s.io/kubernetes v1.11.6-beta.0.0.20181212102158-c4240ecfddd7/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
k8s.io/kubernetes v1.11.7-beta.0.0.20190105100524-8bc0774147c7 h1:xBJeT78xTmrh5MPGV6bgMQHUB8wVlUlikNKasCfj3MY=
k8s.io/kubernetes v1.11.7-beta.0.0.20190105100524-8bc0774147c7/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
k8s.io/kubernetes v1.11.7-beta.0.0.20190108024450-5a0d4e5b8d31 h1:yXItdYgwe6Wzca23uTMJ4YgSzYO+bCcT6nbQ6KdlfiI=
k8s.io/kubernetes v1.11.7-beta.0.0.20190108024450-5a0d4e5b8d31/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
"sort"

"github.com/coreos/go-semver/semver"
"github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators"
)

const (
Expand Down
16 changes: 4 additions & 12 deletions pkg/controller/registry/resolver/operators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ func TestAPIMultiOwnerSet_PopAPIKey(t *testing.T) {
tests := []struct {
name string
s APIMultiOwnerSet
want *opregistry.APIKey
}{
{
name: "Empty",
s: EmptyAPIMultiOwnerSet(),
want: nil,
},
{
name: "OneApi/OneOwner",
Expand All @@ -61,7 +59,6 @@ func TestAPIMultiOwnerSet_PopAPIKey(t *testing.T) {
"owner1": &Operator{name: "op1"},
},
},
want: &opregistry.APIKey{"g", "v", "k", "p"},
},
{
name: "OneApi/MultiOwner",
Expand All @@ -71,7 +68,6 @@ func TestAPIMultiOwnerSet_PopAPIKey(t *testing.T) {
"owner2": &Operator{name: "op2"},
},
},
want: &opregistry.APIKey{"g", "v", "k", "p"},
},
{
name: "MultipleApi/MultiOwner",
Expand All @@ -85,24 +81,20 @@ func TestAPIMultiOwnerSet_PopAPIKey(t *testing.T) {
"owner2": &Operator{name: "op2"},
},
},
want: &opregistry.APIKey{"g", "v", "k", "p"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
startLen := len(tt.s)
require.Equal(t, tt.s.PopAPIKey(), tt.want)

// Verify entry removed once popped
if tt.want != nil {
_, ok := tt.s[*tt.want]
require.False(t, ok)
}
popped := tt.s.PopAPIKey()

// Verify len has decreased
if startLen == 0 {
require.Nil(t, popped, "popped key from empty MultiOwnerSet should be nil")
require.Equal(t, 0, len(tt.s))
} else {
_, found := tt.s[*popped]
require.False(t, found, "popped key should not still exist in set")
require.Equal(t, startLen-1, len(tt.s))
}
})
Expand Down
5 changes: 2 additions & 3 deletions pkg/package-server/apiserver/generic/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ func init() {
metav1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
}

// ProviderConfig holds the providers for node and pod metrics
// for serving the resource metrics API.
// ProviderConfig holds the providers for packagemanifests.
type ProviderConfig struct {
Provider provider.PackageManifestProvider
}

// BuildStorage constructs APIGroupInfo the metrics.k8s.io API group using the given providers.
// BuildStorage constructs APIGroupInfo the packages.apps.redhat.com API group.
func BuildStorage(providers *ProviderConfig) genericapiserver.APIGroupInfo {
apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(packagemanifest.Group, Scheme, metav1.ParameterCodec, Codecs)

Expand Down
Loading