Skip to content

Commit 4170dc9

Browse files
authored
Merge pull request #650 from njhale/packageserver-use-registry
Consume Operator Registry from PackageManifest Server
2 parents e462bec + 196cc1c commit 4170dc9

File tree

123 files changed

+261469
-4483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+261469
-4483
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ all: test build
2323
test: clean cover.out
2424

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

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

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

3535
coverage: cover.out

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ require (
3333
github.com/spf13/cobra v0.0.3
3434
github.com/spf13/pflag v1.0.3 // indirect
3535
github.com/stretchr/testify v1.2.2
36-
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 // indirect
36+
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
37+
github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f // indirect
3738
go.uber.org/atomic v1.3.2 // indirect
3839
go.uber.org/multierr v1.1.0 // indirect
3940
go.uber.org/zap v1.9.1 // indirect
@@ -52,5 +53,5 @@ require (
5253
k8s.io/klog v0.1.0 // indirect
5354
k8s.io/kube-aggregator v0.0.0-20181204002017-122bac39d429
5455
k8s.io/kube-openapi v0.0.0-20181031203759-72693cb1fadd
55-
k8s.io/kubernetes v1.11.7-beta.0.0.20190105100524-8bc0774147c7
56+
k8s.io/kubernetes v1.11.7-beta.0.0.20190108024450-5a0d4e5b8d31
5657
)

go.sum

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB
135135
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic=
136136
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
137137
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
138+
github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
138139
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
139140
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
140141
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
@@ -197,9 +198,11 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1
197198
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
198199
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 h1:lYIiVDtZnyTWlNwiAxLj0bbpTcx1BWCFhXjfsvmPdNc=
199200
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
201+
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=
202+
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
200203
github.com/ugorji/go v1.1.1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
201-
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 h1:EICbibRW4JNKMcY+LsWmuwob+CRS1BmdRdjphAm9mH4=
202-
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
204+
github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f h1:y3Vj7GoDdcBkxFa2RUUFKM25TrBbWVDnjRDI0u975zQ=
205+
github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
203206
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 h1:MPPkRncZLN9Kh4MEFmbnK4h3BD7AUmskWv2+EeZJCCs=
204207
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
205208
go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4=
@@ -273,7 +276,7 @@ k8s.io/apimachinery v0.0.0-20181203235515-3d8ee2261517/go.mod h1:ccL7Eh7zubPUSh9
273276
k8s.io/apiserver v0.0.0-20181026151315-13cfe3978170 h1:CqI85nZvPaV+7JFono0nAOGOx2brocqefcOhDPVhHKI=
274277
k8s.io/apiserver v0.0.0-20181026151315-13cfe3978170/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w=
275278
k8s.io/client-go v0.0.0-20180718001006-59698c7d9724/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
276-
k8s.io/client-go v8.0.0+incompatible h1:2pUaSg2x6iEHr8cia6zmWhoCXG1EDG9TCx9s//Aq7HY=
279+
k8s.io/client-go v8.0.0+incompatible h1:tTI4hRmb1DRMl4fG6Vclfdi6nTM82oIrTT7HfitmxC4=
277280
k8s.io/client-go v8.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
278281
k8s.io/code-generator v0.0.0-20181203235156-f8cba74510f3 h1:f/Aa24HPnPEDWia884BCF94E1b29KYjOTVTHcBzvT2Q=
279282
k8s.io/code-generator v0.0.0-20181203235156-f8cba74510f3/go.mod h1:MYiN+ZJZ9HkETbgVZdWw2AsuAi9PZ4V80cwfuf2axe8=
@@ -288,5 +291,5 @@ k8s.io/kube-aggregator v0.0.0-20181204002017-122bac39d429/go.mod h1:8sbzT4QQKDEm
288291
k8s.io/kube-openapi v0.0.0-20181031203759-72693cb1fadd h1:ggv/Vfza0i5xuhUZyYyxcc25AmQvHY8Zi1C2m8WgBvA=
289292
k8s.io/kube-openapi v0.0.0-20181031203759-72693cb1fadd/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc=
290293
k8s.io/kubernetes v1.11.6-beta.0.0.20181212102158-c4240ecfddd7/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
291-
k8s.io/kubernetes v1.11.7-beta.0.0.20190105100524-8bc0774147c7 h1:xBJeT78xTmrh5MPGV6bgMQHUB8wVlUlikNKasCfj3MY=
292-
k8s.io/kubernetes v1.11.7-beta.0.0.20190105100524-8bc0774147c7/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
294+
k8s.io/kubernetes v1.11.7-beta.0.0.20190108024450-5a0d4e5b8d31 h1:yXItdYgwe6Wzca23uTMJ4YgSzYO+bCcT6nbQ6KdlfiI=
295+
k8s.io/kubernetes v1.11.7-beta.0.0.20190108024450-5a0d4e5b8d31/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=

pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import (
88
"sort"
99

1010
"github.com/coreos/go-semver/semver"
11-
"github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators"
1211
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
12+
13+
"github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators"
1314
)
1415

1516
const (

pkg/controller/registry/resolver/operators_test.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ func TestAPIMultiOwnerSet_PopAPIKey(t *testing.T) {
4747
tests := []struct {
4848
name string
4949
s APIMultiOwnerSet
50-
want *opregistry.APIKey
5150
}{
5251
{
5352
name: "Empty",
5453
s: EmptyAPIMultiOwnerSet(),
55-
want: nil,
5654
},
5755
{
5856
name: "OneApi/OneOwner",
@@ -61,7 +59,6 @@ func TestAPIMultiOwnerSet_PopAPIKey(t *testing.T) {
6159
"owner1": &Operator{name: "op1"},
6260
},
6361
},
64-
want: &opregistry.APIKey{"g", "v", "k", "p"},
6562
},
6663
{
6764
name: "OneApi/MultiOwner",
@@ -71,7 +68,6 @@ func TestAPIMultiOwnerSet_PopAPIKey(t *testing.T) {
7168
"owner2": &Operator{name: "op2"},
7269
},
7370
},
74-
want: &opregistry.APIKey{"g", "v", "k", "p"},
7571
},
7672
{
7773
name: "MultipleApi/MultiOwner",
@@ -85,24 +81,20 @@ func TestAPIMultiOwnerSet_PopAPIKey(t *testing.T) {
8581
"owner2": &Operator{name: "op2"},
8682
},
8783
},
88-
want: &opregistry.APIKey{"g", "v", "k", "p"},
8984
},
9085
}
9186
for _, tt := range tests {
9287
t.Run(tt.name, func(t *testing.T) {
9388
startLen := len(tt.s)
94-
require.Equal(t, tt.s.PopAPIKey(), tt.want)
9589

96-
// Verify entry removed once popped
97-
if tt.want != nil {
98-
_, ok := tt.s[*tt.want]
99-
require.False(t, ok)
100-
}
90+
popped := tt.s.PopAPIKey()
10191

102-
// Verify len has decreased
10392
if startLen == 0 {
93+
require.Nil(t, popped, "popped key from empty MultiOwnerSet should be nil")
10494
require.Equal(t, 0, len(tt.s))
10595
} else {
96+
_, found := tt.s[*popped]
97+
require.False(t, found, "popped key should not still exist in set")
10698
require.Equal(t, startLen-1, len(tt.s))
10799
}
108100
})

pkg/package-server/apiserver/generic/storage.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ func init() {
4040
metav1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
4141
}
4242

43-
// ProviderConfig holds the providers for node and pod metrics
44-
// for serving the resource metrics API.
43+
// ProviderConfig holds the providers for packagemanifests.
4544
type ProviderConfig struct {
4645
Provider provider.PackageManifestProvider
4746
}
4847

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

0 commit comments

Comments
 (0)