Skip to content

Commit

Permalink
ci: add generate-client.sh and generate client code
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy17 committed Dec 3, 2024
1 parent 6c905bf commit 0967435
Show file tree
Hide file tree
Showing 38 changed files with 3,217 additions and 34 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ generate: kustomize controller-gen ## Generate code containing DeepCopy, DeepCop
fmt: ## Run go fmt against code.
go fmt ./...

.PHONY: generate-client
generate-client: ## Generate the client code.
./hack/client/generate-client.sh

.PHONY: check-code-generation
check-code-generation: ## Check code generation.
echo "Checking code generation"
Expand Down
1 change: 1 addition & 0 deletions apis/v1alpha1/greptimedbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ func (in *GreptimeDBClusterStatus) SetCondition(condition Condition) {
in.Conditions = SetCondition(in.Conditions, condition)
}

// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=gtc
Expand Down
1 change: 1 addition & 0 deletions apis/v1alpha1/greptimedbstandalone_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type GreptimeDBStandaloneStatus struct {
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
}

// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=gts
Expand Down
7 changes: 7 additions & 0 deletions apis/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "greptime.io", Version: "v1alpha1"}

SchemeGroupVersion = GroupVersion

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

// Resource is required by pkg/client/listers/...
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
108 changes: 108 additions & 0 deletions config/crd/resources/greptime.io_greptimedbclusters.yaml

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions config/crd/resources/greptime.io_greptimedbstandalones.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -779,11 +779,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
Expand All @@ -803,11 +805,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
Expand Down Expand Up @@ -847,11 +851,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
Expand All @@ -871,11 +877,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
Expand Down Expand Up @@ -913,11 +921,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
Expand All @@ -937,11 +947,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
Expand Down Expand Up @@ -981,11 +993,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
Expand All @@ -1005,11 +1019,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
Expand Down Expand Up @@ -2563,11 +2579,13 @@ spec:
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
Expand Down
30 changes: 18 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
module github.com/GreptimeTeam/greptimedb-operator

go 1.21
go 1.22.0

toolchain go1.23.2

require (
dario.cat/mergo v1.0.1
github.com/avast/retry-go v3.0.0+incompatible
github.com/gin-gonic/gin v1.10.0
github.com/google/go-cmp v0.6.0
github.com/jackc/pgx/v5 v5.6.0
github.com/onsi/ginkgo/v2 v2.11.0
github.com/onsi/gomega v1.27.10
github.com/onsi/ginkgo/v2 v2.15.0
github.com/onsi/gomega v1.31.0
github.com/pelletier/go-toml v1.9.5
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.52.0
github.com/prometheus/client_golang v1.16.0
github.com/sergi/go-diff v1.3.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
go.etcd.io/etcd/client/v3 v3.5.9
google.golang.org/grpc v1.56.3
k8s.io/api v0.28.13
k8s.io/apiextensions-apiserver v0.28.3
k8s.io/apimachinery v0.28.13
k8s.io/apimachinery v0.30.0
k8s.io/client-go v0.28.13
k8s.io/klog/v2 v2.100.1
k8s.io/metrics v0.28.13
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
k8s.io/code-generator v0.30.0
k8s.io/klog/v2 v2.120.1
k8s.io/metrics v0.28.3
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/controller-runtime v0.16.4
sigs.k8s.io/yaml v1.3.0
)
Expand All @@ -39,11 +43,12 @@ require (
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/zapr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
Expand Down Expand Up @@ -76,7 +81,6 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
Expand All @@ -90,13 +94,14 @@ require (
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.16.1 // indirect
golang.org/x/tools v0.18.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 // indirect
Expand All @@ -107,7 +112,8 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/component-base v0.28.3 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)
Loading

0 comments on commit 0967435

Please sign in to comment.