diff --git a/build/codegen.sh b/build/codegen.sh index de6466f44f..b552e55c8d 100755 --- a/build/codegen.sh +++ b/build/codegen.sh @@ -23,12 +23,21 @@ set -o xtrace export GO111MODULE=on go mod download execDir="/go/pkg/mod/k8s.io/code-generator@$(go list -f '{{.Version}}' -m k8s.io/code-generator)" -chmod +x "${execDir}"/generate-groups.sh -chmod +x "${execDir}"/generate-internal-groups.sh -"${execDir}"/generate-groups.sh \ - all \ - github.com/kanisterio/kanister/pkg/client \ - github.com/kanisterio/kanister/pkg/apis \ - "cr:v1alpha1" \ - --go-header-file "$PWD"/build/boilerplate.go.txt \ - -o /go/src/ +boilerplateFile="$(pwd)"/build/boilerplate.go.txt + +source "${execDir}"/kube_codegen.sh + +kube::codegen::gen_helpers \ +--boilerplate "${boilerplateFile}" \ +--extra-peer-dir ./pkg/client \ +--extra-peer-dir ./pkg/apis \ +go/src/ + +kube::codegen::gen_client \ +--with-applyconfig \ +--with-watch \ +--boilerplate "${boilerplateFile}" \ +--output-dir ./pkg/client \ +--output-pkg github.com/kanisterio/kanister/pkg/client \ +./pkg/apis + diff --git a/pkg/client/applyconfiguration/cr/v1alpha1/repositoryserverstatus.go b/pkg/client/applyconfiguration/cr/v1alpha1/repositoryserverstatus.go index 7064fc0dd4..ca6e8420a4 100644 --- a/pkg/client/applyconfiguration/cr/v1alpha1/repositoryserverstatus.go +++ b/pkg/client/applyconfiguration/cr/v1alpha1/repositoryserverstatus.go @@ -19,13 +19,13 @@ package v1alpha1 import ( crv1alpha1 "github.com/kanisterio/kanister/pkg/apis/cr/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) // RepositoryServerStatusApplyConfiguration represents an declarative configuration of the RepositoryServerStatus type for use // with apply. type RepositoryServerStatusApplyConfiguration struct { - Conditions []v1.Condition `json:"conditions,omitempty"` + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` ServerInfo *ServerInfoApplyConfiguration `json:"serverInfo,omitempty"` Progress *crv1alpha1.RepositoryServerProgress `json:"progress,omitempty"` } @@ -39,9 +39,12 @@ func RepositoryServerStatus() *RepositoryServerStatusApplyConfiguration { // WithConditions adds the given value to the Conditions field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Conditions field. -func (b *RepositoryServerStatusApplyConfiguration) WithConditions(values ...v1.Condition) *RepositoryServerStatusApplyConfiguration { +func (b *RepositoryServerStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *RepositoryServerStatusApplyConfiguration { for i := range values { - b.Conditions = append(b.Conditions, values[i]) + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) } return b }