Skip to content

Upgrade Go to v1.24 #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3cd45e5
chore: Upgrade Go version to 1.24.
ryotarai Apr 14, 2025
dcb26c5
chore: Upgrade controller-gen to v0.17.3.
ryotarai Apr 14, 2025
f64965c
fix: Fix "non-constant format string in call to fmt.Errorf"
ryotarai Apr 14, 2025
500356e
chore: Regenerate files with controller-gen v0.17.3
ryotarai Apr 14, 2025
5337956
chore: Upgrade Kubernetes libraries to v0.32.3
ryotarai Apr 14, 2025
3b54270
chore: Upgrade controller-runtime to v0.20.4
ryotarai Apr 14, 2025
5da4293
fix: Fix `type *admission.Decoder is pointer to interface, not interf…
ryotarai Apr 15, 2025
e88122c
fix: Use WatchesRawSource
ryotarai Apr 15, 2025
7204596
refactor: Replace custom client implementation with controller-runtim…
ryotarai Apr 15, 2025
1faa61f
fix: Fix "type *admission.Decoder is pointer to interface, not interf…
ryotarai Apr 15, 2025
b043300
fix: Update reconciler setup.
ryotarai Apr 15, 2025
e7b86d5
fix: Change decoder field from pointer to interface.
ryotarai Apr 15, 2025
8e20af5
fix: Pass http.DefaultClient to NewDynamicRESTMapper
ryotarai Apr 15, 2025
c2fbcee
fix: Update fakeDeleteCRDClient interface.
ryotarai Apr 15, 2025
de54f3f
fix: Extend fakeNSClient interface with additional methods.
ryotarai Apr 15, 2025
5de9874
Use cert-controller v0.12.0.
ryotarai May 12, 2025
25d1153
fix(tool-versions): Upgrade golang to v1.24.3
ryotarai May 12, 2025
0bb4d37
fix(integtest): Fix ctrl.NewManager setup.
ryotarai May 12, 2025
1cd0182
fix: Add admission decoder to Validator struct
ryotarai May 12, 2025
2bfd734
fix: Replace http.DefaultClient with custom HTTP client in NewDynamic…
ryotarai May 12, 2025
de6e8bf
fix: Enable SkipNameValidation in reconciler setup
ryotarai May 12, 2025
63866ca
fix: Inject admission decoder into webhook handlers manually.
ryotarai May 13, 2025
f92d1f4
fix: Inject configuration into webhook handler.
ryotarai May 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
golang 1.20.14
golang 1.24.3
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.20 as builder
FROM golang:1.24 as builder

WORKDIR /workspace
# Copy the Go Modules manifests and all third-party libraries that are unlikely to change frequently
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ GOBIN ?= ${CURDIR}/bin
KUSTOMIZE_VERSION ?= v5.3.0
KUSTOMIZE ?= ${GOBIN}/kustomize

CONTROLLER_GEN_VERSION ?= v0.12.0
CONTROLLER_GEN_VERSION ?= v0.17.3
CONTROLLER_GEN ?= ${GOBIN}/controller-gen

STATICCHECK_VERSION ?= 2023.1
Expand Down
1 change: 0 additions & 1 deletion api/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/metrics"
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

// +kubebuilder:scaffold:imports

Expand Down Expand Up @@ -273,13 +276,17 @@ func createManager() ctrl.Manager {
// it turns out to be harmful.
cfg.Burst = int(cfg.QPS * 1.5)
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
NewClient: config.NewClient(webhooksOnly),
Client: client.Options{
Cache: &client.CacheOptions{
Unstructured: true,
},
},
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Metrics: server.Options{BindAddress: metricsAddr},
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: leaderElectionId,
Port: webhookServerPort,
WebhookServer: &webhook.DefaultServer{Options: webhook.Options{Port: webhookServerPort}},
})
if err != nil {
setupLog.Error(err, "unable to create manager")
Expand Down
56 changes: 32 additions & 24 deletions config/crd/bases/hnc.x-k8s.io_hierarchicalresourcequotas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.17.3
name: hierarchicalresourcequotas.hnc.x-k8s.io
spec:
group: hnc.x-k8s.io
Expand Down Expand Up @@ -31,18 +31,24 @@ spec:
name: v1alpha2
schema:
openAPIV3Schema:
description: HierarchicalResourceQuota sets aggregate quota restrictions enforced
for a namespace and descendant namespaces
description: |-
HierarchicalResourceQuota sets aggregate quota restrictions enforced for a
namespace and descendant namespaces
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand All @@ -60,32 +66,33 @@ spec:
resource
type: object
scopeSelector:
description: ScopeSelector is also a collection of filters like Scopes
that must match each object tracked by a quota but expressed using
ScopeSelectorOperator in combination with possible values.
description: |-
ScopeSelector is also a collection of filters like Scopes that must match each object tracked by a quota
but expressed using ScopeSelectorOperator in combination with possible values.
properties:
matchExpressions:
description: A list of scope selector requirements by scope of
the resources.
items:
description: A scoped-resource selector requirement is a selector
that contains values, a scope name, and an operator that relates
the scope name and values.
description: |-
A scoped-resource selector requirement is a selector that contains values, a scope name, and an operator
that relates the scope name and values.
properties:
operator:
description: Represents a scope's relationship to a set
of values. Valid operators are In, NotIn, Exists, DoesNotExist.
description: |-
Represents a scope's relationship to a set of values.
Valid operators are In, NotIn, Exists, DoesNotExist.
type: string
scopeName:
description: The name of the scope that the selector applies
to.
type: string
values:
description: An array of string values. If the operator
is In or NotIn, the values array must be non-empty. If
the operator is Exists or DoesNotExist, the values array
must be empty. This array is replaced during a strategic
merge patch.
description: |-
An array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty.
This array is replaced during a strategic merge patch.
items:
type: string
type: array
Expand Down Expand Up @@ -126,8 +133,9 @@ spec:
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: Used is the current observed total usage of the resource
in the namespace and its descendant namespaces.
description: |-
Used is the current observed total usage of the resource in the namespace
and its descendant namespaces.
type: object
type: object
type: object
Expand Down
116 changes: 56 additions & 60 deletions config/crd/bases/hnc.x-k8s.io_hierarchyconfigurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.17.3
name: hierarchyconfigurations.hnc.x-k8s.io
spec:
group: hnc.x-k8s.io
Expand All @@ -20,14 +20,19 @@ spec:
description: Hierarchy is the Schema for the hierarchies API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
# This is patched by hack/crd_patches/singleton-enum-patch.sh
Expand All @@ -41,51 +46,54 @@ spec:
description: HierarchySpec defines the desired state of Hierarchy
properties:
allowCascadingDeletion:
description: AllowCascadingDeletion indicates if the subnamespaces
of this namespace are allowed to cascading delete.
description: |-
AllowCascadingDeletion indicates if the subnamespaces of this namespace are
allowed to cascading delete.
type: boolean
annotations:
description: Annotations is a list of annotations and values to apply
to the current namespace and all of its descendants. All annotation
keys must match a regex specified on the command line by --managed-namespace-annotation.
A namespace cannot have a KVP that conflicts with one of its ancestors.
description: |-
Annotations is a list of annotations and values to apply to the current namespace and all of
its descendants. All annotation keys must match a regex specified on the command line by
--managed-namespace-annotation. A namespace cannot have a KVP that conflicts with one of its
ancestors.
items:
description: MetaKVP represents a label or annotation
properties:
key:
description: Key is the name of the label or annotation. It
must conform to the normal rules for Kubernetes label/annotation
keys.
description: |-
Key is the name of the label or annotation. It must conform to the normal rules for Kubernetes
label/annotation keys.
type: string
value:
description: Value is the value of the label or annotation.
It must confirm to the normal rules for Kubernetes label or
annoation values, which are far more restrictive for labels
than for anntations.
description: |-
Value is the value of the label or annotation. It must confirm to the normal rules for
Kubernetes label or annoation values, which are far more restrictive for labels than for
anntations.
type: string
required:
- key
- value
type: object
type: array
labels:
description: Lables is a list of labels and values to apply to the
current namespace and all of its descendants. All label keys must
match a regex specified on the command line by --managed-namespace-label.
A namespace cannot have a KVP that conflicts with one of its ancestors.
description: |-
Lables is a list of labels and values to apply to the current namespace and all of its
descendants. All label keys must match a regex specified on the command line by
--managed-namespace-label. A namespace cannot have a KVP that conflicts with one of its
ancestors.
items:
description: MetaKVP represents a label or annotation
properties:
key:
description: Key is the name of the label or annotation. It
must conform to the normal rules for Kubernetes label/annotation
keys.
description: |-
Key is the name of the label or annotation. It must conform to the normal rules for Kubernetes
label/annotation keys.
type: string
value:
description: Value is the value of the label or annotation.
It must confirm to the normal rules for Kubernetes label or
annoation values, which are far more restrictive for labels
than for anntations.
description: |-
Value is the value of the label or annotation. It must confirm to the normal rules for
Kubernetes label or annoation values, which are far more restrictive for labels than for
anntations.
type: string
required:
- key
Expand All @@ -108,43 +116,35 @@ spec:
conditions:
description: Conditions describes the errors, if any.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a foo's
current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
description: Condition contains details for one aspect of the current
state of this API Resource.
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
Expand All @@ -159,10 +159,6 @@ spec:
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
Expand Down
Loading
Loading