Skip to content

Commit 0e18a81

Browse files
Merge pull request #1150 from njhale/spur-pkgsvr
Bug 1779990: fix(packageserver): cache packagemanifests
2 parents 5f08f57 + f618585 commit 0e18a81

Some content is hidden

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

58 files changed

+505
-1893
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,3 +450,5 @@ __pycache__/
450450
/apiserver.local.config
451451
e2e.namespace
452452
minikube.kubeconfig
453+
apiserver.crt
454+
apiserver.key

cmd/package-server/apiserver.local.config/certificates/apiserver.crt

Lines changed: 0 additions & 37 deletions
This file was deleted.

cmd/package-server/apiserver.local.config/certificates/apiserver.key

Lines changed: 0 additions & 27 deletions
This file was deleted.

cmd/package-server/main.go

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,25 @@ package main
33
import (
44
"flag"
55
"os"
6-
"time"
76

87
log "github.com/sirupsen/logrus"
9-
"github.com/spf13/cobra"
108
"k8s.io/component-base/logs"
119

12-
"github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/server"
1310
"github.com/operator-framework/operator-lifecycle-manager/pkg/lib/signals"
11+
"github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/server"
1412
)
1513

16-
const (
17-
defaultWakeupInterval = 5 * time.Minute
18-
)
19-
20-
// config flags defined globally so that they appear on the test binary as well
21-
var (
22-
ctx = signals.Context()
23-
options = server.NewPackageServerOptions(os.Stdout, os.Stderr)
24-
cmd = &cobra.Command{
25-
Short: "Launch a package-server",
26-
Long: "Launch a package-server",
27-
RunE: func(c *cobra.Command, args []string) error {
28-
if err := options.Run(ctx); err != nil {
29-
return err
30-
}
31-
return nil
32-
},
33-
}
34-
)
35-
36-
func init() {
37-
flags := cmd.Flags()
38-
39-
flags.DurationVar(&options.WakeupInterval, "interval", options.WakeupInterval, "Interval at which to re-sync CatalogSources")
40-
flags.StringVar(&options.GlobalNamespace, "global-namespace", options.GlobalNamespace, "Name of the namespace where the global CatalogSources are located")
41-
flags.StringSliceVar(&options.WatchedNamespaces, "watched-namespaces", options.WatchedNamespaces, "List of namespaces the package-server will watch watch for CatalogSources")
42-
flags.StringVar(&options.Kubeconfig, "kubeconfig", options.Kubeconfig, "The path to the kubeconfig used to connect to the Kubernetes API server and the Kubelets (defaults to in-cluster config)")
43-
flags.BoolVar(&options.Debug, "debug", options.Debug, "use debug log level")
44-
45-
options.SecureServing.AddFlags(flags)
46-
options.Authentication.AddFlags(flags)
47-
options.Authorization.AddFlags(flags)
48-
options.Features.AddFlags(flags)
49-
50-
flags.AddGoFlagSet(flag.CommandLine)
51-
flags.Parse(flag.Args())
52-
}
53-
5414
func main() {
5515
logs.InitLogs()
5616
defer logs.FlushLogs()
5717

18+
ctx := signals.Context()
19+
options := server.NewPackageServerOptions(os.Stdout, os.Stderr)
20+
cmd := server.NewCommandStartPackageServer(ctx, options)
21+
cmd.Flags().AddGoFlagSet(flag.CommandLine)
22+
if err := cmd.Flags().Parse(flag.Args()); err != nil {
23+
log.Fatal(err)
24+
}
5825
if err := cmd.Execute(); err != nil {
5926
log.Fatal(err)
6027
}

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ require (
1313
github.com/fsnotify/fsnotify v1.4.7
1414
github.com/ghodss/yaml v1.0.0
1515
github.com/go-openapi/spec v0.19.2
16-
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
1716
github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff // indirect
1817
github.com/golang/mock v1.3.1
1918
github.com/google/btree v1.0.0 // indirect
@@ -34,6 +33,7 @@ require (
3433
github.com/stretchr/testify v1.4.0
3534
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
3635
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
36+
golang.org/x/sync v0.0.0-20190423024810-112230192c58
3737
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
3838
gonum.org/v1/gonum v0.0.0-20190710053202-4340aa3071a0 // indirect
3939
google.golang.org/grpc v1.23.0
@@ -44,6 +44,7 @@ require (
4444
k8s.io/client-go v8.0.0+incompatible
4545
k8s.io/code-generator v0.0.0
4646
k8s.io/component-base v0.0.0
47+
k8s.io/klog v0.4.0
4748
k8s.io/kube-aggregator v0.0.0
4849
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf
4950
k8s.io/kubernetes v1.16.0

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ
609609
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
610610
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
611611
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
612+
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
612613
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
613614
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
614615
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

pkg/lib/event/event.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package event
22

33
import (
4-
"github.com/golang/glog"
54
v1 "k8s.io/api/core/v1"
65
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
76
"k8s.io/client-go/tools/record"
7+
"k8s.io/klog"
88

99
"github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned/scheme"
1010
)
@@ -15,7 +15,7 @@ const component string = "operator-lifecycle-manager"
1515
// used to post Events to different object's lifecycles.
1616
func NewRecorder(event typedcorev1.EventInterface) (record.EventRecorder, error) {
1717
eventBroadcaster := record.NewBroadcaster()
18-
eventBroadcaster.StartLogging(glog.Infof)
18+
eventBroadcaster.StartLogging(klog.Infof)
1919
eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: event})
2020
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: component})
2121

pkg/lib/operatorclient/apiservice.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package operatorclient
33
import (
44
"fmt"
55

6-
"github.com/golang/glog"
76
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
87
"k8s.io/apimachinery/pkg/types"
8+
"k8s.io/klog"
99
apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
1010
)
1111

@@ -26,7 +26,7 @@ func (c *Client) DeleteAPIService(name string, options *metav1.DeleteOptions) er
2626

2727
// UpdateAPIService will update the given APIService resource.
2828
func (c *Client) UpdateAPIService(apiService *apiregistrationv1.APIService) (*apiregistrationv1.APIService, error) {
29-
glog.V(4).Infof("[UPDATE APIService]: %s", apiService.GetName())
29+
klog.V(4).Infof("[UPDATE APIService]: %s", apiService.GetName())
3030
oldAPIService, err := c.GetAPIService(apiService.GetName())
3131
if err != nil {
3232
return nil, err

pkg/lib/operatorclient/clusterrole.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package operatorclient
33
import (
44
"fmt"
55

6-
"github.com/golang/glog"
76
rbacv1 "k8s.io/api/rbac/v1"
87
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/types"
9+
"k8s.io/klog"
1010
)
1111

1212
// CreateClusterRole creates the ClusterRole.
@@ -26,7 +26,7 @@ func (c *Client) DeleteClusterRole(name string, options *metav1.DeleteOptions) e
2626

2727
// UpdateClusterRole will update the given ClusterRole.
2828
func (c *Client) UpdateClusterRole(crb *rbacv1.ClusterRole) (*rbacv1.ClusterRole, error) {
29-
glog.V(4).Infof("[UPDATE Role]: %s", crb.GetName())
29+
klog.V(4).Infof("[UPDATE Role]: %s", crb.GetName())
3030
oldCrb, err := c.GetClusterRole(crb.GetName())
3131
if err != nil {
3232
return nil, err

pkg/lib/operatorclient/clusterrolebinding.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package operatorclient
33
import (
44
"fmt"
55

6-
"github.com/golang/glog"
76
rbacv1 "k8s.io/api/rbac/v1"
87
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
98
"k8s.io/apimachinery/pkg/types"
9+
"k8s.io/klog"
1010
)
1111

1212
// CreateRoleBinding creates the roleBinding.
@@ -26,7 +26,7 @@ func (c *Client) DeleteClusterRoleBinding(name string, options *metav1.DeleteOpt
2626

2727
// UpdateRoleBinding will update the given RoleBinding resource.
2828
func (c *Client) UpdateClusterRoleBinding(crb *rbacv1.ClusterRoleBinding) (*rbacv1.ClusterRoleBinding, error) {
29-
glog.V(4).Infof("[UPDATE RoleBinding]: %s", crb.GetName())
29+
klog.V(4).Infof("[UPDATE RoleBinding]: %s", crb.GetName())
3030
oldCrb, err := c.GetClusterRoleBinding(crb.GetName())
3131
if err != nil {
3232
return nil, err

0 commit comments

Comments
 (0)