This is an automated email from the ASF dual-hosted git repository.

miaoliyao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shardingsphere-on-cloud.git


The following commit(s) were added to refs/heads/main by this push:
     new 05130df  chore: add StorageNode usage of aws rds cluster
     new d328eb5  Merge pull request #407 from Xu-Wentao/storage-node
05130df is described below

commit 05130dfd289f7ae20f074e1f47754c89d38f0e83
Author: xuwentao <[email protected]>
AuthorDate: Thu Jun 8 19:00:58 2023 +0800

    chore: add StorageNode usage of aws rds cluster
---
 .../shardingsphere.apache.org_storagenodes.yaml    | 282 ++++++++++-----------
 ...ingsphereproxy-storagenode-aws-rds-cluster.yaml |  33 +++
 ...phereproxy-storageprovider-aws-rds-cluster.yaml |  33 +++
 .../api/v1alpha1/storage_node_types.go             |   4 +-
 4 files changed, 208 insertions(+), 144 deletions(-)

diff --git 
a/charts/apache-shardingsphere-operator-charts/crds/shardingsphere.apache.org_storagenodes.yaml
 
b/charts/apache-shardingsphere-operator-charts/crds/shardingsphere.apache.org_storagenodes.yaml
index afb6d20..87f7ca7 100644
--- 
a/charts/apache-shardingsphere-operator-charts/crds/shardingsphere.apache.org_storagenodes.yaml
+++ 
b/charts/apache-shardingsphere-operator-charts/crds/shardingsphere.apache.org_storagenodes.yaml
@@ -31,130 +31,64 @@ spec:
     singular: storagenode
   scope: Namespaced
   versions:
-  - additionalPrinterColumns:
-    - jsonPath: .metadata.creationTimestamp
-      name: Age
-      type: date
-    - jsonPath: .status.phase
-      name: Phase
-      type: string
-    - jsonPath: .status.Cluster.Status
-      name: ClusterStatus
-      type: string
-    - jsonPath: .status.Registered
-      name: Registered
-      priority: 1
-      type: boolean
-    name: v1alpha1
-    schema:
-      openAPIV3Schema:
-        description: StorageNode is the Schema for the ShardingSphere storage 
unit
-        properties:
-          apiVersion:
-            description: 'APIVersion defines the versioned schema of this 
representation
+    - additionalPrinterColumns:
+        - jsonPath: .metadata.creationTimestamp
+          name: Age
+          type: date
+        - jsonPath: .status.phase
+          name: Phase
+          type: string
+        - jsonPath: .status.cluster.status
+          name: ClusterStatus
+          type: string
+        - jsonPath: .status.Registered
+          name: registered
+          priority: 1
+          type: boolean
+      name: v1alpha1
+      schema:
+        openAPIV3Schema:
+          description: StorageNode is the Schema for the ShardingSphere 
storage unit
+          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
+              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: StorageNodeSpec defines the desired state of a set of 
storage
-              units
-            properties:
-              replicas:
-                default: 1
-                description: 'only for cluster provider like AWS RDS Cluster/ 
AWS
-                  Aurora Cluster The Default value is 1 for cluster provider 
will
-                  not be effective for single instance, instance will always 
be 1
-                  for single instance Example: 2, means 2 instances in the 
cluster(1
-                  primary + 1 reader)'
-                format: int32
-                type: integer
-              schema:
-                description: if not set, will NOT create database
-                type: string
-              storageProviderName:
-                type: string
-            required:
-            - schema
-            - storageProviderName
-            type: object
-          status:
-            description: StorageNodeStatus defines the actual state of a set 
of storage
-              units
-            properties:
-              cluster:
-                description: Cluster contains the current status of the 
StorageNode
-                  cluster
-                properties:
-                  primaryEndpoint:
-                    properties:
-                      address:
-                        type: string
-                      port:
-                        format: int32
-                        type: integer
-                    required:
-                    - address
-                    - port
-                    type: object
-                  properties:
-                    additionalProperties:
-                      type: string
-                    type: object
-                  readerEndpoints:
-                    items:
-                      properties:
-                        address:
-                          type: string
-                        port:
-                          format: int32
-                          type: integer
-                      required:
-                      - address
-                      - port
-                      type: object
-                    type: array
-                  status:
-                    type: string
-                required:
-                - primaryEndpoint
-                - status
-                type: object
-              conditions:
-                description: Conditions The conditions array, the reason and 
message
-                  fields
-                items:
-                  description: StorageNodeCondition contains details for the 
current
-                    condition of this StorageNode.
-                  properties:
-                    lastUpdateTime:
-                      format: date-time
-                      type: string
-                    message:
-                      type: string
-                    reason:
-                      type: string
-                    status:
-                      type: string
-                    type:
-                      type: string
-                  required:
-                  - message
-                  - reason
-                  - status
-                  - type
-                  type: object
-                type: array
-              instances:
-                description: Instances contains the current status of the 
StorageNode
-                  instance
-                items:
+              type: string
+            metadata:
+              type: object
+            spec:
+              description: StorageNodeSpec defines the desired state of a set 
of storage
+                units
+              properties:
+                replicas:
+                  default: 1
+                  description: Only for aws aurora storage provider right now. 
And the
+                    default value is 1. aws rds instance is always 1. aws rds 
cluster
+                    will auto create 3 instances(1 primary and 2 replicas).
+                  format: int32
+                  type: integer
+                schema:
+                  description: if not set, will NOT create database
+                  type: string
+                storageProviderName:
+                  type: string
+              required:
+                - schema
+                - storageProviderName
+              type: object
+            status:
+              description: StorageNodeStatus defines the actual state of a set 
of storage
+                units
+              properties:
+                cluster:
+                  description: Cluster contains the current status of the 
StorageNode
+                    cluster
                   properties:
                     primaryEndpoint:
                       properties:
@@ -164,37 +98,101 @@ spec:
                           format: int32
                           type: integer
                       required:
-                      - address
-                      - port
+                        - address
+                        - port
                       type: object
                     properties:
                       additionalProperties:
                         type: string
                       type: object
+                    readerEndpoints:
+                      items:
+                        properties:
+                          address:
+                            type: string
+                          port:
+                            format: int32
+                            type: integer
+                        required:
+                          - address
+                          - port
+                        type: object
+                      type: array
                     status:
                       type: string
                   required:
-                  - primaryEndpoint
-                  - status
+                    - primaryEndpoint
+                    - status
                   type: object
-                type: array
-              observedGeneration:
-                description: The generation observed by the StorageNode 
controller.
-                format: int64
-                type: integer
-              phase:
-                description: 'Phase is a brief summary of the StorageNode life 
cycle
+                conditions:
+                  description: Conditions The conditions array, the reason and 
message
+                    fields
+                  items:
+                    description: StorageNodeCondition contains details for the 
current
+                      condition of this StorageNode.
+                    properties:
+                      lastUpdateTime:
+                        format: date-time
+                        type: string
+                      message:
+                        type: string
+                      reason:
+                        type: string
+                      status:
+                        type: string
+                      type:
+                        type: string
+                    required:
+                      - message
+                      - reason
+                      - status
+                      - type
+                    type: object
+                  type: array
+                instances:
+                  description: Instances contains the current status of the 
StorageNode
+                    instance
+                  items:
+                    properties:
+                      primaryEndpoint:
+                        properties:
+                          address:
+                            type: string
+                          port:
+                            format: int32
+                            type: integer
+                        required:
+                          - address
+                          - port
+                        type: object
+                      properties:
+                        additionalProperties:
+                          type: string
+                        type: object
+                      status:
+                        type: string
+                    required:
+                      - primaryEndpoint
+                      - status
+                    type: object
+                  type: array
+                observedGeneration:
+                  description: The generation observed by the StorageNode 
controller.
+                  format: int64
+                  type: integer
+                phase:
+                  description: 'Phase is a brief summary of the StorageNode 
life cycle
                   There are two possible phase values: Ready: StorageNode can 
already
                   provide external services NotReady: StorageNode cannot 
provide external
                   services'
-                type: string
-              registered:
-                description: Registered indicates whether the StorageNode has 
been
-                  registered to shardingsphere
-                type: boolean
-            type: object
-        type: object
-    served: true
-    storage: true
-    subresources:
-      status: {}
+                  type: string
+                registered:
+                  description: Registered indicates whether the StorageNode 
has been
+                    registered to shardingsphere
+                  type: boolean
+              type: object
+          type: object
+      served: true
+      storage: true
+      subresources:
+        status: {}
diff --git 
a/examples/operator/shardingsphereproxy-storagenode-aws-rds-cluster.yaml 
b/examples/operator/shardingsphereproxy-storagenode-aws-rds-cluster.yaml
new file mode 100644
index 0000000..7fb098c
--- /dev/null
+++ b/examples/operator/shardingsphereproxy-storagenode-aws-rds-cluster.yaml
@@ -0,0 +1,33 @@
+#
+# 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: shardingsphere.apache.org/v1alpha1
+kind: StorageNode
+metadata:
+  name: storage-node-with-rds-cluster-1
+  namespace: xwt
+  annotations:
+    "storageproviders.shardingsphere.apache.org/cluster-identifier": 
"storage-node-with-rds-cluster-1"
+    "storageproviders.shardingsphere.apache.org/instance-db-name": "test_db"
+
+    # annos about register storage unit
+    "shardingsphere.apache.org/register-storage-unit-enabled": "false" # set 
ture if you want to test auto register storage unit.
+    "shardingsphere.apache.org/logic-database-name": "sharding_db"
+    "shardingsphere.apache.org/compute-node-name": 
"shardingsphere-operator-shardingsphere-proxy"
+spec:
+  schema: "test_db"
+  storageProviderName: aws-rds-cluster-mysql-8.0.32
diff --git 
a/examples/operator/shardingsphereproxy-storageprovider-aws-rds-cluster.yaml 
b/examples/operator/shardingsphereproxy-storageprovider-aws-rds-cluster.yaml
new file mode 100644
index 0000000..2eb0e84
--- /dev/null
+++ b/examples/operator/shardingsphereproxy-storageprovider-aws-rds-cluster.yaml
@@ -0,0 +1,33 @@
+#
+# 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: shardingsphere.apache.org/v1alpha1
+kind: StorageProvider
+metadata:
+  name: aws-rds-cluster-mysql-8.0.32
+spec:
+  provisioner: storageproviders.shardingsphere.apache.org/aws-rds-cluster
+  reclaimPolicy: Delete
+  parameters:
+    engine: mysql
+    engineVersion: "8.0.32"
+    allocatedStorage: "100"
+    masterUsername: "root"
+    masterUserPassword: "root123456"
+    instanceClass: "db.m5d.large"
+    iops: "1000"
+    storageType: "io1"
diff --git a/shardingsphere-operator/api/v1alpha1/storage_node_types.go 
b/shardingsphere-operator/api/v1alpha1/storage_node_types.go
index 1dc1d97..435c365 100644
--- a/shardingsphere-operator/api/v1alpha1/storage_node_types.go
+++ b/shardingsphere-operator/api/v1alpha1/storage_node_types.go
@@ -97,8 +97,8 @@ type StorageNodeList struct {
 
 // 
+kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name=Age,type=date
 // +kubebuilder:printcolumn:JSONPath=".status.phase",name=Phase,type=string
-// 
+kubebuilder:printcolumn:JSONPath=".status.Cluster.Status",name=ClusterStatus,type=string
-// 
+kubebuilder:printcolumn:JSONPath=".status.Registered",name=Registered,type=boolean,priority=1
+// 
+kubebuilder:printcolumn:JSONPath=".status.cluster.status",name=ClusterStatus,type=string
+// 
+kubebuilder:printcolumn:JSONPath=".status.registered",name=registered,type=boolean,priority=1
 // +kubebuilder:object:root=true
 // +kubebuilder:subresource:status
 

Reply via email to