Skip to content

Commit 07e781a

Browse files
committed
Introduce apply clientset for CRD in work group
Signed-off-by: Monokaix <[email protected]>
1 parent ba1e68d commit 07e781a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3169
-11
lines changed

api/openapi-spec/swagger.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20417,7 +20417,11 @@
2041720417
"items": {
2041820418
"default": {},
2041920419
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Condition"
20420-
}
20420+
},
20421+
"x-kubernetes-list-map-keys": [
20422+
"type"
20423+
],
20424+
"x-kubernetes-list-type": "map"
2042120425
},
2042220426
"lastScheduledTime": {
2042320427
"description": "LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling. It is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC.",

charts/karmada/_crds/bases/work/work.karmada.io_clusterresourcebindings.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,9 @@ spec:
13841384
- type
13851385
type: object
13861386
type: array
1387+
x-kubernetes-list-map-keys:
1388+
- type
1389+
x-kubernetes-list-type: map
13871390
lastScheduledTime:
13881391
description: |-
13891392
LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling.

charts/karmada/_crds/bases/work/work.karmada.io_resourcebindings.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,9 @@ spec:
13841384
- type
13851385
type: object
13861386
type: array
1387+
x-kubernetes-list-map-keys:
1388+
- type
1389+
x-kubernetes-list-type: map
13871390
lastScheduledTime:
13881391
description: |-
13891392
LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling.

hack/update-codegen.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ conversion-gen \
162162
--output-file=zz_generated.conversion.go \
163163
github.com/karmada-io/karmada/pkg/apis/search/v1alpha1
164164

165+
echo "Generating with applyconfiguration-gen"
166+
applyconfiguration-gen \
167+
--go-header-file hack/boilerplate/boilerplate.go.txt \
168+
--output-pkg=github.com/karmada-io/karmada/pkg/generated/applyconfiguration \
169+
--output-dir=pkg/generated/applyconfiguration \
170+
github.com/karmada-io/karmada/pkg/apis/work/v1alpha1 github.com/karmada-io/karmada/pkg/apis/work/v1alpha2
171+
165172
echo "Generating with client-gen"
166173
client-gen \
167174
--go-header-file hack/boilerplate/boilerplate.go.txt \
@@ -178,6 +185,20 @@ client-gen \
178185
--output-dir=operator/pkg/generated/clientset \
179186
--clientset-name=versioned
180187

188+
# it's a workaround here.
189+
echo "Generating with client-gen and applyconfiguration-gen "
190+
client-gen \
191+
--go-header-file hack/boilerplate/boilerplate.go.txt \
192+
--input-base="" \
193+
--input=github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2 \
194+
--output-pkg=github.com/karmada-io/karmada/pkg/generated/clientset \
195+
--output-dir=pkg/generated/work \
196+
--clientset-name=versioned \
197+
--apply-configuration-package=github.com/karmada-io/karmada/pkg/generated/applyconfiguration
198+
199+
# move generated work client to correct path.
200+
cp -r pkg/generated/work/versioned/typed/work pkg/generated/clientset/versioned/typed && rm -rf pkg/generated/work
201+
181202
echo "Generating with lister-gen"
182203
lister-gen \
183204
--go-header-file hack/boilerplate/boilerplate.go.txt \

pkg/apis/work/v1alpha2/binding_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ type ResourceBindingStatus struct {
347347

348348
// Conditions contain the different condition statuses.
349349
// +optional
350+
// +listType=map
351+
// +listMapKey=type
350352
Conditions []metav1.Condition `json:"conditions,omitempty"`
351353

352354
// AggregatedStatus represents status list of the resource running in each member cluster.

pkg/generated/applyconfiguration/internal/internal.go

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

pkg/generated/applyconfiguration/utils.go

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

pkg/generated/applyconfiguration/work/v1alpha1/aggregatedstatusitem.go

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

0 commit comments

Comments
 (0)