This is an automated email from the ASF dual-hosted git repository.
jimin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-seata-k8s.git
The following commit(s) were added to refs/heads/master by this push:
new a55c89e optimize: streamline crd and upgrade the GVK version to v1
(#39)
a55c89e is described below
commit a55c89ebfc70bbb885980282b7d94b85c177c720
Author: jimin <[email protected]>
AuthorDate: Sun Nov 23 11:35:44 2025 +0800
optimize: streamline crd and upgrade the GVK version to v1 (#39)
---
README.md | 2 +-
README.zh.md | 2 +-
api/v1/conversion.go | 23 +
api/v1/groupversion_info.go | 37 ++
api/{v1alpha1 => v1}/seataserver_types.go | 11 +-
api/v1/zz_generated.deepcopy.go | 247 ++++++++++
api/v1alpha1/conversion.go | 23 +
api/v1alpha1/seataserver_types.go | 6 +-
.../operator.seata.apache.org_seataservers.yaml | 513 ---------------------
config/crd/bases/v1/seataservers_crd.yaml | 287 ++++++++++++
config/crd/kustomization.yaml | 2 +-
docs/developerGuide.md | 4 +-
docs/developerGuide.zh.md | 4 +-
main.go | 4 +
14 files changed, 640 insertions(+), 525 deletions(-)
diff --git a/README.md b/README.md
index 07f8a8f..ad57cf5 100644
--- a/README.md
+++ b/README.md
@@ -124,7 +124,7 @@ seata-server-2.seata-server-cluster.default.svc
### CRD Reference
-For complete CRD definitions, see
[operator.seata.apache.org_seataservers.yaml](config/crd/bases/operator.seata.apache.org_seataservers.yaml).
+For complete CRD definitions, see
[seataservers_crd.yaml](config/crd/bases/v1/seataservers_crd.yaml).
#### Key Configuration Properties
diff --git a/README.zh.md b/README.zh.md
index daec6c3..ce71081 100755
--- a/README.zh.md
+++ b/README.zh.md
@@ -131,7 +131,7 @@ kubectl logs -f seata-server-0
### CRD 配置参考
-详见
[operator.seata.apache.org_seataservers.yaml](config/crd/bases/operator.seata.apache.org_seataservers.yaml)。
+详见 [seataservers_crd.yaml](config/crd/bases/v1/seataservers_crd.yaml)。
#### 关键配置字段
diff --git a/api/v1/conversion.go b/api/v1/conversion.go
new file mode 100644
index 0000000..684c154
--- /dev/null
+++ b/api/v1/conversion.go
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package v1
+
+// Note: v1 is the storage version, so no conversion is needed for now.
+// This file is prepared for future conversion logic if needed.
+// The Kubernetes API server will handle conversion between v1 and v1alpha1
+// using the built-in conversion strategy specified in the CRD.
diff --git a/api/v1/groupversion_info.go b/api/v1/groupversion_info.go
new file mode 100644
index 0000000..6bbd10e
--- /dev/null
+++ b/api/v1/groupversion_info.go
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Package v1 contains API Schema definitions for the seata v1 API group
+// +kubebuilder:object:generate=true
+// +groupName=operator.seata.apache.org
+package v1
+
+import (
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "sigs.k8s.io/controller-runtime/pkg/scheme"
+)
+
+var (
+ // GroupVersion is group version used to register these objects
+ GroupVersion = schema.GroupVersion{Group: "operator.seata.apache.org",
Version: "v1"}
+
+ // 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
+)
diff --git a/api/v1alpha1/seataserver_types.go b/api/v1/seataserver_types.go
similarity index 94%
copy from api/v1alpha1/seataserver_types.go
copy to api/v1/seataserver_types.go
index ae42604..4db1cd8 100644
--- a/api/v1alpha1/seataserver_types.go
+++ b/api/v1/seataserver_types.go
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package v1alpha1
+package v1
import (
apiv1 "k8s.io/api/core/v1"
@@ -106,9 +106,12 @@ type SeataServerStatus struct {
}
//+kubebuilder:object:root=true
+//+kubebuilder:object:generate=true
//+kubebuilder:subresource:status
+//+kubebuilder:storageversion
// SeataServer is the Schema for the seataservers API
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type SeataServer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -122,8 +125,10 @@ func (s *SeataServer) WithDefaults() bool {
}
//+kubebuilder:object:root=true
+//+kubebuilder:object:generate=true
// SeataServerList contains a list of SeataServer
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type SeataServerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
@@ -210,8 +215,8 @@ func (p *Persistence) withDefaults() (changed bool) {
apiv1.ReadWriteOnce,
}
- storage, _ := p.PersistentVolumeClaimSpec.Resources.Requests["storage"]
- if storage.IsZero() {
+ storage, exists :=
p.PersistentVolumeClaimSpec.Resources.Requests["storage"]
+ if !exists || storage.IsZero() {
p.PersistentVolumeClaimSpec.Resources.Requests =
apiv1.ResourceList{
apiv1.ResourceStorage:
resource.MustParse(DefaultSeataSessionStorageVolumeSize),
}
diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go
new file mode 100644
index 0000000..9b6c156
--- /dev/null
+++ b/api/v1/zz_generated.deepcopy.go
@@ -0,0 +1,247 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Code generated by controller-gen. DO NOT EDIT.
+
+package v1
+
+import (
+ corev1 "k8s.io/api/core/v1"
+ runtime "k8s.io/apimachinery/pkg/runtime"
+)
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver,
writing into out. in must be non-nil.
+func (in *ContainerSpec) DeepCopyInto(out *ContainerSpec) {
+ *out = *in
+ if in.Env != nil {
+ in, out := &in.Env, &out.Env
+ *out = make([]corev1.EnvVar, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ in.Resources.DeepCopyInto(&out.Resources)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new ContainerSpec.
+func (in *ContainerSpec) DeepCopy() *ContainerSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(ContainerSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver,
writing into out. in must be non-nil.
+func (in *Persistence) DeepCopyInto(out *Persistence) {
+ *out = *in
+
in.PersistentVolumeClaimSpec.DeepCopyInto(&out.PersistentVolumeClaimSpec)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new Persistence.
+func (in *Persistence) DeepCopy() *Persistence {
+ if in == nil {
+ return nil
+ }
+ out := new(Persistence)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver,
writing into out. in must be non-nil.
+func (in *Ports) DeepCopyInto(out *Ports) {
+ *out = *in
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new Ports.
+func (in *Ports) DeepCopy() *Ports {
+ if in == nil {
+ return nil
+ }
+ out := new(Ports)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver,
writing into out. in must be non-nil.
+func (in *ResourceList) DeepCopyInto(out *ResourceList) {
+ *out = *in
+ if in.Storage != nil {
+ in, out := &in.Storage, &out.Storage
+ x := (*in).DeepCopy()
+ *out = &x
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new ResourceList.
+func (in *ResourceList) DeepCopy() *ResourceList {
+ if in == nil {
+ return nil
+ }
+ out := new(ResourceList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver,
writing into out. in must be non-nil.
+func (in *SeataServer) DeepCopyInto(out *SeataServer) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+ in.Spec.DeepCopyInto(&out.Spec)
+ in.Status.DeepCopyInto(&out.Status)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new SeataServer.
+func (in *SeataServer) DeepCopy() *SeataServer {
+ if in == nil {
+ return nil
+ }
+ out := new(SeataServer)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver,
creating a new runtime.Object.
+func (in *SeataServer) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver,
writing into out. in must be non-nil.
+func (in *SeataServerError) DeepCopyInto(out *SeataServerError) {
+ *out = *in
+ in.Timestamp.DeepCopyInto(&out.Timestamp)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new SeataServerError.
+func (in *SeataServerError) DeepCopy() *SeataServerError {
+ if in == nil {
+ return nil
+ }
+ out := new(SeataServerError)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver,
writing into out. in must be non-nil.
+func (in *SeataServerList) DeepCopyInto(out *SeataServerList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ListMeta.DeepCopyInto(&out.ListMeta)
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]SeataServer, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new SeataServerList.
+func (in *SeataServerList) DeepCopy() *SeataServerList {
+ if in == nil {
+ return nil
+ }
+ out := new(SeataServerList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver,
creating a new runtime.Object.
+func (in *SeataServerList) DeepCopyObject() runtime.Object {
+ if c := in.DeepCopy(); c != nil {
+ return c
+ }
+ return nil
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver,
writing into out. in must be non-nil.
+func (in *SeataServerSpec) DeepCopyInto(out *SeataServerSpec) {
+ *out = *in
+ in.ContainerSpec.DeepCopyInto(&out.ContainerSpec)
+ in.Ports.DeepCopyInto(&out.Ports)
+ in.Persistence.DeepCopyInto(&out.Persistence)
+ in.Store.DeepCopyInto(&out.Store)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new SeataServerSpec.
+func (in *SeataServerSpec) DeepCopy() *SeataServerSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(SeataServerSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver,
writing into out. in must be non-nil.
+func (in *SeataServerStatus) DeepCopyInto(out *SeataServerStatus) {
+ *out = *in
+ if in.Errors != nil {
+ in, out := &in.Errors, &out.Errors
+ *out = make([]SeataServerError, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new SeataServerStatus.
+func (in *SeataServerStatus) DeepCopy() *SeataServerStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(SeataServerStatus)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver,
writing into out. in must be non-nil.
+func (in *Store) DeepCopyInto(out *Store) {
+ *out = *in
+ in.Resources.DeepCopyInto(&out.Resources)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new Store.
+func (in *Store) DeepCopy() *Store {
+ if in == nil {
+ return nil
+ }
+ out := new(Store)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver,
writing into out. in must be non-nil.
+func (in *StorageResources) DeepCopyInto(out *StorageResources) {
+ *out = *in
+ in.Requests.DeepCopyInto(&out.Requests)
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new StorageResources.
+func (in *StorageResources) DeepCopy() *StorageResources {
+ if in == nil {
+ return nil
+ }
+ out := new(StorageResources)
+ in.DeepCopyInto(out)
+ return out
+}
diff --git a/api/v1alpha1/conversion.go b/api/v1alpha1/conversion.go
new file mode 100644
index 0000000..9cb8926
--- /dev/null
+++ b/api/v1alpha1/conversion.go
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package v1alpha1
+
+// Note: Conversion between v1alpha1 and v1 is handled by Kubernetes API server
+// using the built-in conversion strategy specified in the CRD.
+// Since both versions have identical schema, manual conversion logic is not
needed.
+// v1 is the storage version and v1alpha1 is served for backward compatibility.
diff --git a/api/v1alpha1/seataserver_types.go
b/api/v1alpha1/seataserver_types.go
index ae42604..a374df1 100644
--- a/api/v1alpha1/seataserver_types.go
+++ b/api/v1alpha1/seataserver_types.go
@@ -107,6 +107,8 @@ type SeataServerStatus struct {
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
+//+kubebuilder:resource:path=seataservers
+//+kubebuilder:deprecatedversion:warning="v1alpha1 is deprecated and will be
removed in a future version. Use v1 instead."
// SeataServer is the Schema for the seataservers API
type SeataServer struct {
@@ -210,8 +212,8 @@ func (p *Persistence) withDefaults() (changed bool) {
apiv1.ReadWriteOnce,
}
- storage, _ := p.PersistentVolumeClaimSpec.Resources.Requests["storage"]
- if storage.IsZero() {
+ storage, exists :=
p.PersistentVolumeClaimSpec.Resources.Requests["storage"]
+ if !exists || storage.IsZero() {
p.PersistentVolumeClaimSpec.Resources.Requests =
apiv1.ResourceList{
apiv1.ResourceStorage:
resource.MustParse(DefaultSeataSessionStorageVolumeSize),
}
diff --git a/config/crd/bases/operator.seata.apache.org_seataservers.yaml
b/config/crd/bases/operator.seata.apache.org_seataservers.yaml
deleted file mode 100644
index 4b13581..0000000
--- a/config/crd/bases/operator.seata.apache.org_seataservers.yaml
+++ /dev/null
@@ -1,513 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- controller-gen.kubebuilder.io/version: v0.13.0
- name: seataservers.operator.seata.apache.org
-spec:
- group: operator.seata.apache.org
- names:
- kind: SeataServer
- listKind: SeataServerList
- plural: seataservers
- singular: seataserver
- scope: Namespaced
- versions:
- - name: v1alpha1
- schema:
- openAPIV3Schema:
- description: SeataServer is the Schema for the seataservers API
- properties:
- apiVersion:
- description: 'APIVersion defines the versioned schema of this
representation
- of an object. Servers should convert recognized schemas to the
latest
- internal value, and may reject unrecognized values. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
- type: string
- kind:
- description: 'Kind is a string value representing the REST
resource this
- object represents. Servers may infer this from the endpoint the
client
- submits requests to. Cannot be updated. In CamelCase. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
- type: string
- metadata:
- type: object
- spec:
- description: SeataServerSpec defines the desired state of
SeataServer
- properties:
- containerName:
- default: seata-server
- type: string
- env:
- items:
- description: EnvVar represents an environment variable
present in
- a Container.
- properties:
- name:
- description: Name of the environment variable. Must be a
C_IDENTIFIER.
- type: string
- value:
- description: 'Variable references $(VAR_NAME) are
expanded using
- the previously defined environment variables in the
container
- and any service environment variables. If a variable
cannot
- be resolved, the reference in the input string will be
unchanged.
- Double $$ are reduced to a single $, which allows for
escaping
- the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will
produce the
- string literal "$(VAR_NAME)". Escaped references will
never
- be expanded, regardless of whether the variable exists
or
- not. Defaults to "".'
- type: string
- valueFrom:
- description: Source for the environment variable's
value. Cannot
- be used if value is not empty.
- properties:
- configMapKeyRef:
- description: Selects a key of a ConfigMap.
- properties:
- key:
- description: The key to select.
- type: string
- name:
- description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
- TODO: Add other useful fields. apiVersion,
kind, uid?'
- type: string
- optional:
- description: Specify whether the ConfigMap or
its key
- must be defined
- type: boolean
- required:
- - key
- type: object
- x-kubernetes-map-type: atomic
- fieldRef:
- description: 'Selects a field of the pod: supports
metadata.name,
- metadata.namespace, `metadata.labels[''<KEY>'']`,
`metadata.annotations[''<KEY>'']`,
- spec.nodeName, spec.serviceAccountName,
status.hostIP,
- status.podIP, status.podIPs.'
- properties:
- apiVersion:
- description: Version of the schema the FieldPath
is
- written in terms of, defaults to "v1".
- type: string
- fieldPath:
- description: Path of the field to select in the
specified
- API version.
- type: string
- required:
- - fieldPath
- type: object
- x-kubernetes-map-type: atomic
- resourceFieldRef:
- description: 'Selects a resource of the container:
only
- resources limits and requests (limits.cpu,
limits.memory,
- limits.ephemeral-storage, requests.cpu,
requests.memory
- and requests.ephemeral-storage) are currently
supported.'
- properties:
- containerName:
- description: 'Container name: required for
volumes,
- optional for env vars'
- type: string
- divisor:
- anyOf:
- - type: integer
- - type: string
- description: Specifies the output format of the
exposed
- resources, defaults to "1"
- pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- resource:
- description: 'Required: resource to select'
- type: string
- required:
- - resource
- type: object
- x-kubernetes-map-type: atomic
- secretKeyRef:
- description: Selects a key of a secret in the pod's
namespace
- properties:
- key:
- description: The key of the secret to select
from. Must
- be a valid secret key.
- type: string
- name:
- description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
- TODO: Add other useful fields. apiVersion,
kind, uid?'
- type: string
- optional:
- description: Specify whether the Secret or its
key must
- be defined
- type: boolean
- required:
- - key
- type: object
- x-kubernetes-map-type: atomic
- type: object
- required:
- - name
- type: object
- type: array
- image:
- default: apache/seata-server:latest
- type: string
- persistence:
- properties:
- spec:
- description: PersistentVolumeClaimSpec is the spec to
describe
- PVC for the container This field is optional. If no PVC
is specified
- default persistent volume will get created.
- properties:
- accessModes:
- description: 'accessModes contains the desired access
modes
- the volume should have. More info:
https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1'
- items:
- type: string
- type: array
- dataSource:
- description: 'dataSource field can be used to specify
either:
- * An existing VolumeSnapshot object
(snapshot.storage.k8s.io/VolumeSnapshot)
- * An existing PVC (PersistentVolumeClaim) If the
provisioner
- or an external controller can support the specified
data
- source, it will create a new volume based on the
contents
- of the specified data source. When the
AnyVolumeDataSource
- feature gate is enabled, dataSource contents will be
copied
- to dataSourceRef, and dataSourceRef contents will be
copied
- to dataSource when dataSourceRef.namespace is not
specified.
- If the namespace is specified, then dataSourceRef
will not
- be copied to dataSource.'
- properties:
- apiGroup:
- description: APIGroup is the group for the
resource being
- referenced. If APIGroup is not specified, the
specified
- Kind must be in the core API group. For any
other third-party
- types, APIGroup is required.
- type: string
- kind:
- description: Kind is the type of resource being
referenced
- type: string
- name:
- description: Name is the name of resource being
referenced
- type: string
- required:
- - kind
- - name
- type: object
- x-kubernetes-map-type: atomic
- dataSourceRef:
- description: 'dataSourceRef specifies the object from
which
- to populate the volume with data, if a non-empty
volume
- is desired. This may be any object from a non-empty
API
- group (non core object) or a PersistentVolumeClaim
object.
- When this field is specified, volume binding will
only succeed
- if the type of the specified object matches some
installed
- volume populator or dynamic provisioner. This field
will
- replace the functionality of the dataSource field
and as
- such if both fields are non-empty, they must have
the same
- value. For backwards compatibility, when namespace
isn''t
- specified in dataSourceRef, both fields (dataSource
and
- dataSourceRef) will be set to the same value
automatically
- if one of them is empty and the other is non-empty.
When
- namespace is specified in dataSourceRef, dataSource
isn''t
- set to the same value and must be empty. There are
three
- important differences between dataSource and
dataSourceRef:
- * While dataSource only allows two specific types of
objects,
- dataSourceRef allows any non-core object, as well as
PersistentVolumeClaim
- objects. * While dataSource ignores disallowed
values (dropping
- them), dataSourceRef preserves all values, and
generates
- an error if a disallowed value is specified. * While
dataSource
- only allows local objects, dataSourceRef allows
objects
- in any namespaces. (Beta) Using this field requires
the
- AnyVolumeDataSource feature gate to be enabled.
(Alpha)
- Using the namespace field of dataSourceRef requires
the
- CrossNamespaceVolumeDataSource feature gate to be
enabled.'
- properties:
- apiGroup:
- description: APIGroup is the group for the
resource being
- referenced. If APIGroup is not specified, the
specified
- Kind must be in the core API group. For any
other third-party
- types, APIGroup is required.
- type: string
- kind:
- description: Kind is the type of resource being
referenced
- type: string
- name:
- description: Name is the name of resource being
referenced
- type: string
- namespace:
- description: Namespace is the namespace of
resource being
- referenced Note that when a namespace is
specified,
- a gateway.networking.k8s.io/ReferenceGrant
object is
- required in the referent namespace to allow that
namespace's
- owner to accept the reference. See the
ReferenceGrant
- documentation for details. (Alpha) This field
requires
- the CrossNamespaceVolumeDataSource feature gate
to be
- enabled.
- type: string
- required:
- - kind
- - name
- type: object
- resources:
- description: 'resources represents the minimum
resources the
- volume should have. If RecoverVolumeExpansionFailure
feature
- is enabled users are allowed to specify resource
requirements
- that are lower than previous value but must still be
higher
- than capacity recorded in the status field of the
claim.
- More info:
https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources'
- properties:
- claims:
- description: "Claims lists the names of resources,
defined
- in spec.resourceClaims, that are used by this
container.
- \n This is an alpha field and requires enabling
the
- DynamicResourceAllocation feature gate. \n This
field
- is immutable. It can only be set for containers."
- items:
- description: ResourceClaim references one entry
in PodSpec.ResourceClaims.
- properties:
- name:
- description: Name must match the name of one
entry
- in pod.spec.resourceClaims of the Pod
where this
- field is used. It makes that resource
available
- inside a container.
- type: string
- required:
- - name
- type: object
- type: array
- x-kubernetes-list-map-keys:
- - name
- x-kubernetes-list-type: map
- limits:
- additionalProperties:
- anyOf:
- - type: integer
- - type: string
- pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- description: 'Limits describes the maximum amount
of compute
- resources allowed. More info:
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
- type: object
- requests:
- additionalProperties:
- anyOf:
- - type: integer
- - type: string
- pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- description: 'Requests describes the minimum
amount of
- compute resources required. If Requests is
omitted for
- a container, it defaults to Limits if that is
explicitly
- specified, otherwise to an
implementation-defined value.
- Requests cannot exceed Limits. More info:
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
- type: object
- type: object
- selector:
- description: selector is a label query over volumes to
consider
- for binding.
- properties:
- matchExpressions:
- description: matchExpressions is a list of label
selector
- requirements. The requirements are ANDed.
- items:
- description: A label selector requirement is a
selector
- that contains values, a key, and an operator
that
- relates the key and values.
- properties:
- key:
- description: key is the label key that the
selector
- applies to.
- type: string
- operator:
- description: operator represents a key's
relationship
- to a set of values. Valid operators are
In, NotIn,
- Exists and DoesNotExist.
- type: string
- values:
- description: values is an array of string
values.
- If the operator is In or NotIn, the values
array
- must be non-empty. If the operator is
Exists or
- DoesNotExist, the values array must be
empty.
- This array is replaced during a strategic
merge
- patch.
- items:
- type: string
- type: array
- required:
- - key
- - operator
- type: object
- type: array
- matchLabels:
- additionalProperties:
- type: string
- description: matchLabels is a map of {key,value}
pairs.
- A single {key,value} in the matchLabels map is
equivalent
- to an element of matchExpressions, whose key
field is
- "key", the operator is "In", and the values
array contains
- only "value". The requirements are ANDed.
- type: object
- type: object
- x-kubernetes-map-type: atomic
- storageClassName:
- description: 'storageClassName is the name of the
StorageClass
- required by the claim. More info:
https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1'
- type: string
- volumeMode:
- description: volumeMode defines what type of volume is
required
- by the claim. Value of Filesystem is implied when
not included
- in claim spec.
- type: string
- volumeName:
- description: volumeName is the binding reference to
the PersistentVolume
- backing this claim.
- type: string
- type: object
- volumeReclaimPolicy:
- description: VolumeReclaimPolicy is a seata operator
configuration.
- If it's set to Delete, the corresponding PVCs will be
deleted
- by the operator when seata server cluster is deleted.
The default
- value is Retain.
- enum:
- - Delete
- - Retain
- type: string
- type: object
- ports:
- properties:
- consolePort:
- default: 7091
- format: int32
- type: integer
- raftPort:
- default: 9091
- format: int32
- type: integer
- servicePort:
- default: 8091
- format: int32
- type: integer
- type: object
- replicas:
- default: 1
- format: int32
- minimum: 1
- type: integer
- resources:
- description: ResourceRequirements describes the compute
resource requirements.
- properties:
- claims:
- description: "Claims lists the names of resources, defined
in
- spec.resourceClaims, that are used by this container. \n
This
- is an alpha field and requires enabling the
DynamicResourceAllocation
- feature gate. \n This field is immutable. It can only be
set
- for containers."
- items:
- description: ResourceClaim references one entry in
PodSpec.ResourceClaims.
- properties:
- name:
- description: Name must match the name of one entry
in pod.spec.resourceClaims
- of the Pod where this field is used. It makes that
resource
- available inside a container.
- type: string
- required:
- - name
- type: object
- type: array
- x-kubernetes-list-map-keys:
- - name
- x-kubernetes-list-type: map
- limits:
- additionalProperties:
- anyOf:
- - type: integer
- - type: string
- pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- description: 'Limits describes the maximum amount of
compute resources
- allowed. More info:
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
- type: object
- requests:
- additionalProperties:
- anyOf:
- - type: integer
- - type: string
- pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- description: 'Requests describes the minimum amount of
compute
- resources required. If Requests is omitted for a
container,
- it defaults to Limits if that is explicitly specified,
otherwise
- to an implementation-defined value. Requests cannot
exceed Limits.
- More info:
https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
- type: object
- type: object
- serviceName:
- default: seata-server-cluster
- type: string
- store:
- description: Store defines the storage configuration for
SeataServer
- properties:
- resources:
- properties:
- requests:
- properties:
- storage:
- anyOf:
- - type: integer
- - type: string
- pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- x-kubernetes-int-or-string: true
- type: object
- type: object
- type: object
- type: object
- status:
- description: SeataServerStatus defines the observed state of
SeataServer
- properties:
- errors:
- items:
- description: SeataServerError defines the error of
SeataServer
- properties:
- message:
- type: string
- timestamp:
- format: date-time
- type: string
- type:
- type: string
- required:
- - message
- - timestamp
- - type
- type: object
- type: array
- readyReplicas:
- format: int32
- type: integer
- replicas:
- format: int32
- type: integer
- synchronized:
- type: boolean
- required:
- - replicas
- - synchronized
- type: object
- type: object
- served: true
- storage: true
- subresources:
- status: {}
diff --git a/config/crd/bases/v1/seataservers_crd.yaml
b/config/crd/bases/v1/seataservers_crd.yaml
new file mode 100644
index 0000000..74cdb75
--- /dev/null
+++ b/config/crd/bases/v1/seataservers_crd.yaml
@@ -0,0 +1,287 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+---
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ name: seataservers.operator.seata.apache.org
+spec:
+ group: operator.seata.apache.org
+ scope: Namespaced
+ names:
+ kind: SeataServer
+ listKind: SeataServerList
+ plural: seataservers
+ singular: seataserver
+ shortNames:
+ - ss
+ - sss
+ versions:
+ - name: v1
+ served: true
+ storage: true
+ deprecated: false
+ schema:
+ openAPIV3Schema:
+ type: object
+ properties:
+ apiVersion:
+ type: string
+ kind:
+ type: string
+ metadata:
+ type: object
+ spec:
+ type: object
+ properties:
+ containerName:
+ type: string
+ default: seata-server
+ description: Name of the container
+ image:
+ type: string
+ default: apache/seata-server:latest
+ description: Container image
+ env:
+ type: array
+ items:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ description: Environment variables
+ resources:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ description: Container resource requirements
+ replicas:
+ type: integer
+ format: int32
+ minimum: 1
+ default: 1
+ description: Number of Seata Server replicas
+ serviceName:
+ type: string
+ default: seata-server-cluster
+ description: Headless Service name
+ ports:
+ type: object
+ properties:
+ consolePort:
+ type: integer
+ format: int32
+ default: 7091
+ description: Console port
+ servicePort:
+ type: integer
+ format: int32
+ default: 8091
+ description: Service port
+ raftPort:
+ type: integer
+ format: int32
+ default: 9091
+ description: Raft port
+ description: Port configuration
+ persistence:
+ type: object
+ properties:
+ volumeReclaimPolicy:
+ type: string
+ enum:
+ - Delete
+ - Retain
+ description: Volume reclaim policy
+ spec:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ description: PersistentVolumeClaim spec
+ description: Storage persistence configuration
+ store:
+ type: object
+ properties:
+ resources:
+ type: object
+ properties:
+ requests:
+ type: object
+ properties:
+ storage:
+ type: string
+ description: Storage size
+ description: Storage resource requests
+ description: Store resources
+ description: Storage configuration
+ status:
+ type: object
+ properties:
+ synchronized:
+ type: boolean
+ description: Whether raft cluster is synchronized
+ replicas:
+ type: integer
+ format: int32
+ description: Number of replicas
+ readyReplicas:
+ type: integer
+ format: int32
+ description: Number of ready replicas
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ type:
+ type: string
+ description: Error type
+ message:
+ type: string
+ description: Error message
+ timestamp:
+ type: string
+ format: date-time
+ description: Error timestamp
+ description: List of recent errors
+ subresources:
+ status: {}
+ - name: v1alpha1
+ served: true
+ storage: false
+ deprecated: true
+ deprecationWarning: "operator.seata.apache.org/v1alpha1 is deprecated;
use operator.seata.apache.org/v1"
+ schema:
+ openAPIV3Schema:
+ type: object
+ properties:
+ apiVersion:
+ type: string
+ kind:
+ type: string
+ metadata:
+ type: object
+ spec:
+ type: object
+ properties:
+ containerName:
+ type: string
+ default: seata-server
+ description: Name of the container
+ image:
+ type: string
+ default: apache/seata-server:latest
+ description: Container image
+ env:
+ type: array
+ items:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ description: Environment variables
+ resources:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ description: Container resource requirements
+ replicas:
+ type: integer
+ format: int32
+ minimum: 1
+ default: 1
+ description: Number of Seata Server replicas
+ serviceName:
+ type: string
+ default: seata-server-cluster
+ description: Headless Service name
+ ports:
+ type: object
+ properties:
+ consolePort:
+ type: integer
+ format: int32
+ default: 7091
+ description: Console port
+ servicePort:
+ type: integer
+ format: int32
+ default: 8091
+ description: Service port
+ raftPort:
+ type: integer
+ format: int32
+ default: 9091
+ description: Raft port
+ description: Port configuration
+ persistence:
+ type: object
+ properties:
+ volumeReclaimPolicy:
+ type: string
+ enum:
+ - Delete
+ - Retain
+ description: Volume reclaim policy
+ spec:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ description: PersistentVolumeClaim spec
+ description: Storage persistence configuration
+ store:
+ type: object
+ properties:
+ resources:
+ type: object
+ properties:
+ requests:
+ type: object
+ properties:
+ storage:
+ type: string
+ description: Storage size
+ description: Storage resource requests
+ description: Store resources
+ description: Storage configuration
+ status:
+ type: object
+ properties:
+ synchronized:
+ type: boolean
+ description: Whether raft cluster is synchronized
+ replicas:
+ type: integer
+ format: int32
+ description: Number of replicas
+ readyReplicas:
+ type: integer
+ format: int32
+ description: Number of ready replicas
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ type:
+ type: string
+ description: Error type
+ message:
+ type: string
+ description: Error message
+ timestamp:
+ type: string
+ format: date-time
+ description: Error timestamp
+ description: List of recent errors
+ subresources:
+ status: {}
+ conversion:
+ strategy: None # Built-in conversion via ConvertTo/ConvertFrom methods
+
diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml
index 5d7425a..6fbe1d3 100644
--- a/config/crd/kustomization.yaml
+++ b/config/crd/kustomization.yaml
@@ -19,7 +19,7 @@
# since it depends on service name and namespace that are out of this
kustomize package.
# It should be run by config/default
resources:
-- bases/operator.seata.apache.org_seataservers.yaml
+- bases/v1/seataservers_crd.yaml
#+kubebuilder:scaffold:crdkustomizeresource
patchesStrategicMerge:
diff --git a/docs/developerGuide.md b/docs/developerGuide.md
index 0e3016a..074bc31 100644
--- a/docs/developerGuide.md
+++ b/docs/developerGuide.md
@@ -70,7 +70,7 @@ make generate
make manifests
```
-This will update the
`config/crd/bases/operator.seata.apache.org_seataservers.yaml` file.
+This will update the `config/crd/bases/v1/seataservers_crd.yaml` file with the
v1 API version and support for both v1 and v1alpha1 versions.
**Step 3**, We need to verify to ensure the generated `CRD` meets our
expectations.
@@ -156,7 +156,7 @@ make generate
make manifests
```
-This will update the
`config/crd/bases/operator.seata.apache.org_seataservers.yaml` file
+This will update the `config/crd/bases/v1/seataservers_crd.yaml` file with the
v1 API version and support for both v1 and v1alpha1 versions.
**3. Verify the CRD**
diff --git a/docs/developerGuide.zh.md b/docs/developerGuide.zh.md
index f2dc8cf..68372b4 100644
--- a/docs/developerGuide.zh.md
+++ b/docs/developerGuide.zh.md
@@ -120,7 +120,7 @@ make generate
make manifests
```
-这将更新`config/crd/bases/operator.seata.apache.org_seataservers.yaml`文件
+这将更新`config/crd/bases/v1/seataservers_crd.yaml`文件,包含 v1 API 版本以及对 v1 和
v1alpha1 两个版本的支持
**第三步**,我们要验证以确保生成的`CRD`符合预期
@@ -219,7 +219,7 @@ make generate
make manifests
```
-这将更新`config/crd/bases/operator.seata.apache.org_seataservers.yaml`文件
+这将更新`config/crd/bases/v1/seataservers_crd.yaml`文件,包含 v1 API 版本以及对 v1 和
v1alpha1 两个版本的支持
**3.验证CRD**
diff --git a/main.go b/main.go
index 64ce951..258c253 100644
--- a/main.go
+++ b/main.go
@@ -34,6 +34,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
+ seatav1 "github.com/apache/seata-k8s/api/v1"
seatav1alpha1 "github.com/apache/seata-k8s/api/v1alpha1"
"github.com/apache/seata-k8s/controllers"
//+kubebuilder:scaffold:imports
@@ -47,6 +48,9 @@ var (
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
+ // Add v1 API version (storage version)
+ utilruntime.Must(seatav1.AddToScheme(scheme))
+ // Add v1alpha1 API version (with conversion from v1alpha1 to v1)
utilruntime.Must(seatav1alpha1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]