mirror of
https://github.com/Octops/octops-image-syncer.git
synced 2025-03-14 10:06:18 +00:00
Merge pull request #2 from Octops/update-dependencies-08-23
Update dependencies
This commit is contained in:
12
Dockerfile
12
Dockerfile
@ -1,16 +1,18 @@
|
||||
FROM golang:1.17 as build-env
|
||||
FROM golang:1.20 as build-env
|
||||
|
||||
WORKDIR /go/src/github.com/Octops/octops-image-syncer
|
||||
ADD . /go/src/github.com/Octops/octops-image-syncer
|
||||
|
||||
RUN go get -d -v ./...
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
ENV APP_BIN /go/bin/octops-image-syncer
|
||||
ENV VERSION v0.0.1
|
||||
ENV VERSION v0.1.1
|
||||
|
||||
RUN make build
|
||||
|
||||
FROM gcr.io/distroless/base-debian11
|
||||
FROM gcr.io/distroless/static:nonroot
|
||||
|
||||
COPY --from=build-env /go/bin/octops-image-syncer /
|
||||
|
||||
|
@ -2,14 +2,15 @@ package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/Octops/octops-image-syncer/pkg/clients"
|
||||
"github.com/Octops/octops-image-syncer/pkg/syncer"
|
||||
"github.com/Octops/octops-image-syncer/pkg/transport"
|
||||
"github.com/Octops/octops-image-syncer/pkg/watcher"
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/client-go/rest"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Execute(ctx context.Context, config *rest.Config, duration time.Duration, port int, metricsBindAddress string) error {
|
||||
|
99
go.mod
99
go.mod
@ -1,77 +1,86 @@
|
||||
module github.com/Octops/octops-image-syncer
|
||||
|
||||
go 1.17
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
agones.dev/agones v1.18.0
|
||||
github.com/Octops/agones-event-broadcaster v0.3.4
|
||||
agones.dev/agones v1.34.0
|
||||
github.com/Octops/agones-event-broadcaster v0.3.9
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
google.golang.org/grpc v1.38.0
|
||||
k8s.io/client-go v0.22.1
|
||||
k8s.io/cri-api v0.22.1
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
github.com/stretchr/testify v1.8.1
|
||||
google.golang.org/grpc v1.53.0
|
||||
k8s.io/client-go v0.27.4
|
||||
k8s.io/cri-api v0.27.4
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
|
||||
github.com/fsnotify/fsnotify v1.4.9 // indirect
|
||||
github.com/go-logr/logr v0.4.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
|
||||
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/go-logr/logr v1.2.4 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.1 // indirect
|
||||
github.com/go-openapi/swag v0.22.3 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/google/go-cmp v0.5.5 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/gnostic v0.5.7-v3refs // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/gofuzz v1.1.0 // indirect
|
||||
github.com/google/uuid v1.1.2 // indirect
|
||||
github.com/googleapis/gnostic v0.5.5 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/imdario/mergo v0.3.12 // indirect
|
||||
github.com/joonix/log v0.0.0-20180502111528-d2d3f2f4a806 // indirect
|
||||
github.com/json-iterator/go v1.1.11 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/magiconair/properties v1.8.1 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
|
||||
github.com/mitchellh/mapstructure v1.1.2 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/mitchellh/mapstructure v1.4.1 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.1 // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/pelletier/go-toml v1.2.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/prometheus/client_golang v1.11.0 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.26.0 // indirect
|
||||
github.com/prometheus/procfs v0.6.0 // indirect
|
||||
github.com/prometheus/client_golang v1.15.1 // indirect
|
||||
github.com/prometheus/client_model v0.4.0 // indirect
|
||||
github.com/prometheus/common v0.42.0 // indirect
|
||||
github.com/prometheus/procfs v0.9.0 // indirect
|
||||
github.com/spf13/afero v1.2.2 // indirect
|
||||
github.com/spf13/cast v1.3.0 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.0.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.7.0 // indirect
|
||||
github.com/stretchr/objx v0.2.0 // indirect
|
||||
github.com/stretchr/objx v0.5.0 // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
|
||||
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
|
||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
|
||||
golang.org/x/text v0.3.6 // indirect
|
||||
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/oauth2 v0.5.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/term v0.8.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
|
||||
google.golang.org/protobuf v1.26.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230301171018-9ab4bdc49ad5 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.51.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
k8s.io/api v0.22.1 // indirect
|
||||
k8s.io/apiextensions-apiserver v0.21.1 // indirect
|
||||
k8s.io/apimachinery v0.22.1 // indirect
|
||||
k8s.io/component-base v0.21.1 // indirect
|
||||
k8s.io/klog/v2 v2.9.0 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e // indirect
|
||||
k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9 // indirect
|
||||
sigs.k8s.io/controller-runtime v0.9.0 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
|
||||
sigs.k8s.io/yaml v1.2.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.27.4 // indirect
|
||||
k8s.io/apiextensions-apiserver v0.27.2 // indirect
|
||||
k8s.io/apimachinery v0.27.4 // indirect
|
||||
k8s.io/component-base v0.27.2 // indirect
|
||||
k8s.io/klog/v2 v2.90.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
|
||||
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
|
||||
sigs.k8s.io/controller-runtime v0.15.0 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
)
|
||||
|
@ -52,7 +52,7 @@ spec:
|
||||
serviceAccountName: octops-controller
|
||||
containers:
|
||||
- name: octops-image-syncer
|
||||
image: octops/octops-image-syncer:v0.1.0
|
||||
image: octops/octops-image-syncer:v0.1.1
|
||||
imagePullPolicy: Never
|
||||
ports:
|
||||
- name: http
|
||||
|
7
main.go
7
main.go
@ -3,13 +3,14 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/Octops/octops-image-syncer/cmd"
|
||||
"github.com/Octops/octops-image-syncer/internal/version"
|
||||
"github.com/Octops/octops-image-syncer/pkg/runtime/log"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -3,7 +3,8 @@ package clients
|
||||
import (
|
||||
"context"
|
||||
"google.golang.org/grpc"
|
||||
pb "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
|
||||
|
||||
pb "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
)
|
||||
|
||||
type ImageServiceClient struct {
|
||||
|
@ -1,14 +1,15 @@
|
||||
package syncer
|
||||
|
||||
import (
|
||||
v1 "agones.dev/agones/pkg/apis/agones/v1"
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
v1 "agones.dev/agones/pkg/apis/agones/v1"
|
||||
"github.com/Octops/agones-event-broadcaster/pkg/events"
|
||||
"github.com/Octops/octops-image-syncer/pkg/runtime/log"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
pb "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
|
||||
"reflect"
|
||||
pb "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
)
|
||||
|
||||
type ImageServiceClient interface {
|
||||
|
@ -2,11 +2,12 @@ package syncer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
pb "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
|
||||
"testing"
|
||||
pb "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
)
|
||||
|
||||
func TestFleetImageSyncer_PullImage(t *testing.T) {
|
||||
|
@ -1,14 +1,15 @@
|
||||
package watcher
|
||||
|
||||
import (
|
||||
v1 "agones.dev/agones/pkg/apis/agones/v1"
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1 "agones.dev/agones/pkg/apis/agones/v1"
|
||||
"github.com/Octops/agones-event-broadcaster/pkg/broadcaster"
|
||||
"github.com/Octops/agones-event-broadcaster/pkg/brokers"
|
||||
"github.com/Octops/octops-image-syncer/pkg/runtime/log"
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/client-go/rest"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@ -39,12 +40,11 @@ func NewFleetWatcher(config *Config, imageSyncer ImageSyncer) (*FleetWatcher, er
|
||||
|
||||
func (f *FleetWatcher) Start(ctx context.Context) error {
|
||||
go func() {
|
||||
if err := f.broadcaster.Start(); err != nil {
|
||||
if err := f.broadcaster.Start(ctx); err != nil {
|
||||
log.Logger().WithError(err).Fatal("error starting broadcaster")
|
||||
}
|
||||
}()
|
||||
|
||||
//TODO: refactor broadcaster to accept ctx on Start method
|
||||
<-ctx.Done()
|
||||
|
||||
log.Logger().Info("shutting down syncer")
|
||||
|
Reference in New Issue
Block a user