Skip to content

Commit 7978fae

Browse files
committed
Cleanup
Signed-off-by: Tamal Saha <[email protected]>
1 parent ea4ae4c commit 7978fae

File tree

7 files changed

+678
-203
lines changed

7 files changed

+678
-203
lines changed

.config/api-rules/violation_exceptions.list

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,CertificateS
66
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,CertificateSpec,EmailAddresses
77
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,CertificateSpec,IPAddresses
88
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,CertificateSpec,URIs
9+
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,ClusterClaimFeatures,DisabledFeatures
10+
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,ClusterClaimFeatures,EnabledFeatures
11+
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,ClusterClaimFeatures,ExternallyManagedFeatures
912
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,ClusterInfo,ClusterManagers
1013
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,ImageInfo,Lineages
1114
API rule violation: list_type_missing,kmodules.xyz/client-go/api/v1,Lineage,Chain

apis/supervisor/v1alpha1/openapi_generated.go

Lines changed: 650 additions & 181 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
k8s.io/client-go v0.32.3
2121
k8s.io/klog/v2 v2.130.1
2222
k8s.io/kube-openapi v0.0.0-20250304201544-e5f78fe3ede9
23-
kmodules.xyz/client-go v0.32.0
23+
kmodules.xyz/client-go v0.32.1
2424
kmodules.xyz/crd-schema-fuzz v0.32.0
2525
kubedb.dev/apimachinery v0.52.1-0.20250318023929-051711da2e5d
2626
sigs.k8s.io/controller-runtime v0.20.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,8 @@ k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJ
633633
k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
634634
kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk=
635635
kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80=
636-
kmodules.xyz/client-go v0.32.0 h1:9KMvG9bKOTiKaDDUniCaxJTdnEwULxi8YLlHJP9spNQ=
637-
kmodules.xyz/client-go v0.32.0/go.mod h1:tqe40/iDtO/RSNaDJs/a+rgnMPSOcK622HpOmOFvcds=
636+
kmodules.xyz/client-go v0.32.1 h1:W8TWGBBaokQEqfesbdhlRFMMV0TChcRbMRQ0eTIRS88=
637+
kmodules.xyz/client-go v0.32.1/go.mod h1:tqe40/iDtO/RSNaDJs/a+rgnMPSOcK622HpOmOFvcds=
638638
kmodules.xyz/crd-schema-fuzz v0.32.0 h1:VATOsnCwmm7SrgnsBWqzcVx+C14l6rNREWrs1leBWaI=
639639
kmodules.xyz/crd-schema-fuzz v0.32.0/go.mod h1:Fh2q+q60ZoQ6NQX0CWtZuXmu+Lnu8o1HofTaBBX7wYk=
640640
kmodules.xyz/custom-resources v0.30.2-0.20250303080226-05eb1392c05f h1:JLpRh71RC/o6tsqyNJuaHCML/wD218G8Hh2dNm77DPU=

pkg/cmds/run.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ func NewCmdRun() *cobra.Command {
7474
secureMetrics bool = true
7575
enableHTTP2 bool = false
7676

77-
ResyncPeriod time.Duration = 10 * time.Minute
78-
MaxConcurrentReconcile int // NumThreads = 2
79-
RequeueAfterDuration time.Duration
80-
MaxRetryOnFailure int // MaxNumRequeues = 5
81-
RetryAfterDuration time.Duration
82-
BeforeDeadlineDuration time.Duration
77+
resyncPeriod = 10 * time.Minute
78+
maxConcurrentReconcile int // NumThreads = 2
79+
requeueAfterDuration time.Duration
80+
maxRetryOnFailure int // MaxNumRequeues = 5
81+
retryAfterDuration time.Duration
82+
beforeDeadlineDuration time.Duration
8383
)
8484
cmd := &cobra.Command{
8585
Use: "run",
@@ -181,7 +181,7 @@ func NewCmdRun() *cobra.Command {
181181
// after the manager stops then its usage might be unsafe.
182182
// LeaderElectionReleaseOnCancel: true,
183183
Cache: cache.Options{
184-
SyncPeriod: &ResyncPeriod,
184+
SyncPeriod: &resyncPeriod,
185185
},
186186
NewClient: cu.NewClient,
187187
})
@@ -213,15 +213,15 @@ func NewCmdRun() *cobra.Command {
213213
}
214214

215215
recommendationControllerOpts := controller.Options{
216-
MaxConcurrentReconciles: MaxConcurrentReconcile,
216+
MaxConcurrentReconciles: maxConcurrentReconcile,
217217
}
218218
if err = (&supervisorcontrollers.RecommendationReconciler{
219219
Client: mgr.GetClient(),
220220
Scheme: mgr.GetScheme(),
221221
Mutex: &sync.Mutex{},
222-
RequeueAfterDuration: RequeueAfterDuration,
223-
RetryAfterDuration: RetryAfterDuration,
224-
BeforeDeadlineDuration: BeforeDeadlineDuration,
222+
RequeueAfterDuration: requeueAfterDuration,
223+
RetryAfterDuration: retryAfterDuration,
224+
BeforeDeadlineDuration: beforeDeadlineDuration,
225225
Clock: api.GetClock(),
226226
}).SetupWithManager(mgr, recommendationControllerOpts); err != nil {
227227
setupLog.Error(err, "unable to create controller", "controller", "Recommendation")
@@ -304,12 +304,12 @@ func NewCmdRun() *cobra.Command {
304304
cmd.Flags().BoolVar(&enableHTTP2, "enable-http2", enableHTTP2,
305305
"If set, HTTP/2 will be enabled for the metrics and webhook servers")
306306

307-
cmd.Flags().DurationVar(&ResyncPeriod, "resync-period", ResyncPeriod, "If non-zero, will re-list this often. Otherwise, re-list will be delayed aslong as possible (until the upstream source closes the watch or times out.")
308-
cmd.Flags().IntVar(&MaxConcurrentReconcile, "max-concurrent-reconcile", MaxConcurrentReconcile, "Maximum number of Recommendation object that will be reconciled concurrently")
309-
cmd.Flags().DurationVar(&RequeueAfterDuration, "requeue-after-duration", RequeueAfterDuration, "Duration after the Recommendation object will be requeue when it is waiting for MaintenanceWindow. The flag accepts a value acceptable to time.ParseDuration. Ref: https://pkg.go.dev/time#ParseDuration")
310-
cmd.Flags().IntVar(&MaxRetryOnFailure, "max-retry-on-failure", MaxRetryOnFailure, "Maximum number of retry on any kind of failure in Recommendation execution")
311-
cmd.Flags().DurationVar(&RetryAfterDuration, "retry-after-duration", RetryAfterDuration, "Duration after the failure events will be requeue again. The flag accepts a value acceptable to time.ParseDuration. Ref: https://pkg.go.dev/time#ParseDuration")
312-
cmd.Flags().DurationVar(&BeforeDeadlineDuration, "before-deadline-duration", BeforeDeadlineDuration, "When there is less time than `BeforeDeadlineDuration` before deadline, Recommendations are free to execute regardless of Parallelism")
307+
cmd.Flags().DurationVar(&resyncPeriod, "resync-period", resyncPeriod, "If non-zero, will re-list this often. Otherwise, re-list will be delayed aslong as possible (until the upstream source closes the watch or times out.")
308+
cmd.Flags().IntVar(&maxConcurrentReconcile, "max-concurrent-reconcile", maxConcurrentReconcile, "Maximum number of Recommendation object that will be reconciled concurrently")
309+
cmd.Flags().DurationVar(&requeueAfterDuration, "requeue-after-duration", requeueAfterDuration, "Duration after the Recommendation object will be requeue when it is waiting for MaintenanceWindow. The flag accepts a value acceptable to time.ParseDuration. Ref: https://pkg.go.dev/time#ParseDuration")
310+
cmd.Flags().IntVar(&maxRetryOnFailure, "max-retry-on-failure", maxRetryOnFailure, "Maximum number of retry on any kind of failure in Recommendation execution")
311+
cmd.Flags().DurationVar(&retryAfterDuration, "retry-after-duration", retryAfterDuration, "Duration after the failure events will be requeue again. The flag accepts a value acceptable to time.ParseDuration. Ref: https://pkg.go.dev/time#ParseDuration")
312+
cmd.Flags().DurationVar(&beforeDeadlineDuration, "before-deadline-duration", beforeDeadlineDuration, "When there is less time than `BeforeDeadlineDuration` before deadline, Recommendations are free to execute regardless of Parallelism")
313313

314314
return cmd
315315
}

vendor/kmodules.xyz/client-go/cluster/ocm.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
kmapi "kmodules.xyz/client-go/api/v1"
2525

2626
core "k8s.io/api/core/v1"
27+
apierrors "k8s.io/apimachinery/pkg/api/errors"
2728
"k8s.io/apimachinery/pkg/api/meta"
2829
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2930
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -47,7 +48,9 @@ func IsOpenClusterSpoke(kc client.Reader) bool {
4748
list.SetKind("Klusterlet")
4849
err := kc.List(context.TODO(), &list)
4950
if err != nil {
50-
panic(err)
51+
if !meta.IsNoMatchError(err) && !apierrors.IsNotFound(err) {
52+
panic(err) // panic if 403 (missing rbac)
53+
}
5154
}
5255
return len(list.Items) > 0
5356
}

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ k8s.io/utils/trace
11641164
# kmodules.xyz/apiversion v0.2.0
11651165
## explicit; go 1.14
11661166
kmodules.xyz/apiversion
1167-
# kmodules.xyz/client-go v0.32.0
1167+
# kmodules.xyz/client-go v0.32.1
11681168
## explicit; go 1.23.0
11691169
kmodules.xyz/client-go
11701170
kmodules.xyz/client-go/api/v1

0 commit comments

Comments
 (0)