Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
k8s-ingress
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
uplex-varnish
k8s-ingress
Commits
556f81fc
Commit
556f81fc
authored
Dec 20, 2019
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to client-go for k8s 1.16.4.
parent
12b3a8c3
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
340 additions
and
142 deletions
+340
-142
Makefile
Makefile
+1
-1
go.mod
go.mod
+4
-26
go.sum
go.sum
+155
-43
zz_generated.deepcopy.go
pkg/apis/varnishingress/v1alpha1/zz_generated.deepcopy.go
+2
-2
clientset.go
pkg/client/clientset/versioned/clientset.go
+7
-10
clientset_generated.go
pkg/client/clientset/versioned/fake/clientset_generated.go
+18
-9
register.go
pkg/client/clientset/versioned/fake/register.go
+9
-8
register.go
pkg/client/clientset/versioned/scheme/register.go
+9
-8
backendconfig.go
.../versioned/typed/varnishingress/v1alpha1/backendconfig.go
+17
-0
fake_backendconfig.go
.../typed/varnishingress/v1alpha1/fake/fake_backendconfig.go
+2
-2
fake_varnishconfig.go
.../typed/varnishingress/v1alpha1/fake/fake_varnishconfig.go
+2
-2
varnishconfig.go
.../versioned/typed/varnishingress/v1alpha1/varnishconfig.go
+17
-0
varnishingress_client.go
...ed/typed/varnishingress/v1alpha1/varnishingress_client.go
+1
-2
factory.go
pkg/client/informers/externalversions/factory.go
+55
-8
generic.go
pkg/client/informers/externalversions/generic.go
+0
-2
factory_interfaces.go
...externalversions/internalinterfaces/factory_interfaces.go
+2
-2
interface.go
...nt/informers/externalversions/varnishingress/interface.go
+1
-3
backendconfig.go
...externalversions/varnishingress/v1alpha1/backendconfig.go
+0
-2
interface.go
...ers/externalversions/varnishingress/v1alpha1/interface.go
+0
-2
varnishconfig.go
...externalversions/varnishingress/v1alpha1/varnishconfig.go
+0
-2
backendconfig.go
pkg/client/listers/varnishingress/v1alpha1/backendconfig.go
+0
-2
expansion_generated.go
...nt/listers/varnishingress/v1alpha1/expansion_generated.go
+0
-2
varnishconfig.go
pkg/client/listers/varnishingress/v1alpha1/varnishconfig.go
+0
-2
metrics.go
pkg/controller/metrics.go
+38
-2
No files found.
Makefile
View file @
556f81fc
...
...
@@ -26,7 +26,7 @@
all
:
k8s-ingress
KUBEVER
=
kubernetes-1.
9.11
KUBEVER
=
kubernetes-1.
16.4
install-code-gen
:
go get k8s.io/code-generator/cmd/client-gen@
$(KUBEVER)
go get k8s.io/code-generator/cmd/deepcopy-gen@
$(KUBEVER)
...
...
go.mod
View file @
556f81fc
...
...
@@ -2,36 +2,14 @@ module code.uplex.de/uplex-varnish/k8s-ingress
require (
code.uplex.de/uplex-varnish/varnishapi v0.0.0-20181209154204-43826850baae
github.com/emicklei/go-restful v2.8.0+incompatible // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-openapi/spec v0.18.0 // indirect
github.com/gogo/protobuf v1.2.0 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff // indirect
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c // indirect
github.com/google/go-cmp v0.2.0
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf // indirect
github.com/google/go-cmp v0.3.0
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f // indirect
github.com/hashicorp/golang-lru v0.5.0 // indirect
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/json-iterator/go v1.1.5 // indirect
github.com/juju/ratelimit v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/onsi/ginkgo v1.7.0 // indirect
github.com/onsi/gomega v1.4.3 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/prometheus/client_golang v0.9.2
github.com/sirupsen/logrus v1.2.0
github.com/spf13/pflag v1.0.3 // indirect
golang.org/x/net v0.0.0-20190311183353-d8887717615a // indirect
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.2.2 // indirect
k8s.io/api v0.0.0-20181221193117-173ce66c1e39
k8s.io/apimachinery v0.0.0-20180925215425-1926e7bb5c13
k8s.io/client-go v6.0.1-0.20180515144434-1692bdde78a6+incompatible
k8s.io/kube-openapi v0.0.0-20181114233023-0317810137be // indirect
k8s.io/api v0.16.4
k8s.io/apimachinery v0.16.4
k8s.io/client-go v0.16.4
)
go.sum
View file @
556f81fc
This diff is collapsed.
Click to expand it.
pkg/apis/varnishingress/v1alpha1/zz_generated.deepcopy.go
View file @
556f81fc
...
...
@@ -145,7 +145,7 @@ func (in *BackendConfig) DeepCopyObject() runtime.Object {
func
(
in
*
BackendConfigList
)
DeepCopyInto
(
out
*
BackendConfigList
)
{
*
out
=
*
in
out
.
TypeMeta
=
in
.
TypeMeta
out
.
ListMeta
=
in
.
ListMeta
in
.
ListMeta
.
DeepCopyInto
(
&
out
.
ListMeta
)
if
in
.
Items
!=
nil
{
in
,
out
:=
&
in
.
Items
,
&
out
.
Items
*
out
=
make
([]
BackendConfig
,
len
(
*
in
))
...
...
@@ -501,7 +501,7 @@ func (in *VarnishConfig) DeepCopyObject() runtime.Object {
func
(
in
*
VarnishConfigList
)
DeepCopyInto
(
out
*
VarnishConfigList
)
{
*
out
=
*
in
out
.
TypeMeta
=
in
.
TypeMeta
out
.
ListMeta
=
in
.
ListMeta
in
.
ListMeta
.
DeepCopyInto
(
&
out
.
ListMeta
)
if
in
.
Items
!=
nil
{
in
,
out
:=
&
in
.
Items
,
&
out
.
Items
*
out
=
make
([]
VarnishConfig
,
len
(
*
in
))
...
...
pkg/client/clientset/versioned/clientset.go
View file @
556f81fc
...
...
@@ -29,8 +29,9 @@
package
versioned
import
(
"fmt"
ingressv1alpha1
"code.uplex.de/uplex-varnish/k8s-ingress/pkg/client/clientset/versioned/typed/varnishingress/v1alpha1"
glog
"github.com/golang/glog"
discovery
"k8s.io/client-go/discovery"
rest
"k8s.io/client-go/rest"
flowcontrol
"k8s.io/client-go/util/flowcontrol"
...
...
@@ -39,8 +40,6 @@ import (
type
Interface
interface
{
Discovery
()
discovery
.
DiscoveryInterface
IngressV1alpha1
()
ingressv1alpha1
.
IngressV1alpha1Interface
// Deprecated: please explicitly pick a version if possible.
Ingress
()
ingressv1alpha1
.
IngressV1alpha1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
...
...
@@ -55,12 +54,6 @@ func (c *Clientset) IngressV1alpha1() ingressv1alpha1.IngressV1alpha1Interface {
return
c
.
ingressV1alpha1
}
// Deprecated: Ingress retrieves the default version of IngressClient.
// Please explicitly pick a version.
func
(
c
*
Clientset
)
Ingress
()
ingressv1alpha1
.
IngressV1alpha1Interface
{
return
c
.
ingressV1alpha1
}
// Discovery retrieves the DiscoveryClient
func
(
c
*
Clientset
)
Discovery
()
discovery
.
DiscoveryInterface
{
if
c
==
nil
{
...
...
@@ -70,9 +63,14 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface {
}
// NewForConfig creates a new Clientset for the given config.
// If config's RateLimiter is not set and QPS and Burst are acceptable,
// NewForConfig will generate a rate-limiter in configShallowCopy.
func
NewForConfig
(
c
*
rest
.
Config
)
(
*
Clientset
,
error
)
{
configShallowCopy
:=
*
c
if
configShallowCopy
.
RateLimiter
==
nil
&&
configShallowCopy
.
QPS
>
0
{
if
configShallowCopy
.
Burst
<=
0
{
return
nil
,
fmt
.
Errorf
(
"Burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0"
)
}
configShallowCopy
.
RateLimiter
=
flowcontrol
.
NewTokenBucketRateLimiter
(
configShallowCopy
.
QPS
,
configShallowCopy
.
Burst
)
}
var
cs
Clientset
...
...
@@ -84,7 +82,6 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
cs
.
DiscoveryClient
,
err
=
discovery
.
NewDiscoveryClientForConfig
(
&
configShallowCopy
)
if
err
!=
nil
{
glog
.
Errorf
(
"failed to create the DiscoveryClient: %v"
,
err
)
return
nil
,
err
}
return
&
cs
,
nil
...
...
pkg/client/clientset/versioned/fake/clientset_generated.go
View file @
556f81fc
...
...
@@ -51,11 +51,20 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
}
}
fakePtr
:=
testing
.
Fake
{}
fakePtr
.
AddReactor
(
"*"
,
"*"
,
testing
.
ObjectReaction
(
o
))
fakePtr
.
AddWatchReactor
(
"*"
,
testing
.
DefaultWatchReactor
(
watch
.
NewFake
(),
nil
))
cs
:=
&
Clientset
{
tracker
:
o
}
cs
.
discovery
=
&
fakediscovery
.
FakeDiscovery
{
Fake
:
&
cs
.
Fake
}
cs
.
AddReactor
(
"*"
,
"*"
,
testing
.
ObjectReaction
(
o
))
cs
.
AddWatchReactor
(
"*"
,
func
(
action
testing
.
Action
)
(
handled
bool
,
ret
watch
.
Interface
,
err
error
)
{
gvr
:=
action
.
GetResource
()
ns
:=
action
.
GetNamespace
()
watch
,
err
:=
o
.
Watch
(
gvr
,
ns
)
if
err
!=
nil
{
return
false
,
nil
,
err
}
return
true
,
watch
,
nil
})
return
&
Clientset
{
fakePtr
,
&
fakediscovery
.
FakeDiscovery
{
Fake
:
&
fakePtr
}}
return
cs
}
// Clientset implements clientset.Interface. Meant to be embedded into a
...
...
@@ -64,20 +73,20 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
type
Clientset
struct
{
testing
.
Fake
discovery
*
fakediscovery
.
FakeDiscovery
tracker
testing
.
ObjectTracker
}
func
(
c
*
Clientset
)
Discovery
()
discovery
.
DiscoveryInterface
{
return
c
.
discovery
}
func
(
c
*
Clientset
)
Tracker
()
testing
.
ObjectTracker
{
return
c
.
tracker
}
var
_
clientset
.
Interface
=
&
Clientset
{}
// IngressV1alpha1 retrieves the IngressV1alpha1Client
func
(
c
*
Clientset
)
IngressV1alpha1
()
ingressv1alpha1
.
IngressV1alpha1Interface
{
return
&
fakeingressv1alpha1
.
FakeIngressV1alpha1
{
Fake
:
&
c
.
Fake
}
}
// Ingress retrieves the IngressV1alpha1Client
func
(
c
*
Clientset
)
Ingress
()
ingressv1alpha1
.
IngressV1alpha1Interface
{
return
&
fakeingressv1alpha1
.
FakeIngressV1alpha1
{
Fake
:
&
c
.
Fake
}
}
pkg/client/clientset/versioned/fake/register.go
View file @
556f81fc
...
...
@@ -34,15 +34,14 @@ import (
runtime
"k8s.io/apimachinery/pkg/runtime"
schema
"k8s.io/apimachinery/pkg/runtime/schema"
serializer
"k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime
"k8s.io/apimachinery/pkg/util/runtime"
)
var
scheme
=
runtime
.
NewScheme
()
var
codecs
=
serializer
.
NewCodecFactory
(
scheme
)
var
parameterCodec
=
runtime
.
NewParameterCodec
(
scheme
)
func
init
()
{
v1
.
AddToGroupVersion
(
scheme
,
schema
.
GroupVersion
{
Version
:
"v1"
})
AddToScheme
(
scheme
)
var
localSchemeBuilder
=
runtime
.
SchemeBuilder
{
ingressv1alpha1
.
AddToScheme
,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
...
...
@@ -50,16 +49,18 @@ func init() {
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kuber
en
tes/scheme"
// clientsetscheme "k8s.io/client-go/kuber
ne
tes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
_ =
aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
func
AddToScheme
(
scheme
*
runtime
.
Scheme
)
{
ingressv1alpha1
.
AddToScheme
(
scheme
)
var
AddToScheme
=
localSchemeBuilder
.
AddToScheme
func
init
()
{
v1
.
AddToGroupVersion
(
scheme
,
schema
.
GroupVersion
{
Version
:
"v1"
})
utilruntime
.
Must
(
AddToScheme
(
scheme
))
}
pkg/client/clientset/versioned/scheme/register.go
View file @
556f81fc
...
...
@@ -34,15 +34,14 @@ import (
runtime
"k8s.io/apimachinery/pkg/runtime"
schema
"k8s.io/apimachinery/pkg/runtime/schema"
serializer
"k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime
"k8s.io/apimachinery/pkg/util/runtime"
)
var
Scheme
=
runtime
.
NewScheme
()
var
Codecs
=
serializer
.
NewCodecFactory
(
Scheme
)
var
ParameterCodec
=
runtime
.
NewParameterCodec
(
Scheme
)
func
init
()
{
v1
.
AddToGroupVersion
(
Scheme
,
schema
.
GroupVersion
{
Version
:
"v1"
})
AddToScheme
(
Scheme
)
var
localSchemeBuilder
=
runtime
.
SchemeBuilder
{
ingressv1alpha1
.
AddToScheme
,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
...
...
@@ -50,16 +49,18 @@ func init() {
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kuber
en
tes/scheme"
// clientsetscheme "k8s.io/client-go/kuber
ne
tes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
_ =
aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
func
AddToScheme
(
scheme
*
runtime
.
Scheme
)
{
ingressv1alpha1
.
AddToScheme
(
scheme
)
var
AddToScheme
=
localSchemeBuilder
.
AddToScheme
func
init
()
{
v1
.
AddToGroupVersion
(
Scheme
,
schema
.
GroupVersion
{
Version
:
"v1"
})
utilruntime
.
Must
(
AddToScheme
(
Scheme
))
}
pkg/client/clientset/versioned/typed/varnishingress/v1alpha1/backendconfig.go
View file @
556f81fc
...
...
@@ -29,6 +29,8 @@
package
v1alpha1
import
(
"time"
v1alpha1
"code.uplex.de/uplex-varnish/k8s-ingress/pkg/apis/varnishingress/v1alpha1"
scheme
"code.uplex.de/uplex-varnish/k8s-ingress/pkg/client/clientset/versioned/scheme"
v1
"k8s.io/apimachinery/pkg/apis/meta/v1"
...
...
@@ -85,11 +87,16 @@ func (c *backendConfigs) Get(name string, options v1.GetOptions) (result *v1alph
// List takes label and field selectors, and returns the list of BackendConfigs that match those selectors.
func
(
c
*
backendConfigs
)
List
(
opts
v1
.
ListOptions
)
(
result
*
v1alpha1
.
BackendConfigList
,
err
error
)
{
var
timeout
time
.
Duration
if
opts
.
TimeoutSeconds
!=
nil
{
timeout
=
time
.
Duration
(
*
opts
.
TimeoutSeconds
)
*
time
.
Second
}
result
=
&
v1alpha1
.
BackendConfigList
{}
err
=
c
.
client
.
Get
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"backendconfigs"
)
.
VersionedParams
(
&
opts
,
scheme
.
ParameterCodec
)
.
Timeout
(
timeout
)
.
Do
()
.
Into
(
result
)
return
...
...
@@ -97,11 +104,16 @@ func (c *backendConfigs) List(opts v1.ListOptions) (result *v1alpha1.BackendConf
// Watch returns a watch.Interface that watches the requested backendConfigs.
func
(
c
*
backendConfigs
)
Watch
(
opts
v1
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
var
timeout
time
.
Duration
if
opts
.
TimeoutSeconds
!=
nil
{
timeout
=
time
.
Duration
(
*
opts
.
TimeoutSeconds
)
*
time
.
Second
}
opts
.
Watch
=
true
return
c
.
client
.
Get
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"backendconfigs"
)
.
VersionedParams
(
&
opts
,
scheme
.
ParameterCodec
)
.
Timeout
(
timeout
)
.
Watch
()
}
...
...
@@ -143,10 +155,15 @@ func (c *backendConfigs) Delete(name string, options *v1.DeleteOptions) error {
// DeleteCollection deletes a collection of objects.
func
(
c
*
backendConfigs
)
DeleteCollection
(
options
*
v1
.
DeleteOptions
,
listOptions
v1
.
ListOptions
)
error
{
var
timeout
time
.
Duration
if
listOptions
.
TimeoutSeconds
!=
nil
{
timeout
=
time
.
Duration
(
*
listOptions
.
TimeoutSeconds
)
*
time
.
Second
}
return
c
.
client
.
Delete
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"backendconfigs"
)
.
VersionedParams
(
&
listOptions
,
scheme
.
ParameterCodec
)
.
Timeout
(
timeout
)
.
Body
(
options
)
.
Do
()
.
Error
()
...
...
pkg/client/clientset/versioned/typed/varnishingress/v1alpha1/fake/fake_backendconfig.go
View file @
556f81fc
...
...
@@ -72,7 +72,7 @@ func (c *FakeBackendConfigs) List(opts v1.ListOptions) (result *v1alpha1.Backend
if
label
==
nil
{
label
=
labels
.
Everything
()
}
list
:=
&
v1alpha1
.
BackendConfigList
{}
list
:=
&
v1alpha1
.
BackendConfigList
{
ListMeta
:
obj
.
(
*
v1alpha1
.
BackendConfigList
)
.
ListMeta
}
for
_
,
item
:=
range
obj
.
(
*
v1alpha1
.
BackendConfigList
)
.
Items
{
if
label
.
Matches
(
labels
.
Set
(
item
.
Labels
))
{
list
.
Items
=
append
(
list
.
Items
,
item
)
...
...
@@ -129,7 +129,7 @@ func (c *FakeBackendConfigs) DeleteCollection(options *v1.DeleteOptions, listOpt
// Patch applies the patch and returns the patched backendConfig.
func
(
c
*
FakeBackendConfigs
)
Patch
(
name
string
,
pt
types
.
PatchType
,
data
[]
byte
,
subresources
...
string
)
(
result
*
v1alpha1
.
BackendConfig
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
testing
.
NewPatchSubresourceAction
(
backendconfigsResource
,
c
.
ns
,
name
,
data
,
subresources
...
),
&
v1alpha1
.
BackendConfig
{})
Invokes
(
testing
.
NewPatchSubresourceAction
(
backendconfigsResource
,
c
.
ns
,
name
,
pt
,
data
,
subresources
...
),
&
v1alpha1
.
BackendConfig
{})
if
obj
==
nil
{
return
nil
,
err
...
...
pkg/client/clientset/versioned/typed/varnishingress/v1alpha1/fake/fake_varnishconfig.go
View file @
556f81fc
...
...
@@ -72,7 +72,7 @@ func (c *FakeVarnishConfigs) List(opts v1.ListOptions) (result *v1alpha1.Varnish
if
label
==
nil
{
label
=
labels
.
Everything
()
}
list
:=
&
v1alpha1
.
VarnishConfigList
{}
list
:=
&
v1alpha1
.
VarnishConfigList
{
ListMeta
:
obj
.
(
*
v1alpha1
.
VarnishConfigList
)
.
ListMeta
}
for
_
,
item
:=
range
obj
.
(
*
v1alpha1
.
VarnishConfigList
)
.
Items
{
if
label
.
Matches
(
labels
.
Set
(
item
.
Labels
))
{
list
.
Items
=
append
(
list
.
Items
,
item
)
...
...
@@ -129,7 +129,7 @@ func (c *FakeVarnishConfigs) DeleteCollection(options *v1.DeleteOptions, listOpt
// Patch applies the patch and returns the patched varnishConfig.
func
(
c
*
FakeVarnishConfigs
)
Patch
(
name
string
,
pt
types
.
PatchType
,
data
[]
byte
,
subresources
...
string
)
(
result
*
v1alpha1
.
VarnishConfig
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
testing
.
NewPatchSubresourceAction
(
varnishconfigsResource
,
c
.
ns
,
name
,
data
,
subresources
...
),
&
v1alpha1
.
VarnishConfig
{})
Invokes
(
testing
.
NewPatchSubresourceAction
(
varnishconfigsResource
,
c
.
ns
,
name
,
pt
,
data
,
subresources
...
),
&
v1alpha1
.
VarnishConfig
{})
if
obj
==
nil
{
return
nil
,
err
...
...
pkg/client/clientset/versioned/typed/varnishingress/v1alpha1/varnishconfig.go
View file @
556f81fc
...
...
@@ -29,6 +29,8 @@
package
v1alpha1
import
(
"time"
v1alpha1
"code.uplex.de/uplex-varnish/k8s-ingress/pkg/apis/varnishingress/v1alpha1"
scheme
"code.uplex.de/uplex-varnish/k8s-ingress/pkg/client/clientset/versioned/scheme"
v1
"k8s.io/apimachinery/pkg/apis/meta/v1"
...
...
@@ -85,11 +87,16 @@ func (c *varnishConfigs) Get(name string, options v1.GetOptions) (result *v1alph
// List takes label and field selectors, and returns the list of VarnishConfigs that match those selectors.
func
(
c
*
varnishConfigs
)
List
(
opts
v1
.
ListOptions
)
(
result
*
v1alpha1
.
VarnishConfigList
,
err
error
)
{
var
timeout
time
.
Duration
if
opts
.
TimeoutSeconds
!=
nil
{
timeout
=
time
.
Duration
(
*
opts
.
TimeoutSeconds
)
*
time
.
Second
}
result
=
&
v1alpha1
.
VarnishConfigList
{}
err
=
c
.
client
.
Get
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"varnishconfigs"
)
.
VersionedParams
(
&
opts
,
scheme
.
ParameterCodec
)
.
Timeout
(
timeout
)
.
Do
()
.
Into
(
result
)
return
...
...
@@ -97,11 +104,16 @@ func (c *varnishConfigs) List(opts v1.ListOptions) (result *v1alpha1.VarnishConf
// Watch returns a watch.Interface that watches the requested varnishConfigs.
func
(
c
*
varnishConfigs
)
Watch
(
opts
v1
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
var
timeout
time
.
Duration
if
opts
.
TimeoutSeconds
!=
nil
{
timeout
=
time
.
Duration
(
*
opts
.
TimeoutSeconds
)
*
time
.
Second
}
opts
.
Watch
=
true
return
c
.
client
.
Get
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"varnishconfigs"
)
.
VersionedParams
(
&
opts
,
scheme
.
ParameterCodec
)
.
Timeout
(
timeout
)
.
Watch
()
}
...
...
@@ -143,10 +155,15 @@ func (c *varnishConfigs) Delete(name string, options *v1.DeleteOptions) error {
// DeleteCollection deletes a collection of objects.
func
(
c
*
varnishConfigs
)
DeleteCollection
(
options
*
v1
.
DeleteOptions
,
listOptions
v1
.
ListOptions
)
error
{
var
timeout
time
.
Duration
if
listOptions
.
TimeoutSeconds
!=
nil
{
timeout
=
time
.
Duration
(
*
listOptions
.
TimeoutSeconds
)
*
time
.
Second
}
return
c
.
client
.
Delete
()
.
Namespace
(
c
.
ns
)
.
Resource
(
"varnishconfigs"
)
.
VersionedParams
(
&
listOptions
,
scheme
.
ParameterCodec
)
.
Timeout
(
timeout
)
.
Body
(
options
)
.
Do
()
.
Error
()
...
...
pkg/client/clientset/versioned/typed/varnishingress/v1alpha1/varnishingress_client.go
View file @
556f81fc
...
...
@@ -31,7 +31,6 @@ package v1alpha1
import
(
v1alpha1
"code.uplex.de/uplex-varnish/k8s-ingress/pkg/apis/varnishingress/v1alpha1"
"code.uplex.de/uplex-varnish/k8s-ingress/pkg/client/clientset/versioned/scheme"
serializer
"k8s.io/apimachinery/pkg/runtime/serializer"
rest
"k8s.io/client-go/rest"
)
...
...
@@ -86,7 +85,7 @@ func setConfigDefaults(config *rest.Config) error {
gv
:=
v1alpha1
.
SchemeGroupVersion
config
.
GroupVersion
=
&
gv
config
.
APIPath
=
"/apis"
config
.
NegotiatedSerializer
=
s
erializer
.
DirectCodecFactory
{
CodecFactory
:
scheme
.
Codecs
}
config
.
NegotiatedSerializer
=
s
cheme
.
Codecs
.
WithoutConversion
()
if
config
.
UserAgent
==
""
{
config
.
UserAgent
=
rest
.
DefaultKubernetesUserAgent
()
...
...
pkg/client/informers/externalversions/factory.go
View file @
556f81fc
...
...
@@ -26,8 +26,6 @@
// Code generated by informer-gen. DO NOT EDIT.
// This file was automatically generated by informer-gen
package
externalversions
import
(
...
...
@@ -44,12 +42,16 @@ import (
cache
"k8s.io/client-go/tools/cache"
)
// SharedInformerOption defines the functional option type for SharedInformerFactory.
type
SharedInformerOption
func
(
*
sharedInformerFactory
)
*
sharedInformerFactory
type
sharedInformerFactory
struct
{
client
versioned
.
Interface
namespace
string
tweakListOptions
internalinterfaces
.
TweakListOptionsFunc
lock
sync
.
Mutex
defaultResync
time
.
Duration
customResync
map
[
reflect
.
Type
]
time
.
Duration
informers
map
[
reflect
.
Type
]
cache
.
SharedIndexInformer
// startedInformers is used for tracking which informers have been started.
...
...
@@ -57,23 +59,62 @@ type sharedInformerFactory struct {
startedInformers
map
[
reflect
.
Type
]
bool
}
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory
// WithCustomResyncConfig sets a custom resync period for the specified informer types.
func
WithCustomResyncConfig
(
resyncConfig
map
[
v1
.
Object
]
time
.
Duration
)
SharedInformerOption
{
return
func
(
factory
*
sharedInformerFactory
)
*
sharedInformerFactory
{
for
k
,
v
:=
range
resyncConfig
{
factory
.
customResync
[
reflect
.
TypeOf
(
k
)]
=
v
}
return
factory
}
}
// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory.
func
WithTweakListOptions
(
tweakListOptions
internalinterfaces
.
TweakListOptionsFunc
)
SharedInformerOption
{
return
func
(
factory
*
sharedInformerFactory
)
*
sharedInformerFactory
{
factory
.
tweakListOptions
=
tweakListOptions
return
factory
}
}
// WithNamespace limits the SharedInformerFactory to the specified namespace.
func
WithNamespace
(
namespace
string
)
SharedInformerOption
{
return
func
(
factory
*
sharedInformerFactory
)
*
sharedInformerFactory
{
factory
.
namespace
=
namespace
return
factory
}
}
// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces.
func
NewSharedInformerFactory
(
client
versioned
.
Interface
,
defaultResync
time
.
Duration
)
SharedInformerFactory
{
return
New
FilteredSharedInformerFactory
(
client
,
defaultResync
,
v1
.
NamespaceAll
,
nil
)
return
New
SharedInformerFactoryWithOptions
(
client
,
defaultResync
)
}
// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory.
// Listers obtained via this SharedInformerFactory will be subject to the same filters
// as specified here.
// Deprecated: Please use NewSharedInformerFactoryWithOptions instead
func
NewFilteredSharedInformerFactory
(
client
versioned
.
Interface
,
defaultResync
time
.
Duration
,
namespace
string
,
tweakListOptions
internalinterfaces
.
TweakListOptionsFunc
)
SharedInformerFactory
{
return
&
sharedInformerFactory
{
return
NewSharedInformerFactoryWithOptions
(
client
,
defaultResync
,
WithNamespace
(
namespace
),
WithTweakListOptions
(
tweakListOptions
))
}
// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options.
func
NewSharedInformerFactoryWithOptions
(
client
versioned
.
Interface
,
defaultResync
time
.
Duration
,
options
...
SharedInformerOption
)
SharedInformerFactory
{
factory
:=
&
sharedInformerFactory
{
client
:
client
,
namespace
:
namespace
,
tweakListOptions
:
tweakListOptions
,
namespace
:
v1
.
NamespaceAll
,
defaultResync
:
defaultResync
,
informers
:
make
(
map
[
reflect
.
Type
]
cache
.
SharedIndexInformer
),
startedInformers
:
make
(
map
[
reflect
.
Type
]
bool
),
customResync
:
make
(
map
[
reflect
.
Type
]
time
.
Duration
),
}
// Apply all options
for
_
,
opt
:=
range
options
{
factory
=
opt
(
factory
)
}
return
factory
}
// Start initializes all requested informers.
...
...
@@ -122,7 +163,13 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal
if
exists
{
return
informer
}
informer
=
newFunc
(
f
.
client
,
f
.
defaultResync
)
resyncPeriod
,
exists
:=
f
.
customResync
[
informerType
]
if
!
exists
{
resyncPeriod
=
f
.
defaultResync
}
informer
=
newFunc
(
f
.
client
,
resyncPeriod
)
f
.
informers
[
informerType
]
=
informer
return
informer
...
...
pkg/client/informers/externalversions/generic.go
View file @
556f81fc
...
...
@@ -26,8 +26,6 @@
// Code generated by informer-gen. DO NOT EDIT.
// This file was automatically generated by informer-gen
package
externalversions
import
(
...
...
pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go
View file @
556f81fc
...
...
@@ -26,8 +26,6 @@
// Code generated by informer-gen. DO NOT EDIT.
// This file was automatically generated by informer-gen
package
internalinterfaces
import
(
...
...
@@ -39,6 +37,7 @@ import (
cache
"k8s.io/client-go/tools/cache"
)
// NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer.
type
NewInformerFunc
func
(
versioned
.
Interface
,
time
.
Duration
)
cache
.
SharedIndexInformer
// SharedInformerFactory a small interface to allow for adding an informer without an import cycle
...
...
@@ -47,4 +46,5 @@ type SharedInformerFactory interface {
InformerFor
(
obj
runtime
.
Object
,
newFunc
NewInformerFunc
)
cache
.
SharedIndexInformer
}
// TweakListOptionsFunc is a function that transforms a v1.ListOptions.
type
TweakListOptionsFunc
func
(
*
v1
.
ListOptions
)
pkg/client/informers/externalversions/varnishingress/interface.go
View file @
556f81fc
...
...
@@ -26,9 +26,7 @@
// Code generated by informer-gen. DO NOT EDIT.
// This file was automatically generated by informer-gen
package
ingress
package
varnishingress
import
(
internalinterfaces
"code.uplex.de/uplex-varnish/k8s-ingress/pkg/client/informers/externalversions/internalinterfaces"
...
...
pkg/client/informers/externalversions/varnishingress/v1alpha1/backendconfig.go
View file @
556f81fc
...
...
@@ -26,8 +26,6 @@
// Code generated by informer-gen. DO NOT EDIT.
// This file was automatically generated by informer-gen
package
v1alpha1
import
(
...
...
pkg/client/informers/externalversions/varnishingress/v1alpha1/interface.go
View file @
556f81fc
...
...
@@ -26,8 +26,6 @@
// Code generated by informer-gen. DO NOT EDIT.
// This file was automatically generated by informer-gen
package
v1alpha1
import
(
...
...
pkg/client/informers/externalversions/varnishingress/v1alpha1/varnishconfig.go
View file @
556f81fc
...
...
@@ -26,8 +26,6 @@
// Code generated by informer-gen. DO NOT EDIT.
// This file was automatically generated by informer-gen
package
v1alpha1
import
(
...
...
pkg/client/listers/varnishingress/v1alpha1/backendconfig.go
View file @
556f81fc
...
...
@@ -26,8 +26,6 @@
// Code generated by lister-gen. DO NOT EDIT.
// This file was automatically generated by lister-gen
package
v1alpha1
import
(
...
...
pkg/client/listers/varnishingress/v1alpha1/expansion_generated.go
View file @
556f81fc
...
...
@@ -26,8 +26,6 @@
// Code generated by lister-gen. DO NOT EDIT.
// This file was automatically generated by lister-gen
package
v1alpha1
// BackendConfigListerExpansion allows custom methods to be added to
...
...
pkg/client/listers/varnishingress/v1alpha1/varnishconfig.go
View file @
556f81fc
...
...
@@ -26,8 +26,6 @@
// Code generated by lister-gen. DO NOT EDIT.
// This file was automatically generated by lister-gen
package
v1alpha1
import
(
...
...
pkg/controller/metrics.go
View file @
556f81fc
...
...
@@ -75,7 +75,7 @@ func (promProvider) NewAddsMetric(name string) workqueue.CounterMetric {
return
adds
}
func
(
promProvider
)
NewLatencyMetric
(
name
string
)
workqueue
.
Summary
Metric
{
func
(
promProvider
)
NewLatencyMetric
(
name
string
)
workqueue
.
Histogram
Metric
{
label
:=
make
(
map
[
string
]
string
)
label
[
"namespace"
]
=
name
latency
:=
prometheus
.
NewSummary
(
prometheus
.
SummaryOpts
{
...
...
@@ -90,7 +90,9 @@ func (promProvider) NewLatencyMetric(name string) workqueue.SummaryMetric {
return
latency
}
func
(
promProvider
)
NewWorkDurationMetric
(
name
string
)
workqueue
.
SummaryMetric
{
func
(
promProvider
)
NewWorkDurationMetric
(
name
string
)
workqueue
.
HistogramMetric
{
label
:=
make
(
map
[
string
]
string
)
label
[
"namespace"
]
=
name
workDuration
:=
prometheus
.
NewSummary
(
prometheus
.
SummaryOpts
{
...
...
@@ -119,6 +121,40 @@ func (promProvider) NewRetriesMetric(name string) workqueue.CounterMetric {
return
retries
}
func
(
promProvider
)
NewLongestRunningProcessorSecondsMetric
(
name
string
)
workqueue
.
SettableGaugeMetric
{
label
:=
make
(
map
[
string
]
string
)
label
[
"namespace"
]
=
name
longest
:=
prometheus
.
NewGauge
(
prometheus
.
GaugeOpts
{
Subsystem
:
workqSubsystem
,
Namespace
:
namespace
,
Name
:
"longest_running_seconds"
,
Help
:
"Time (in secs) spent by the longest running "
+
"processor in the workqueue"
,
ConstLabels
:
label
,
})
prometheus
.
Register
(
longest
)
return
longest
}
func
(
promProvider
)
NewUnfinishedWorkSecondsMetric
(
name
string
)
workqueue
.
SettableGaugeMetric
{
label
:=
make
(
map
[
string
]
string
)
label
[
"namespace"
]
=
name
unfinished
:=
prometheus
.
NewGauge
(
prometheus
.
GaugeOpts
{
Subsystem
:
workqSubsystem
,
Namespace
:
namespace
,
Name
:
"unfinished_work_seconds"
,
Help
:
"Time (in secs) for work in the workqueue that is not "
+
"yet observed by work_duration_useconds"
,
ConstLabels
:
label
,
})
prometheus
.
Register
(
unfinished
)
return
unfinished
}
var
(
watchCounters
=
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Subsystem
:
"watcher"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment