Skip to content

Commit fbaf9fb

Browse files
authored
Update k8s.io/* dependencies to v0.26.14 (#608)
* Update dependencies (k8s.io/* -> v0.26.14) Signed-off-by: Zak Lawrence <[email protected]> * Handle informer error Signed-off-by: Zak Lawrence <[email protected]> * Update error strings Signed-off-by: Zak Lawrence <[email protected]> --------- Signed-off-by: Zak Lawrence <[email protected]>
1 parent 4543703 commit fbaf9fb

File tree

9 files changed

+596
-855
lines changed

9 files changed

+596
-855
lines changed

cmd/stackset-controller/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ func main() {
126126

127127
go handleSigterm(cancel)
128128
go serveMetrics(config.MetricsAddress)
129-
controller.Run(ctx)
129+
err = controller.Run(ctx)
130+
if err != nil {
131+
cancel()
132+
log.Fatalf("Failed to run controller: %v", err)
133+
}
130134
}
131135

132136
// handleSigterm handles SIGTERM signal sent to the process.

controller/stackset.go

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (c *StackSetController) stackLogger(ssc *core.StackSetContainer, sc *core.S
159159
// Run runs the main loop of the StackSetController. Before the loops it
160160
// sets up a watcher to watch StackSet resources. The watch will send
161161
// changes over a channel which is polled from the main loop.
162-
func (c *StackSetController) Run(ctx context.Context) {
162+
func (c *StackSetController) Run(ctx context.Context) error {
163163
var nextCheck time.Time
164164

165165
// We're not alive if nextCheck is too far in the past
@@ -170,7 +170,10 @@ func (c *StackSetController) Run(ctx context.Context) {
170170
return nil
171171
})
172172

173-
c.startWatch(ctx)
173+
err := c.startWatch(ctx)
174+
if err != nil {
175+
return err
176+
}
174177

175178
http.HandleFunc("/healthz", c.HealthReporter.LiveEndpoint)
176179

@@ -239,7 +242,7 @@ func (c *StackSetController) Run(ctx context.Context) {
239242
c.stacksetStore[stackset.UID] = stackset
240243
case <-ctx.Done():
241244
c.logger.Info("Terminating main controller loop.")
242-
return
245+
return nil
243246
}
244247
}
245248
}
@@ -626,25 +629,30 @@ func (c *StackSetController) hasOwnership(stackset *zv1.StackSet) bool {
626629
return c.controllerID == ""
627630
}
628631

629-
func (c *StackSetController) startWatch(ctx context.Context) {
632+
func (c *StackSetController) startWatch(ctx context.Context) error {
630633
informer := cache.NewSharedIndexInformer(
631634
cache.NewListWatchFromClient(c.client.ZalandoV1().RESTClient(), "stacksets", c.namespace, fields.Everything()),
632635
&zv1.StackSet{},
633636
0, // skip resync
634637
cache.Indexers{},
635638
)
636639

637-
informer.AddEventHandler(cache.ResourceEventHandlerFuncs{
640+
_, err := informer.AddEventHandler(cache.ResourceEventHandlerFuncs{
638641
AddFunc: c.add,
639642
UpdateFunc: c.update,
640643
DeleteFunc: c.del,
641644
})
645+
if err != nil {
646+
return fmt.Errorf("failed to add event handler: %w", err)
647+
}
648+
642649
go informer.Run(ctx.Done())
643650
if !cache.WaitForCacheSync(ctx.Done(), informer.HasSynced) {
644-
c.logger.Errorf("Timed out waiting for caches to sync")
645-
return
651+
return fmt.Errorf("timed out waiting for caches to sync")
646652
}
647653
c.logger.Info("Synced StackSet watcher")
654+
655+
return nil
648656
}
649657

650658
func (c *StackSetController) add(obj interface{}) {
@@ -1147,14 +1155,14 @@ func (c *StackSetController) convertToTrafficSegments(
11471155
if len(ssc.StackContainers) == 0 {
11481156
c.logger.Infof(
11491157
"No stacks found for StackSet %s, safe to delete central "+
1150-
"ingress/routegroup",
1158+
"ingress/routegroup",
11511159
ssc.StackSet.Name,
11521160
)
11531161

11541162
// If we don't have any stacks, we can delete the central ingress
11551163
// resources
11561164
oldEnough := metav1.NewTime(
1157-
time.Now().Add(-c.ingressSourceSwitchTTL-time.Minute),
1165+
time.Now().Add(-c.ingressSourceSwitchTTL - time.Minute),
11581166
)
11591167
ingTimestamp = &oldEnough
11601168
rgTimestamp = &oldEnough

docs/stack_crd.yaml

Lines changed: 220 additions & 226 deletions
Large diffs are not rendered by default.

docs/stackset_crd.yaml

Lines changed: 234 additions & 312 deletions
Large diffs are not rendered by default.

docs/zalando.org_platformcredentialssets.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.10.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.11.4
87
name: platformcredentialssets.zalando.org
98
spec:
109
group: zalando.org

go.mod

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ require (
99
github.com/heptiolabs/healthcheck v0.0.0-20211123025425-613501dd5deb
1010
github.com/prometheus/client_golang v1.19.0
1111
github.com/sirupsen/logrus v1.9.3
12-
github.com/stretchr/testify v1.8.4
13-
github.com/szuecs/routegroup-client v0.25.0
12+
github.com/stretchr/testify v1.9.0
13+
github.com/szuecs/routegroup-client v0.25.2
1414
golang.org/x/sync v0.6.0
15-
k8s.io/api v0.25.16
16-
k8s.io/apimachinery v0.25.16
17-
k8s.io/client-go v0.25.16
18-
k8s.io/code-generator v0.25.16
19-
sigs.k8s.io/controller-tools v0.10.0
15+
k8s.io/api v0.26.14
16+
k8s.io/apimachinery v0.26.14
17+
k8s.io/client-go v0.26.14
18+
k8s.io/code-generator v0.26.14
19+
sigs.k8s.io/controller-tools v0.11.4
2020
sigs.k8s.io/yaml v1.4.0
2121
)
2222

@@ -33,15 +33,15 @@ require (
3333
github.com/go-openapi/jsonpointer v0.20.2 // indirect
3434
github.com/go-openapi/jsonreference v0.20.4 // indirect
3535
github.com/go-openapi/swag v0.22.9 // indirect
36-
github.com/gobuffalo/flect v0.2.5 // indirect
36+
github.com/gobuffalo/flect v0.3.0 // indirect
3737
github.com/gogo/protobuf v1.3.2 // indirect
3838
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3939
github.com/golang/protobuf v1.5.3 // indirect
4040
github.com/google/gnostic v0.5.7-v3refs // indirect
4141
github.com/google/gofuzz v1.2.0 // indirect
4242
github.com/google/uuid v1.6.0 // indirect
4343
github.com/imdario/mergo v0.3.12 // indirect
44-
github.com/inconshreveable/mousetrap v1.0.0 // indirect
44+
github.com/inconshreveable/mousetrap v1.0.1 // indirect
4545
github.com/josharian/intern v1.0.0 // indirect
4646
github.com/json-iterator/go v1.1.12 // indirect
4747
github.com/mailru/easyjson v0.7.7 // indirect
@@ -55,7 +55,7 @@ require (
5555
github.com/prometheus/client_model v0.5.0 // indirect
5656
github.com/prometheus/common v0.48.0 // indirect
5757
github.com/prometheus/procfs v0.12.0 // indirect
58-
github.com/spf13/cobra v1.4.0 // indirect
58+
github.com/spf13/cobra v1.6.1 // indirect
5959
github.com/spf13/pflag v1.0.5 // indirect
6060
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
6161
golang.org/x/mod v0.16.0 // indirect
@@ -72,10 +72,10 @@ require (
7272
gopkg.in/inf.v0 v0.9.1 // indirect
7373
gopkg.in/yaml.v2 v2.4.0 // indirect
7474
gopkg.in/yaml.v3 v3.0.1 // indirect
75-
k8s.io/apiextensions-apiserver v0.25.0 // indirect
75+
k8s.io/apiextensions-apiserver v0.26.1 // indirect
7676
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect
7777
k8s.io/klog/v2 v2.120.1 // indirect
78-
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
78+
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
7979
k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect
8080
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
8181
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect

0 commit comments

Comments
 (0)