Skip to content

Commit

Permalink
Introduce apply clientset for work CRD
Browse files Browse the repository at this point in the history
Signed-off-by: Monokaix <[email protected]>
  • Loading branch information
Monokaix committed Dec 31, 2024
1 parent ba1e68d commit 9f358f6
Show file tree
Hide file tree
Showing 44 changed files with 3,169 additions and 11 deletions.
6 changes: 5 additions & 1 deletion api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -20417,7 +20417,11 @@
"items": {
"default": {},
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Condition"
}
},
"x-kubernetes-list-map-keys": [
"type"
],
"x-kubernetes-list-type": "map"
},
"lastScheduledTime": {
"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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
lastScheduledTime:
description: |-
LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
lastScheduledTime:
description: |-
LastScheduledTime representing the latest timestamp when scheduler successfully finished a scheduling.
Expand Down
21 changes: 21 additions & 0 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ conversion-gen \
--output-file=zz_generated.conversion.go \
github.com/karmada-io/karmada/pkg/apis/search/v1alpha1

echo "Generating with applyconfiguration-gen"
applyconfiguration-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
--output-pkg=github.com/karmada-io/karmada/pkg/generated/applyconfiguration \
--output-dir=pkg/generated/applyconfiguration \
github.com/karmada-io/karmada/pkg/apis/work/v1alpha1 github.com/karmada-io/karmada/pkg/apis/work/v1alpha2

echo "Generating with client-gen"
client-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
Expand All @@ -178,6 +185,20 @@ client-gen \
--output-dir=operator/pkg/generated/clientset \
--clientset-name=versioned

# it's a workaround here.
echo "Generating with client-gen and applyconfiguration-gen "
client-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
--input-base="" \
--input=github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2 \
--output-pkg=github.com/karmada-io/karmada/pkg/generated/clientset \
--output-dir=pkg/generated/work \
--clientset-name=versioned \
--apply-configuration-package=github.com/karmada-io/karmada/pkg/generated/applyconfiguration

# move generated work client to correct path.
cp -r pkg/generated/work/versioned/typed/work pkg/generated/clientset/versioned/typed && rm -rf pkg/generated/work

echo "Generating with lister-gen"
lister-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/work/v1alpha2/binding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ type ResourceBindingStatus struct {

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

// AggregatedStatus represents status list of the resource running in each member cluster.
Expand Down
62 changes: 62 additions & 0 deletions pkg/generated/applyconfiguration/internal/internal.go

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

98 changes: 98 additions & 0 deletions pkg/generated/applyconfiguration/utils.go

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

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

Loading

0 comments on commit 9f358f6

Please sign in to comment.