Skip to content

Commit

Permalink
Use controller-gen for deepcopy cluster:v1alpha1
Browse files Browse the repository at this point in the history
GenGo isn't respecting the `+k8s:deepcopy-gen=false` tag to skip
generation for the generic type

Signed-off-by: Dale Haiducek <[email protected]>
  • Loading branch information
dhaiducek committed Oct 18, 2023
1 parent 7f4b40c commit a47adef
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 24 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ verify: check-env verify-scripts verify-codegen-crds verify-gocilint

update-scripts:
hack/update-deepcopy.sh
$(CONTROLLER_GEN) object:headerFile="hack/empty.txt" paths="./cluster/v1alpha1"
hack/update-swagger-docs.sh
hack/update-codegen.sh
hack/update-v1beta1-crds.sh
Expand Down
1 change: 1 addition & 0 deletions cluster/v1alpha1/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type RolloutResult struct {
}

// ClusterRolloutStatusFunc defines a function that return the rollout status for a given workload.
// +k8s:deepcopy-gen=false
type ClusterRolloutStatusFunc[T any] func(clusterName string, workload T) (ClusterRolloutStatus, error)

// The RolloutHandler required workload type (interface/struct) to be assigned to the generic type.
Expand Down
37 changes: 14 additions & 23 deletions cluster/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion hack/update-deepcopy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ verify="${VERIFY:-}"
GOFLAGS="" bash ${CODEGEN_PKG}/generate-groups.sh "deepcopy" \
open-cluster-management.io/api/generated \
open-cluster-management.io/api \
"cluster:v1 cluster:v1alpha1 cluster:v1beta1 cluster:v1beta2 work:v1alpha1 work:v1 operator:v1 addon:v1alpha1" \
"cluster:v1 cluster:v1beta1 cluster:v1beta2 work:v1alpha1 work:v1 operator:v1 addon:v1alpha1" \
--go-header-file ${SCRIPT_ROOT}/hack/empty.txt \
${verify}

0 comments on commit a47adef

Please sign in to comment.