You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2022/12/19 12:43:50 UTC
[shardingsphere-on-cloud] branch main updated: feat(charts): merge operator-charts and operator-cluster-charts. (#149)
This is an automated email from the ASF dual-hosted git repository.
sunnianjun 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 da4cedd feat(charts): merge operator-charts and operator-cluster-charts. (#149)
da4cedd is described below
commit da4ceddbe525203f633c3181013e190b394799e2
Author: pierce <xu...@gmail.com>
AuthorDate: Mon Dec 19 20:43:45 2022 +0800
feat(charts): merge operator-charts and operator-cluster-charts. (#149)
* feat(charts): merge operator-charts and operator-cluster-charts.
1. Merged operator-charts and operator-cluster-charts, and operator-cluster-chatrs renamed to cluster-operator-charts.
2. Removed webhook code.
3. `ProxySpec` resource type changed from `*v1.ResourceRequirements` to `v1.ResourceRequirements` to fix operator update deployments panic when resource is null
Signed-off-by: xuanyuan300 <xu...@gmail.com>
* fix(test): fix unit test failed, fix check license
Signed-off-by: xuanyuan300 <xu...@gmail.com>
* chore(chart): reset values.yaml
Signed-off-by: xuanyuan300 <xu...@gmail.com>
* chore(chart): remove webhook port
Signed-off-by: xuanyuan300 <xu...@gmail.com>
* chore(chart): remove webhook port
Signed-off-by: xuanyuan300 <xu...@gmail.com>
Signed-off-by: xuanyuan300 <xu...@gmail.com>
---
.../.helmignore | 0
.../Chart.yaml | 6 +-
.../LICENSE | 0
.../NOTICE | 0
.../README.md | 0
...ingsphere.apache.org_shardingsphereproxies.yaml | 1140 ++++++++++++++++++++
...pache.org_shardingsphereproxyserverconfigs.yaml | 207 ++++
.../templates/_helpers.tpl} | 13 +-
.../templates/operator_deployment.yaml | 65 ++
.../templates/operator_rbac.yaml | 222 ++++
...hardingsphere_v1alpha1_shardingsphereproxy.yaml | 25 +-
...e_v1alpha1_shardingsphereproxyserverconfig.yaml | 5 +-
.../values.yaml | 179 +++
.../values.yaml | 138 ---
.../api/v1alpha1/proxy_types.go | 2 +-
.../api/v1alpha1/proxy_webhook.go | 162 ---
.../api/v1alpha1/zz_generated.deepcopy.go | 8 +-
shardingsphere-operator/main.go | 9 +-
.../pkg/reconcile/deployment.go | 9 +-
.../pkg/reconcile/reconcile_test.go | 10 +-
20 files changed, 1854 insertions(+), 346 deletions(-)
diff --git a/charts/apache-shardingsphere-operator-cluster-charts/.helmignore b/charts/apache-shardingsphere-cluster-operator-charts/.helmignore
similarity index 100%
rename from charts/apache-shardingsphere-operator-cluster-charts/.helmignore
rename to charts/apache-shardingsphere-cluster-operator-charts/.helmignore
diff --git a/charts/apache-shardingsphere-operator-cluster-charts/Chart.yaml b/charts/apache-shardingsphere-cluster-operator-charts/Chart.yaml
similarity index 79%
rename from charts/apache-shardingsphere-operator-cluster-charts/Chart.yaml
rename to charts/apache-shardingsphere-cluster-operator-charts/Chart.yaml
index 4edd7b3..68f9570 100644
--- a/charts/apache-shardingsphere-operator-cluster-charts/Chart.yaml
+++ b/charts/apache-shardingsphere-cluster-operator-charts/Chart.yaml
@@ -16,10 +16,10 @@
#
apiVersion: v2
-name: apache-shardingsphere-operator-cluster-charts
-description: A Helm chart for ShardingSphere-Operator-Cluster
+name: apache-shardingsphere-proxy-cluster-operator-charts
+description: The ShardingSphere Proxy Cluster Kubernetes Operator automates provisioning, management, and operations of ShardingSphere Proxy clusters running on Kubernetes.
dependencies:
- - condition: zookeeper.enabled
+ - condition: proxyCluster.zookeeper.enabled
name: zookeeper
repository: https://charts.bitnami.com/bitnami
version: 9.2.7
diff --git a/charts/apache-shardingsphere-operator-cluster-charts/LICENSE b/charts/apache-shardingsphere-cluster-operator-charts/LICENSE
similarity index 100%
rename from charts/apache-shardingsphere-operator-cluster-charts/LICENSE
rename to charts/apache-shardingsphere-cluster-operator-charts/LICENSE
diff --git a/charts/apache-shardingsphere-operator-cluster-charts/NOTICE b/charts/apache-shardingsphere-cluster-operator-charts/NOTICE
similarity index 100%
rename from charts/apache-shardingsphere-operator-cluster-charts/NOTICE
rename to charts/apache-shardingsphere-cluster-operator-charts/NOTICE
diff --git a/charts/apache-shardingsphere-operator-cluster-charts/README.md b/charts/apache-shardingsphere-cluster-operator-charts/README.md
similarity index 100%
rename from charts/apache-shardingsphere-operator-cluster-charts/README.md
rename to charts/apache-shardingsphere-cluster-operator-charts/README.md
diff --git a/charts/apache-shardingsphere-cluster-operator-charts/crds/shardingsphere.apache.org_shardingsphereproxies.yaml b/charts/apache-shardingsphere-cluster-operator-charts/crds/shardingsphere.apache.org_shardingsphereproxies.yaml
new file mode 100644
index 0000000..01a235e
--- /dev/null
+++ b/charts/apache-shardingsphere-cluster-operator-charts/crds/shardingsphere.apache.org_shardingsphereproxies.yaml
@@ -0,0 +1,1140 @@
+#
+# 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.9.0
+ creationTimestamp: null
+ name: shardingsphereproxies.shardingsphere.apache.org
+spec:
+ group: shardingsphere.apache.org
+ names:
+ kind: ShardingSphereProxy
+ listKind: ShardingSphereProxyList
+ plural: shardingsphereproxies
+ singular: shardingsphereproxy
+ scope: Namespaced
+ versions:
+ - additionalPrinterColumns:
+ - jsonPath: .status.readyNodes
+ name: ReadyNodes
+ type: integer
+ - jsonPath: .status.phase
+ name: Phase
+ type: string
+ name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ description: ShardingSphereProxy is the Schema for the proxies 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: ProxySpec defines the desired state of ShardingSphereProxy
+ properties:
+ automaticScaling:
+ description: AutomaticScaling HPA configuration
+ properties:
+ customMetrics:
+ items:
+ description: MetricSpec specifies how to scale based on a single
+ metric (only `type` and one other matching field should be
+ set at once).
+ properties:
+ containerResource:
+ description: container resource refers to a resource metric
+ (such as those specified in requests and limits) known
+ to Kubernetes describing a single container in each pod
+ of the current scale target (e.g. CPU or memory). Such
+ metrics are built in to Kubernetes, and have special scaling
+ options on top of those available to normal per-pod metrics
+ using the "pods" source. This is an alpha feature and
+ can be enabled by the HPAContainerMetrics feature flag.
+ properties:
+ container:
+ description: container is the name of the container
+ in the pods of the scaling target
+ type: string
+ name:
+ description: name is the name of the resource in question.
+ type: string
+ target:
+ description: target specifies the target value for the
+ given metric
+ properties:
+ averageUtilization:
+ description: averageUtilization is the target value
+ of the average of the resource metric across all
+ relevant pods, represented as a percentage of
+ the requested value of the resource for the pods.
+ Currently only valid for Resource metric source
+ type
+ format: int32
+ type: integer
+ averageValue:
+ anyOf:
+ - type: integer
+ - type: string
+ description: averageValue is the target value of
+ the average of the metric across all relevant
+ pods (as a quantity)
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ type:
+ description: type represents whether the metric
+ type is Utilization, Value, or AverageValue
+ type: string
+ value:
+ anyOf:
+ - type: integer
+ - type: string
+ description: value is the target value of the metric
+ (as a quantity).
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ required:
+ - type
+ type: object
+ required:
+ - container
+ - name
+ - target
+ type: object
+ external:
+ description: external refers to a global metric that is
+ not associated with any Kubernetes object. It allows autoscaling
+ based on information coming from components running outside
+ of cluster (for example length of queue in cloud messaging
+ service, or QPS from loadbalancer running outside of cluster).
+ properties:
+ metric:
+ description: metric identifies the target metric by
+ name and selector
+ properties:
+ name:
+ description: name is the name of the given metric
+ type: string
+ selector:
+ description: selector is the string-encoded form
+ of a standard kubernetes label selector for the
+ given metric When set, it is passed as an additional
+ parameter to the metrics server for more specific
+ metrics scoping. When unset, just the metricName
+ will be used to gather metrics.
+ 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
+ required:
+ - name
+ type: object
+ target:
+ description: target specifies the target value for the
+ given metric
+ properties:
+ averageUtilization:
+ description: averageUtilization is the target value
+ of the average of the resource metric across all
+ relevant pods, represented as a percentage of
+ the requested value of the resource for the pods.
+ Currently only valid for Resource metric source
+ type
+ format: int32
+ type: integer
+ averageValue:
+ anyOf:
+ - type: integer
+ - type: string
+ description: averageValue is the target value of
+ the average of the metric across all relevant
+ pods (as a quantity)
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ type:
+ description: type represents whether the metric
+ type is Utilization, Value, or AverageValue
+ type: string
+ value:
+ anyOf:
+ - type: integer
+ - type: string
+ description: value is the target value of the metric
+ (as a quantity).
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ required:
+ - type
+ type: object
+ required:
+ - metric
+ - target
+ type: object
+ object:
+ description: object refers to a metric describing a single
+ kubernetes object (for example, hits-per-second on an
+ Ingress object).
+ properties:
+ describedObject:
+ description: CrossVersionObjectReference contains enough
+ information to let you identify the referred resource.
+ properties:
+ apiVersion:
+ description: API version of the referent
+ type: string
+ kind:
+ description: 'Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"'
+ type: string
+ name:
+ description: 'Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names'
+ type: string
+ required:
+ - kind
+ - name
+ type: object
+ metric:
+ description: metric identifies the target metric by
+ name and selector
+ properties:
+ name:
+ description: name is the name of the given metric
+ type: string
+ selector:
+ description: selector is the string-encoded form
+ of a standard kubernetes label selector for the
+ given metric When set, it is passed as an additional
+ parameter to the metrics server for more specific
+ metrics scoping. When unset, just the metricName
+ will be used to gather metrics.
+ 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
+ required:
+ - name
+ type: object
+ target:
+ description: target specifies the target value for the
+ given metric
+ properties:
+ averageUtilization:
+ description: averageUtilization is the target value
+ of the average of the resource metric across all
+ relevant pods, represented as a percentage of
+ the requested value of the resource for the pods.
+ Currently only valid for Resource metric source
+ type
+ format: int32
+ type: integer
+ averageValue:
+ anyOf:
+ - type: integer
+ - type: string
+ description: averageValue is the target value of
+ the average of the metric across all relevant
+ pods (as a quantity)
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ type:
+ description: type represents whether the metric
+ type is Utilization, Value, or AverageValue
+ type: string
+ value:
+ anyOf:
+ - type: integer
+ - type: string
+ description: value is the target value of the metric
+ (as a quantity).
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ required:
+ - type
+ type: object
+ required:
+ - describedObject
+ - metric
+ - target
+ type: object
+ pods:
+ description: pods refers to a metric describing each pod
+ in the current scale target (for example, transactions-processed-per-second). The
+ values will be averaged together before being compared
+ to the target value.
+ properties:
+ metric:
+ description: metric identifies the target metric by
+ name and selector
+ properties:
+ name:
+ description: name is the name of the given metric
+ type: string
+ selector:
+ description: selector is the string-encoded form
+ of a standard kubernetes label selector for the
+ given metric When set, it is passed as an additional
+ parameter to the metrics server for more specific
+ metrics scoping. When unset, just the metricName
+ will be used to gather metrics.
+ 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
+ required:
+ - name
+ type: object
+ target:
+ description: target specifies the target value for the
+ given metric
+ properties:
+ averageUtilization:
+ description: averageUtilization is the target value
+ of the average of the resource metric across all
+ relevant pods, represented as a percentage of
+ the requested value of the resource for the pods.
+ Currently only valid for Resource metric source
+ type
+ format: int32
+ type: integer
+ averageValue:
+ anyOf:
+ - type: integer
+ - type: string
+ description: averageValue is the target value of
+ the average of the metric across all relevant
+ pods (as a quantity)
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ type:
+ description: type represents whether the metric
+ type is Utilization, Value, or AverageValue
+ type: string
+ value:
+ anyOf:
+ - type: integer
+ - type: string
+ description: value is the target value of the metric
+ (as a quantity).
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ required:
+ - type
+ type: object
+ required:
+ - metric
+ - target
+ type: object
+ resource:
+ description: resource refers to a resource metric (such
+ as those specified in requests and limits) known to Kubernetes
+ describing each pod in the current scale target (e.g.
+ CPU or memory). Such metrics are built in to Kubernetes,
+ and have special scaling options on top of those available
+ to normal per-pod metrics using the "pods" source.
+ properties:
+ name:
+ description: name is the name of the resource in question.
+ type: string
+ target:
+ description: target specifies the target value for the
+ given metric
+ properties:
+ averageUtilization:
+ description: averageUtilization is the target value
+ of the average of the resource metric across all
+ relevant pods, represented as a percentage of
+ the requested value of the resource for the pods.
+ Currently only valid for Resource metric source
+ type
+ format: int32
+ type: integer
+ averageValue:
+ anyOf:
+ - type: integer
+ - type: string
+ description: averageValue is the target value of
+ the average of the metric across all relevant
+ pods (as a quantity)
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ type:
+ description: type represents whether the metric
+ type is Utilization, Value, or AverageValue
+ type: string
+ value:
+ anyOf:
+ - type: integer
+ - type: string
+ description: value is the target value of the metric
+ (as a quantity).
+ pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
+ x-kubernetes-int-or-string: true
+ required:
+ - type
+ type: object
+ required:
+ - name
+ - target
+ type: object
+ type:
+ description: 'type is the type of metric source. It should
+ be one of "ContainerResource", "External", "Object", "Pods"
+ or "Resource", each mapping to a matching field in the
+ object. Note: "ContainerResource" type is available on
+ when the feature-gate HPAContainerMetrics is enabled'
+ type: string
+ required:
+ - type
+ type: object
+ type: array
+ enable:
+ type: boolean
+ maxInstance:
+ format: int32
+ type: integer
+ minInstance:
+ format: int32
+ type: integer
+ scaleDownWindows:
+ format: int32
+ type: integer
+ scaleUpWindows:
+ format: int32
+ type: integer
+ target:
+ format: int32
+ type: integer
+ type: object
+ imagePullSecrets:
+ items:
+ description: LocalObjectReference contains enough information to
+ let you locate the referenced object inside the same namespace.
+ properties:
+ 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
+ type: object
+ type: array
+ livenessProbe:
+ description: Probes are not allowed for ephemeral containers.
+ properties:
+ exec:
+ description: Exec specifies the action to take.
+ properties:
+ command:
+ description: Command is the command line to execute inside
+ the container, the working directory for the command is
+ root ('/') in the container's filesystem. The command is
+ simply exec'd, it is not run inside a shell, so traditional
+ shell instructions ('|', etc) won't work. To use a shell,
+ you need to explicitly call out to that shell. Exit status
+ of 0 is treated as live/healthy and non-zero is unhealthy.
+ items:
+ type: string
+ type: array
+ type: object
+ failureThreshold:
+ description: Minimum consecutive failures for the probe to be
+ considered failed after having succeeded. Defaults to 3. Minimum
+ value is 1.
+ format: int32
+ type: integer
+ grpc:
+ description: GRPC specifies an action involving a GRPC port. This
+ is a beta field and requires enabling GRPCContainerProbe feature
+ gate.
+ properties:
+ port:
+ description: Port number of the gRPC service. Number must
+ be in the range 1 to 65535.
+ format: int32
+ type: integer
+ service:
+ description: "Service is the name of the service to place
+ in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).
+ \n If this is not specified, the default behavior is defined
+ by gRPC."
+ type: string
+ required:
+ - port
+ type: object
+ httpGet:
+ description: HTTPGet specifies the http request to perform.
+ properties:
+ host:
+ description: Host name to connect to, defaults to the pod
+ IP. You probably want to set "Host" in httpHeaders instead.
+ type: string
+ httpHeaders:
+ description: Custom headers to set in the request. HTTP allows
+ repeated headers.
+ items:
+ description: HTTPHeader describes a custom header to be
+ used in HTTP probes
+ properties:
+ name:
+ description: The header field name
+ type: string
+ value:
+ description: The header field value
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ description: Path to access on the HTTP server.
+ type: string
+ port:
+ anyOf:
+ - type: integer
+ - type: string
+ description: Name or number of the port to access on the container.
+ Number must be in the range 1 to 65535. Name must be an
+ IANA_SVC_NAME.
+ x-kubernetes-int-or-string: true
+ scheme:
+ description: Scheme to use for connecting to the host. Defaults
+ to HTTP.
+ type: string
+ required:
+ - port
+ type: object
+ initialDelaySeconds:
+ description: 'Number of seconds after the container has started
+ before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
+ format: int32
+ type: integer
+ periodSeconds:
+ description: How often (in seconds) to perform the probe. Default
+ to 10 seconds. Minimum value is 1.
+ format: int32
+ type: integer
+ successThreshold:
+ description: Minimum consecutive successes for the probe to be
+ considered successful after having failed. Defaults to 1. Must
+ be 1 for liveness and startup. Minimum value is 1.
+ format: int32
+ type: integer
+ tcpSocket:
+ description: TCPSocket specifies an action involving a TCP port.
+ properties:
+ host:
+ description: 'Optional: Host name to connect to, defaults
+ to the pod IP.'
+ type: string
+ port:
+ anyOf:
+ - type: integer
+ - type: string
+ description: Number or name of the port to access on the container.
+ Number must be in the range 1 to 65535. Name must be an
+ IANA_SVC_NAME.
+ x-kubernetes-int-or-string: true
+ required:
+ - port
+ type: object
+ terminationGracePeriodSeconds:
+ description: Optional duration in seconds the pod needs to terminate
+ gracefully upon probe failure. The grace period is the duration
+ in seconds after the processes running in the pod are sent a
+ termination signal and the time when the processes are forcibly
+ halted with a kill signal. Set this value longer than the expected
+ cleanup time for your process. If this value is nil, the pod's
+ terminationGracePeriodSeconds will be used. Otherwise, this
+ value overrides the value provided by the pod spec. Value must
+ be non-negative integer. The value zero indicates stop immediately
+ via the kill signal (no opportunity to shut down). This is a
+ beta field and requires enabling ProbeTerminationGracePeriod
+ feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds
+ is used if unset.
+ format: int64
+ type: integer
+ timeoutSeconds:
+ description: 'Number of seconds after which the probe times out.
+ Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
+ format: int32
+ type: integer
+ type: object
+ mySQLDriver:
+ description: MySQLDriver Defines the mysql-driven version in ShardingSphere-proxy
+ properties:
+ version:
+ description: mysql-driven version,must be x.y.z
+ pattern: ^([1-9]\d|[1-9])(\.([1-9]\d|\d)){2}$
+ type: string
+ required:
+ - version
+ type: object
+ port:
+ description: Port is ShardingSphere-Proxy startup port
+ format: int32
+ minimum: 0
+ type: integer
+ proxyConfigName:
+ description: ProxyConfigName is the name of the ShardingSphereProxyServerConfig
+ CRD
+ minLength: 0
+ pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
+ type: string
+ readinessProbe:
+ description: Probes are not allowed for ephemeral containers.
+ properties:
+ exec:
+ description: Exec specifies the action to take.
+ properties:
+ command:
+ description: Command is the command line to execute inside
+ the container, the working directory for the command is
+ root ('/') in the container's filesystem. The command is
+ simply exec'd, it is not run inside a shell, so traditional
+ shell instructions ('|', etc) won't work. To use a shell,
+ you need to explicitly call out to that shell. Exit status
+ of 0 is treated as live/healthy and non-zero is unhealthy.
+ items:
+ type: string
+ type: array
+ type: object
+ failureThreshold:
+ description: Minimum consecutive failures for the probe to be
+ considered failed after having succeeded. Defaults to 3. Minimum
+ value is 1.
+ format: int32
+ type: integer
+ grpc:
+ description: GRPC specifies an action involving a GRPC port. This
+ is a beta field and requires enabling GRPCContainerProbe feature
+ gate.
+ properties:
+ port:
+ description: Port number of the gRPC service. Number must
+ be in the range 1 to 65535.
+ format: int32
+ type: integer
+ service:
+ description: "Service is the name of the service to place
+ in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).
+ \n If this is not specified, the default behavior is defined
+ by gRPC."
+ type: string
+ required:
+ - port
+ type: object
+ httpGet:
+ description: HTTPGet specifies the http request to perform.
+ properties:
+ host:
+ description: Host name to connect to, defaults to the pod
+ IP. You probably want to set "Host" in httpHeaders instead.
+ type: string
+ httpHeaders:
+ description: Custom headers to set in the request. HTTP allows
+ repeated headers.
+ items:
+ description: HTTPHeader describes a custom header to be
+ used in HTTP probes
+ properties:
+ name:
+ description: The header field name
+ type: string
+ value:
+ description: The header field value
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ description: Path to access on the HTTP server.
+ type: string
+ port:
+ anyOf:
+ - type: integer
+ - type: string
+ description: Name or number of the port to access on the container.
+ Number must be in the range 1 to 65535. Name must be an
+ IANA_SVC_NAME.
+ x-kubernetes-int-or-string: true
+ scheme:
+ description: Scheme to use for connecting to the host. Defaults
+ to HTTP.
+ type: string
+ required:
+ - port
+ type: object
+ initialDelaySeconds:
+ description: 'Number of seconds after the container has started
+ before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
+ format: int32
+ type: integer
+ periodSeconds:
+ description: How often (in seconds) to perform the probe. Default
+ to 10 seconds. Minimum value is 1.
+ format: int32
+ type: integer
+ successThreshold:
+ description: Minimum consecutive successes for the probe to be
+ considered successful after having failed. Defaults to 1. Must
+ be 1 for liveness and startup. Minimum value is 1.
+ format: int32
+ type: integer
+ tcpSocket:
+ description: TCPSocket specifies an action involving a TCP port.
+ properties:
+ host:
+ description: 'Optional: Host name to connect to, defaults
+ to the pod IP.'
+ type: string
+ port:
+ anyOf:
+ - type: integer
+ - type: string
+ description: Number or name of the port to access on the container.
+ Number must be in the range 1 to 65535. Name must be an
+ IANA_SVC_NAME.
+ x-kubernetes-int-or-string: true
+ required:
+ - port
+ type: object
+ terminationGracePeriodSeconds:
+ description: Optional duration in seconds the pod needs to terminate
+ gracefully upon probe failure. The grace period is the duration
+ in seconds after the processes running in the pod are sent a
+ termination signal and the time when the processes are forcibly
+ halted with a kill signal. Set this value longer than the expected
+ cleanup time for your process. If this value is nil, the pod's
+ terminationGracePeriodSeconds will be used. Otherwise, this
+ value overrides the value provided by the pod spec. Value must
+ be non-negative integer. The value zero indicates stop immediately
+ via the kill signal (no opportunity to shut down). This is a
+ beta field and requires enabling ProbeTerminationGracePeriod
+ feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds
+ is used if unset.
+ format: int64
+ type: integer
+ timeoutSeconds:
+ description: 'Number of seconds after which the probe times out.
+ Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
+ format: int32
+ type: integer
+ type: object
+ replicas:
+ description: Replicas is the expected number of replicas of ShardingSphere-Proxy
+ format: int32
+ type: integer
+ resources:
+ description: ResourceRequirements describes the compute resource requirements.
+ properties:
+ 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. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
+ type: object
+ type: object
+ serviceType:
+ description: ServiceType defines the Service in Kubernetes of ShardingSphere-Proxy
+ properties:
+ nodePort:
+ description: 'The port on each node on which this service is exposed
+ when type is NodePort or LoadBalancer. Usually assigned by
+ the system. If a value is specified, in-range, and not in use
+ it will be used, otherwise the operation will fail. If not
+ specified, a port will be allocated if this Service requires
+ one. If this field is specified when creating a Service which
+ does not need it, creation will fail. This field will be wiped
+ when updating a Service to no longer need it (e.g. changing
+ type from NodePort to ClusterIP). More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport'
+ format: int32
+ minimum: 0
+ type: integer
+ type:
+ description: Service Type string describes ingress methods for
+ a service
+ enum:
+ - ClusterIP
+ - NodePort
+ - LoadBalancer
+ - ExternalName
+ type: string
+ required:
+ - type
+ type: object
+ startupProbe:
+ description: Probes are not allowed for ephemeral containers.
+ properties:
+ exec:
+ description: Exec specifies the action to take.
+ properties:
+ command:
+ description: Command is the command line to execute inside
+ the container, the working directory for the command is
+ root ('/') in the container's filesystem. The command is
+ simply exec'd, it is not run inside a shell, so traditional
+ shell instructions ('|', etc) won't work. To use a shell,
+ you need to explicitly call out to that shell. Exit status
+ of 0 is treated as live/healthy and non-zero is unhealthy.
+ items:
+ type: string
+ type: array
+ type: object
+ failureThreshold:
+ description: Minimum consecutive failures for the probe to be
+ considered failed after having succeeded. Defaults to 3. Minimum
+ value is 1.
+ format: int32
+ type: integer
+ grpc:
+ description: GRPC specifies an action involving a GRPC port. This
+ is a beta field and requires enabling GRPCContainerProbe feature
+ gate.
+ properties:
+ port:
+ description: Port number of the gRPC service. Number must
+ be in the range 1 to 65535.
+ format: int32
+ type: integer
+ service:
+ description: "Service is the name of the service to place
+ in the gRPC HealthCheckRequest (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).
+ \n If this is not specified, the default behavior is defined
+ by gRPC."
+ type: string
+ required:
+ - port
+ type: object
+ httpGet:
+ description: HTTPGet specifies the http request to perform.
+ properties:
+ host:
+ description: Host name to connect to, defaults to the pod
+ IP. You probably want to set "Host" in httpHeaders instead.
+ type: string
+ httpHeaders:
+ description: Custom headers to set in the request. HTTP allows
+ repeated headers.
+ items:
+ description: HTTPHeader describes a custom header to be
+ used in HTTP probes
+ properties:
+ name:
+ description: The header field name
+ type: string
+ value:
+ description: The header field value
+ type: string
+ required:
+ - name
+ - value
+ type: object
+ type: array
+ path:
+ description: Path to access on the HTTP server.
+ type: string
+ port:
+ anyOf:
+ - type: integer
+ - type: string
+ description: Name or number of the port to access on the container.
+ Number must be in the range 1 to 65535. Name must be an
+ IANA_SVC_NAME.
+ x-kubernetes-int-or-string: true
+ scheme:
+ description: Scheme to use for connecting to the host. Defaults
+ to HTTP.
+ type: string
+ required:
+ - port
+ type: object
+ initialDelaySeconds:
+ description: 'Number of seconds after the container has started
+ before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
+ format: int32
+ type: integer
+ periodSeconds:
+ description: How often (in seconds) to perform the probe. Default
+ to 10 seconds. Minimum value is 1.
+ format: int32
+ type: integer
+ successThreshold:
+ description: Minimum consecutive successes for the probe to be
+ considered successful after having failed. Defaults to 1. Must
+ be 1 for liveness and startup. Minimum value is 1.
+ format: int32
+ type: integer
+ tcpSocket:
+ description: TCPSocket specifies an action involving a TCP port.
+ properties:
+ host:
+ description: 'Optional: Host name to connect to, defaults
+ to the pod IP.'
+ type: string
+ port:
+ anyOf:
+ - type: integer
+ - type: string
+ description: Number or name of the port to access on the container.
+ Number must be in the range 1 to 65535. Name must be an
+ IANA_SVC_NAME.
+ x-kubernetes-int-or-string: true
+ required:
+ - port
+ type: object
+ terminationGracePeriodSeconds:
+ description: Optional duration in seconds the pod needs to terminate
+ gracefully upon probe failure. The grace period is the duration
+ in seconds after the processes running in the pod are sent a
+ termination signal and the time when the processes are forcibly
+ halted with a kill signal. Set this value longer than the expected
+ cleanup time for your process. If this value is nil, the pod's
+ terminationGracePeriodSeconds will be used. Otherwise, this
+ value overrides the value provided by the pod spec. Value must
+ be non-negative integer. The value zero indicates stop immediately
+ via the kill signal (no opportunity to shut down). This is a
+ beta field and requires enabling ProbeTerminationGracePeriod
+ feature gate. Minimum value is 1. spec.terminationGracePeriodSeconds
+ is used if unset.
+ format: int64
+ type: integer
+ timeoutSeconds:
+ description: 'Number of seconds after which the probe times out.
+ Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes'
+ format: int32
+ type: integer
+ type: object
+ version:
+ description: Version is the version of ShardingSphere-Proxy
+ type: string
+ required:
+ - port
+ - proxyConfigName
+ - replicas
+ - serviceType
+ - version
+ type: object
+ status:
+ description: ProxyStatus defines the observed state of ShardingSphereProxy
+ properties:
+ conditions:
+ description: Conditions The conditions array, the reason and message
+ fields
+ items:
+ description: Condition | **condition** | **status** | **directions**|
+ | ------------- | ---------- | ----------------------------------------------------
+ | | Initialized | true | Initialization successful| |
+ Initialized | false | initialization failed| | Started |
+ true | pod started successfully but not ready| | Started |
+ false | pod started failed| | Ready | true |
+ The pod is ready and can provide external services| | Unknown |
+ true | ShardingSphere-Proxy failed to start correctly due
+ to some problems |
+ properties:
+ lastUpdateTime:
+ format: date-time
+ type: string
+ status:
+ type: string
+ type:
+ type: string
+ required:
+ - status
+ - type
+ type: object
+ type: array
+ phase:
+ description: 'ShardingSphere-Proxy phase are a brief summary of the
+ ShardingSphere-Proxy life cycle There are two possible phase values:
+ Ready: ShardingSphere-Proxy can already provide external services
+ NotReady: ShardingSphere-Proxy cannot provide external services'
+ type: string
+ readyNodes:
+ description: ReadyNodes shows the number of replicas that ShardingSphere-Proxy
+ is running normally
+ format: int32
+ type: integer
+ required:
+ - conditions
+ - phase
+ - readyNodes
+ type: object
+ type: object
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/charts/apache-shardingsphere-cluster-operator-charts/crds/shardingsphere.apache.org_shardingsphereproxyserverconfigs.yaml b/charts/apache-shardingsphere-cluster-operator-charts/crds/shardingsphere.apache.org_shardingsphereproxyserverconfigs.yaml
new file mode 100644
index 0000000..bebd4b6
--- /dev/null
+++ b/charts/apache-shardingsphere-cluster-operator-charts/crds/shardingsphere.apache.org_shardingsphereproxyserverconfigs.yaml
@@ -0,0 +1,207 @@
+#
+# 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.9.0
+ creationTimestamp: null
+ name: shardingsphereproxyserverconfigs.shardingsphere.apache.org
+spec:
+ group: shardingsphere.apache.org
+ names:
+ kind: ShardingSphereProxyServerConfig
+ listKind: ShardingSphereProxyServerConfigList
+ plural: shardingsphereproxyserverconfigs
+ singular: shardingsphereproxyserverconfig
+ scope: Namespaced
+ versions:
+ - additionalPrinterColumns:
+ - jsonPath: .status.metadataRepository
+ name: MetadataRepository
+ type: string
+ name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ description: ShardingSphereProxyServerConfig is the Schema for the proxyconfigs
+ 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: ProxyConfigSpec defines the desired state of ShardingSphereProxyServerConfig
+ properties:
+ authority:
+ description: Auth is used to set up initial user to login compute
+ node, and authority data of storage node.
+ properties:
+ privilege:
+ description: Privilege for storage node, the default value is
+ ALL_PRIVILEGES_PERMITTED
+ properties:
+ type:
+ type: string
+ required:
+ - type
+ type: object
+ users:
+ items:
+ description: 'User is a slice about authorized host and password
+ for compute node. Format: user:<username>@<hostname>,hostname
+ is % or empty string means do not care about authorized host
+ password:<password>'
+ properties:
+ password:
+ type: string
+ user:
+ type: string
+ required:
+ - password
+ - user
+ type: object
+ type: array
+ required:
+ - users
+ type: object
+ mode:
+ description: ClusterConfig needs to fill in the relevant configuration
+ required by Cluster mode
+ properties:
+ repository:
+ description: Persist repository configuration
+ properties:
+ props:
+ description: Properties of persist repository
+ properties:
+ digest:
+ description: Password of login
+ type: string
+ maxRetries:
+ description: 'MaxRetries Max retries of client connection.
+ default: 3'
+ type: integer
+ namespace:
+ description: Namespace of registry center
+ type: string
+ operationTimeoutMilliseconds:
+ description: 'OperationTimeoutMilliseconds Milliseconds
+ of operation timeout. default: 500'
+ type: integer
+ retryIntervalMilliseconds:
+ description: 'RetryIntervalMilliseconds Milliseconds of
+ retry interval. default: 500'
+ type: integer
+ server-lists:
+ description: Server lists of registry center
+ type: string
+ timeToLiveSeconds:
+ description: 'TimeToLiveSeconds Seconds of ephemeral data
+ live.default: 60'
+ type: integer
+ required:
+ - namespace
+ - server-lists
+ type: object
+ type:
+ description: Type of persist repository
+ enum:
+ - ZooKeeper
+ type: string
+ required:
+ - props
+ - type
+ type: object
+ type:
+ description: 'Type of mode configuration. Values only support:
+ Cluster'
+ enum:
+ - Cluster
+ type: string
+ required:
+ - repository
+ - type
+ type: object
+ props:
+ description: Props Apache ShardingSphere provides the way of property
+ configuration to configure system level configuration.
+ properties:
+ check-duplicate-table-enabled:
+ description: Whether validate duplicate table when application
+ startup or updated.
+ type: boolean
+ check-table-metadata-enabled:
+ description: Whether validate table meta data consistency when
+ application startup or updated.
+ type: boolean
+ kernel-executor-size:
+ description: The max thread size of worker group to execute SQL.
+ One ShardingSphereDataSource will use a independent thread pool,
+ it does not share thread pool even different data source in
+ same JVM.
+ type: integer
+ proxy-backend-driver-type:
+ type: string
+ proxy-backend-executor-suitable:
+ description: 'Available options of proxy backend executor suitable:
+ OLAP(default), OLTP. The OLTP option may reduce time cost of
+ writing packets to client, but it may increase the latency of
+ SQL execution and block other clients if client connections
+ are more than proxy-frontend-executor-size, especially executing
+ slow SQL.'
+ type: string
+ proxy-backend-query-fetch-size:
+ description: ShardingSphereProxy backend query fetch size. A larger
+ value may increase the memory usage of ShardingSphere ShardingSphereProxy.
+ The default value is -1, which means set the minimum value for
+ different JDBC drivers.
+ type: integer
+ proxy-frontend-database-protocol-type:
+ type: string
+ proxy-frontend-executor-size:
+ description: ShardingSphereProxy frontend Netty executor size.
+ The default value is 0, which means let Netty decide.
+ type: integer
+ type: object
+ required:
+ - authority
+ - mode
+ type: object
+ status:
+ description: ProxyConfigStatus defines the observed state of ShardingSphereProxyServerConfig
+ properties:
+ metadataRepository:
+ type: string
+ required:
+ - metadataRepository
+ type: object
+ type: object
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/charts/apache-shardingsphere-operator-cluster-charts/templates/shardingsphere_v1alpha1_shardingsphereproxyserverconfig.yaml b/charts/apache-shardingsphere-cluster-operator-charts/templates/_helpers.tpl
similarity index 73%
copy from charts/apache-shardingsphere-operator-cluster-charts/templates/shardingsphere_v1alpha1_shardingsphereproxyserverconfig.yaml
copy to charts/apache-shardingsphere-cluster-operator-charts/templates/_helpers.tpl
index cdaaadb..c6a21ed 100644
--- a/charts/apache-shardingsphere-operator-cluster-charts/templates/shardingsphere_v1alpha1_shardingsphereproxyserverconfig.yaml
+++ b/charts/apache-shardingsphere-cluster-operator-charts/templates/_helpers.tpl
@@ -1,4 +1,4 @@
-#
+{{/*#
# 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.
@@ -13,11 +13,8 @@
# 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: ShardingSphereProxyServerConfig
-metadata:
- name: {{ printf "%s-configuration" (include "common.names.fullname" .) }}
-spec:
- {{- include "common.tplvalues.render" (dict "value" .Values.serverConfig "context" $) | nindent 2 }}
\ No newline at end of file
+{{- define "operator.name" -}}
+{{- printf "%s-operator" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
diff --git a/charts/apache-shardingsphere-cluster-operator-charts/templates/operator_deployment.yaml b/charts/apache-shardingsphere-cluster-operator-charts/templates/operator_deployment.yaml
new file mode 100644
index 0000000..d92dab2
--- /dev/null
+++ b/charts/apache-shardingsphere-cluster-operator-charts/templates/operator_deployment.yaml
@@ -0,0 +1,65 @@
+#
+# 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: apps/v1
+kind: Deployment
+metadata:
+ labels:
+ app: shardingsphere-operator
+ name: {{ template "operator.name" . }}
+ namespace: {{ .Release.Namespace }}
+spec:
+ replicas: {{ .Values.operator.replicaCount }}
+ selector:
+ matchLabels:
+ app: shardingsphere-operator
+ template:
+ metadata:
+ labels:
+ app: shardingsphere-operator
+ spec:
+ containers:
+ - args:
+ - --health-probe-bind-address=:{{ .Values.operator.health.healthProbePort }}
+ - --leader-elect
+ command:
+ - /operator
+ ports:
+ - name: healthcheck
+ containerPort: {{ .Values.operator.health.healthProbePort }}
+ image: {{ .Values.operator.image.repository }}:{{ .Values.operator.image.tag }}
+ imagePullPolicy: {{ .Values.operator.image.pullPolicy }}
+ livenessProbe:
+ httpGet:
+ path: /healthz
+ port: {{ .Values.operator.health.healthProbePort }}
+ initialDelaySeconds: 15
+ periodSeconds: 20
+ name: operator
+ readinessProbe:
+ httpGet:
+ path: /readyz
+ port: {{ .Values.operator.health.healthProbePort }}
+ initialDelaySeconds: 5
+ periodSeconds: 10
+ resources:
+ {{- toYaml .Values.operator.resources | nindent 12 }}
+ {{- with .Values.operator.imagePullSecrets }}
+ imagePullSecrets:
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
+ serviceAccountName: {{ template "operator.name" . }}
diff --git a/charts/apache-shardingsphere-cluster-operator-charts/templates/operator_rbac.yaml b/charts/apache-shardingsphere-cluster-operator-charts/templates/operator_rbac.yaml
new file mode 100644
index 0000000..0e9ad52
--- /dev/null
+++ b/charts/apache-shardingsphere-cluster-operator-charts/templates/operator_rbac.yaml
@@ -0,0 +1,222 @@
+#
+# 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: v1
+kind: ServiceAccount
+metadata:
+ name: {{ template "operator.name" . }}
+ namespace: {{ .Release.Namespace }}
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: Role
+metadata:
+ name: {{ template "operator.name" . }}
+ namespace: {{ .Release.Namespace }}
+rules:
+ - apiGroups:
+ - ""
+ resources:
+ - configmaps
+ verbs:
+ - get
+ - list
+ - watch
+ - create
+ - update
+ - patch
+ - delete
+ - apiGroups:
+ - coordination.k8s.io
+ resources:
+ - leases
+ verbs:
+ - get
+ - list
+ - watch
+ - create
+ - update
+ - patch
+ - delete
+ - apiGroups:
+ - ""
+ resources:
+ - events
+ verbs:
+ - create
+ - patch
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ name: {{ template "operator.name" . }}
+rules:
+ - apiGroups:
+ - ""
+ resources:
+ - configmaps
+ - services
+ verbs:
+ - create
+ - delete
+ - get
+ - list
+ - patch
+ - update
+ - watch
+ - apiGroups:
+ - ""
+ resources:
+ - pods
+ verbs:
+ - create
+ - delete
+ - get
+ - list
+ - patch
+ - update
+ - watch
+ - apiGroups:
+ - ""
+ resources:
+ - pods/status
+ verbs:
+ - get
+ - list
+ - watch
+ - apiGroups:
+ - apps
+ resources:
+ - deployment/status
+ verbs:
+ - get
+ - list
+ - apiGroups:
+ - apps
+ resources:
+ - deployments
+ verbs:
+ - create
+ - delete
+ - get
+ - list
+ - patch
+ - update
+ - watch
+ - apiGroups:
+ - shardingsphere.apache.org
+ resources:
+ - shardingsphereproxies
+ verbs:
+ - create
+ - delete
+ - get
+ - list
+ - patch
+ - update
+ - watch
+ - apiGroups:
+ - shardingsphere.apache.org
+ resources:
+ - shardingsphereproxies/finalizers
+ verbs:
+ - update
+ - apiGroups:
+ - shardingsphere.apache.org
+ resources:
+ - shardingsphereproxies/status
+ verbs:
+ - get
+ - patch
+ - update
+ - apiGroups:
+ - shardingsphere.apache.org
+ resources:
+ - shardingsphereproxyserverconfigs
+ verbs:
+ - create
+ - delete
+ - get
+ - list
+ - patch
+ - update
+ - watch
+ - apiGroups:
+ - shardingsphere.apache.org
+ resources:
+ - shardingsphereproxyserverconfigs/finalizers
+ verbs:
+ - update
+ - apiGroups:
+ - shardingsphere.apache.org
+ resources:
+ - shardingsphereproxyserverconfigs/status
+ verbs:
+ - get
+ - patch
+ - update
+ - apiGroups:
+ - autoscaling
+ resources:
+ - horizontalpodautoscalers
+ verbs:
+ - create
+ - delete
+ - get
+ - list
+ - patch
+ - update
+ - watch
+ - apiGroups:
+ - authentication.k8s.io
+ resources:
+ - tokenreviews
+ verbs:
+ - create
+ - apiGroups:
+ - authorization.k8s.io
+ resources:
+ - subjectaccessreviews
+ verbs:
+ - create
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: RoleBinding
+metadata:
+ name: {{ template "operator.name" . }}
+ namespace: {{ .Release.Namespace }}
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: {{ template "operator.name" . }}
+subjects:
+ - kind: ServiceAccount
+ name: {{ template "operator.name" . }}
+ namespace: {{ .Release.Namespace }}
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ name: {{ template "operator.name" . }}
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: {{ template "operator.name" . }}
+subjects:
+ - kind: ServiceAccount
+ name: {{ template "operator.name" . }}
+ namespace: {{ .Release.Namespace }}
diff --git a/charts/apache-shardingsphere-operator-cluster-charts/templates/shardingsphere_v1alpha1_shardingsphereproxy.yaml b/charts/apache-shardingsphere-cluster-operator-charts/templates/shardingsphere_v1alpha1_shardingsphereproxy.yaml
similarity index 60%
rename from charts/apache-shardingsphere-operator-cluster-charts/templates/shardingsphere_v1alpha1_shardingsphereproxy.yaml
rename to charts/apache-shardingsphere-cluster-operator-charts/templates/shardingsphere_v1alpha1_shardingsphereproxy.yaml
index ba8794f..1ebb10e 100644
--- a/charts/apache-shardingsphere-operator-cluster-charts/templates/shardingsphere_v1alpha1_shardingsphereproxy.yaml
+++ b/charts/apache-shardingsphere-cluster-operator-charts/templates/shardingsphere_v1alpha1_shardingsphereproxy.yaml
@@ -15,26 +15,29 @@
# limitations under the License.
#
+{{- if .Values.proxyCluster.enabled }}
apiVersion: shardingsphere.apache.org/v1alpha1
kind: ShardingSphereProxy
metadata:
name: {{ template "common.names.fullname" . }}
+ namespace: {{ .Release.Namespace }}
spec:
- version: {{ .Values.proxyVersion | default .Chart.AppVersion }}
+ version: {{ .Values.proxyCluster.proxyVersion | default .Chart.AppVersion }}
serviceType:
- type: {{ .Values.service.type }}
- {{- if .Values.replicaCount }}
- replicas: {{ .Values.replicaCount }}
+ type: {{ .Values.proxyCluster.service.type }}
+ {{- if .Values.proxyCluster.replicaCount }}
+ replicas: {{ .Values.proxyCluster.replicaCount }}
{{- end}}
- {{- if .Values.automaticScaling.enable }}
- automaticScaling: {{- toYaml .Values.automaticScaling | nindent 4}}
+ {{- if .Values.proxyCluster.automaticScaling.enable }}
+ automaticScaling: {{- toYaml .Values.proxyCluster.automaticScaling | nindent 4}}
{{- end }}
proxyConfigName: {{ printf "%s-configuration" (include "common.names.fullname" .) | quote}}
- port: {{ .Values.startPort }}
- {{- if .Values.mySQLDriver.version }}
+ port: {{ .Values.proxyCluster.startPort }}
+ {{- if .Values.proxyCluster.mySQLDriver.version }}
mySQLDriver:
- version: {{ .Values.mySQLDriver.version| quote}}
+ version: {{ .Values.proxyCluster.mySQLDriver.version| quote}}
{{- end }}
- {{- if .Values.resources }}
- resources: {{- toYaml .Values.resources | nindent 4 }}
+ {{- if .Values.proxyCluster.resources }}
+ resources: {{- toYaml .Values.proxyCluster.resources | nindent 4 }}
{{- end }}
+{{- end }}
diff --git a/charts/apache-shardingsphere-operator-cluster-charts/templates/shardingsphere_v1alpha1_shardingsphereproxyserverconfig.yaml b/charts/apache-shardingsphere-cluster-operator-charts/templates/shardingsphere_v1alpha1_shardingsphereproxyserverconfig.yaml
similarity index 82%
rename from charts/apache-shardingsphere-operator-cluster-charts/templates/shardingsphere_v1alpha1_shardingsphereproxyserverconfig.yaml
rename to charts/apache-shardingsphere-cluster-operator-charts/templates/shardingsphere_v1alpha1_shardingsphereproxyserverconfig.yaml
index cdaaadb..39b2c81 100644
--- a/charts/apache-shardingsphere-operator-cluster-charts/templates/shardingsphere_v1alpha1_shardingsphereproxyserverconfig.yaml
+++ b/charts/apache-shardingsphere-cluster-operator-charts/templates/shardingsphere_v1alpha1_shardingsphereproxyserverconfig.yaml
@@ -15,9 +15,12 @@
# limitations under the License.
#
+{{- if .Values.proxyCluster.enabled }}
apiVersion: shardingsphere.apache.org/v1alpha1
kind: ShardingSphereProxyServerConfig
metadata:
name: {{ printf "%s-configuration" (include "common.names.fullname" .) }}
+ namespace: {{ .Release.Namespace }}
spec:
- {{- include "common.tplvalues.render" (dict "value" .Values.serverConfig "context" $) | nindent 2 }}
\ No newline at end of file
+ {{- include "common.tplvalues.render" (dict "value" .Values.proxyCluster.serverConfig "context" $) | nindent 2 }}
+{{- end }}
diff --git a/charts/apache-shardingsphere-cluster-operator-charts/values.yaml b/charts/apache-shardingsphere-cluster-operator-charts/values.yaml
new file mode 100644
index 0000000..1daa65d
--- /dev/null
+++ b/charts/apache-shardingsphere-cluster-operator-charts/values.yaml
@@ -0,0 +1,179 @@
+#
+# 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.
+#
+
+## @section Name parameters
+## @param nameOverride String to partially override common.names.fullname template (will maintain the release name)
+##
+nameOverride: apache-shardingsphere-proxy-cluster
+
+## @section ShardingSphere operator parameters
+operator:
+## @param replicaCount operator replica count
+##
+ replicaCount: 2
+ image:
+ ## @param image.repository operator image name
+ ##
+ repository: "ghcr.io/apache/shardingsphere-on-cloud/apache-shardingsphere-operator"
+ ## @param image.pullPolicy image pull policy
+ ##
+ pullPolicy: IfNotPresent
+ ## @param image.tag image tag
+ ##
+ tag: ""
+ ## @param imagePullSecrets image pull secret of private repository
+ ## e.g:
+ ## imagePullSecrets:
+ ## - name: mysecret
+ ##
+ imagePullSecrets: {}
+ ## @param resources operator Resources required by the operator
+ ## e.g:
+ ## resources:
+ ## limits:
+ ## cpu: 2
+ ## limits:
+ ## cpu: 2
+ ##
+ resources: {}
+ ## @param health.healthProbePort operator health check port
+ ##
+ health:
+ healthProbePort: 8081
+
+
+## @section ShardingSphere-Proxy cluster parameters
+proxyCluster:
+ enabled: true
+ ## @param replicaCount ShardingSphere-Proxy cluster starts the number of replicas, Note: After you enable automaticScaling, this parameter will no longer take effect
+ ## @param proxyVersion ShardingSphere-Proxy cluster version
+ ##
+ replicaCount: "3"
+ proxyVersion: "5.3.0"
+ ## @param automaticScaling.enable ShardingSphere-Proxy Whether the ShardingSphere-Proxy cluster has auto-scaling enabled
+ ## @param automaticScaling.scaleUpWindows ShardingSphere-Proxy automatically scales the stable window
+ ## @param automaticScaling.scaleDownWindows ShardingSphere-Proxy automatically shrinks the stabilized window
+ ## @param automaticScaling.target ShardingSphere-Proxy auto-scaling threshold, the value is a percentage, note: at this stage, only cpu is supported as a metric for scaling
+ ## @param automaticScaling.maxInstance ShardingSphere-Proxy maximum number of scaled-out replicas
+ ## @param automaticScaling.minInstance ShardingSphere-Proxy has a minimum number of boot replicas, and the shrinkage will not be less than this number of replicas
+ ##
+ automaticScaling:
+ enable: false
+ scaleUpWindows: 30
+ scaleDownWindows: 30
+ target: 20
+ maxInstance: 4
+ minInstance: 1
+ ## @param resources ShardingSphere-Proxy starts the requirement resource, and after opening automaticScaling, the resource of the request multiplied by the percentage of target is used to trigger the scaling action
+ ## e.g:
+ ## resources:
+ ## limits:
+ ## cpu: 2
+ ## memory: 2Gi
+ ## requests:
+ ## cpu: 2
+ ## memory: 2Gi
+ ##
+ resources: {}
+ ## @param service.type ShardingSphere-Proxy external exposure mode
+ ## @param service.port ShardingSphere-Proxy exposes port
+ ##
+ service:
+ type: ClusterIP
+ port: 3307
+ ## @param startPort ShardingSphere-Proxy boot port
+ ##
+ startPort: 3307
+ ## @param mySQLDriver.version ShardingSphere-Proxy The ShardingSphere-Proxy mysql driver version will not be downloaded if it is empty
+ ##
+ mySQLDriver:
+ version: "5.1.47"
+ ## @param imagePullSecrets ShardingSphere-Proxy pull private image repository key
+ ## e.g:
+ ## imagePullSecrets:
+ ## - name: mysecret
+ ##
+ imagePullSecrets: []
+ ## @section ShardingSphere-Proxy ServerConfiguration parameters
+ ## NOTE: If you use the sub-charts to deploy Zookeeper, the server-lists field must be "{{ printf \"%s-zookeeper.%s:2181\" .Release.Name .Release.Namespace }}",
+ ## otherwise please fill in the correct zookeeper address
+ ## The server.yaml is auto-generated based on this parameter.
+ ## If it is empty, the server.yaml is also empty.
+ ## ref: https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/yaml-config/mode/
+ ## ref: https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository/
+ ##
+ serverConfig:
+ ## @section Compute-Node ShardingSphere-Proxy ServerConfiguration authority parameters
+ ## NOTE: It is used to set up initial user to login compute node, and authority data of storage node.
+ ## @param serverConfig.authority.privilege.type authority provider for storage node, the default value is ALL_PERMITTED
+ ## @param serverConfig.authority.users[0].password Password for compute node.
+ ## @param serverConfig.authority.users[0].user Username,authorized host for compute node. Format: <username>@<hostname> hostname is % or empty string means do not care about authorized host
+ ##
+ authority:
+ privilege:
+ type: ALL_PERMITTED
+ users:
+ - password: root
+ user: root@%
+ ## @section Compute-Node ShardingSphere-Proxy ServerConfiguration mode Configuration parameters
+ ## @param serverConfig.mode.type Type of mode configuration. Now only support Cluster mode
+ ## @param serverConfig.mode.repository.props.namespace Namespace of registry center
+ ## @param serverConfig.mode.repository.props.server-lists Server lists of registry center
+ ## @param serverConfig.mode.repository.props.maxRetries Max retries of client connection
+ ## @param serverConfig.mode.repository.props.operationTimeoutMilliseconds Milliseconds of operation timeout
+ ## @param serverConfig.mode.repository.props.retryIntervalMilliseconds Milliseconds of retry interval
+ ## @param serverConfig.mode.repository.props.timeToLiveSeconds Seconds of ephemeral data live
+ ## @param serverConfig.mode.repository.type Type of persist repository. Now only support ZooKeeper
+ ## @param serverConfig.props.proxy-frontend-database-protocol-type Default startup protocol
+ mode:
+ repository:
+ props:
+ maxRetries: 3
+ namespace: governance_ds
+ operationTimeoutMilliseconds: 5000
+ retryIntervalMilliseconds: 500
+ server-lists: "{{ printf \"%s-zookeeper.%s:2181\" .Release.Name .Release.Namespace }}"
+ timeToLiveSeconds: 600
+ type: ZooKeeper
+ type: Cluster
+ props:
+ proxy-frontend-database-protocol-type: MySQL
+ ## @section ZooKeeper chart parameters
+
+## ZooKeeper chart configuration
+## https://github.com/bitnami/charts/blob/master/bitnami/zookeeper/values.yaml
+##
+zookeeper:
+ ## @param zookeeper.enabled Switch to enable or disable the ZooKeeper helm chart
+ ##
+ enabled: true
+ ## @param zookeeper.replicaCount Number of ZooKeeper nodes
+ ##
+ replicaCount: 2
+ ## ZooKeeper Persistence parameters
+ ## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
+ ## @param zookeeper.persistence.enabled Enable persistence on ZooKeeper using PVC(s)
+ ## @param zookeeper.persistence.storageClass Persistent Volume storage class
+ ## @param zookeeper.persistence.accessModes Persistent Volume access modes
+ ## @param zookeeper.persistence.size Persistent Volume size
+ ##
+ persistence:
+ enabled: false
+ storageClass: ""
+ accessModes:
+ - ReadWriteOnce
+ size: 8Gi
diff --git a/charts/apache-shardingsphere-operator-cluster-charts/values.yaml b/charts/apache-shardingsphere-operator-cluster-charts/values.yaml
deleted file mode 100644
index 150f9b0..0000000
--- a/charts/apache-shardingsphere-operator-cluster-charts/values.yaml
+++ /dev/null
@@ -1,138 +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.
-#
-
-## @section Name parameters
-## @param nameOverride String to partially override common.names.fullname template (will maintain the release name)
-##
-nameOverride: apache-shardingsphere-operator-cluster
-## @section ShardingSphere-Proxy cluster parameters
-## @param replicaCount ShardingSphere-Proxy cluster starts the number of replicas, Note: After you enable automaticScaling, this parameter will no longer take effect
-## @param proxyVersion ShardingSphere-Proxy cluster version
-##
-replicaCount: "3"
-proxyVersion: "5.3.0"
-## @param automaticScaling.enable ShardingSphere-Proxy Whether the ShardingSphere-Proxy cluster has auto-scaling enabled
-## @param automaticScaling.scaleUpWindows ShardingSphere-Proxy automatically scales the stable window
-## @param automaticScaling.scaleDownWindows ShardingSphere-Proxy automatically shrinks the stabilized window
-## @param automaticScaling.target ShardingSphere-Proxy auto-scaling threshold, the value is a percentage, note: at this stage, only cpu is supported as a metric for scaling
-## @param automaticScaling.maxInstance ShardingSphere-Proxy maximum number of scaled-out replicas
-## @param automaticScaling.minInstance ShardingSphere-Proxy has a minimum number of boot replicas, and the shrinkage will not be less than this number of replicas
-##
-automaticScaling:
- enable: false
- scaleUpWindows: 30
- scaleDownWindows: 30
- target: 20
- maxInstance: 4
- minInstance: 1
-## @param resources ShardingSphere-Proxy starts the requirement resource, and after opening automaticScaling, the resource of the request multiplied by the percentage of target is used to trigger the scaling action
-## e.g:
-## resources:
-## limits:
-## cpu: 2
-## requests:
-## cpu: 2
-##
-resources: {}
-## @param service.type ShardingSphere-Proxy external exposure mode
-## @param service.port ShardingSphere-Proxy exposes port
-##
-service:
- type: ClusterIP
- port: 3307
-## @param startPort ShardingSphere-Proxy boot port
-##
-startPort: 3307
-## @param mySQLDriver.version ShardingSphere-Proxy The ShardingSphere-Proxy mysql driver version will not be downloaded if it is empty
-##
-mySQLDriver:
- version: "5.1.47"
-## @param imagePullSecrets ShardingSphere-Proxy pull private image repository key
-## e.g:
-## imagePullSecrets:
-## - name: mysecret
-##
-imagePullSecrets: []
-## @section ShardingSphere-Proxy ServerConfiguration parameters
-## NOTE: If you use the sub-charts to deploy Zookeeper, the server-lists field must be "{{ printf \"%s-zookeeper.%s:2181\" .Release.Name .Release.Namespace }}",
-## otherwise please fill in the correct zookeeper address
-## The server.yaml is auto-generated based on this parameter.
-## If it is empty, the server.yaml is also empty.
-## ref: https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/yaml-config/mode/
-## ref: https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/builtin-algorithm/metadata-repository/
-##
-serverConfig:
- ## @section Compute-Node ShardingSphere-Proxy ServerConfiguration authority parameters
- ## NOTE: It is used to set up initial user to login compute node, and authority data of storage node.
- ## @param serverConfig.authority.privilege.type authority provider for storage node, the default value is ALL_PERMITTED
- ## @param serverConfig.authority.users[0].password Password for compute node.
- ## @param serverConfig.authority.users[0].user Username,authorized host for compute node. Format: <username>@<hostname> hostname is % or empty string means do not care about authorized host
- ##
- authority:
- privilege:
- type: ALL_PERMITTED
- users:
- - password: root
- user: root@%
- ## @section Compute-Node ShardingSphere-Proxy ServerConfiguration mode Configuration parameters
- ## @param serverConfig.mode.type Type of mode configuration. Now only support Cluster mode
- ## @param serverConfig.mode.repository.props.namespace Namespace of registry center
- ## @param serverConfig.mode.repository.props.server-lists Server lists of registry center
- ## @param serverConfig.mode.repository.props.maxRetries Max retries of client connection
- ## @param serverConfig.mode.repository.props.operationTimeoutMilliseconds Milliseconds of operation timeout
- ## @param serverConfig.mode.repository.props.retryIntervalMilliseconds Milliseconds of retry interval
- ## @param serverConfig.mode.repository.props.timeToLiveSeconds Seconds of ephemeral data live
- ## @param serverConfig.mode.repository.type Type of persist repository. Now only support ZooKeeper
- ## @param serverConfig.props.proxy-frontend-database-protocol-type Default startup protocol
- mode:
- repository:
- props:
- maxRetries: 3
- namespace: governance_ds
- operationTimeoutMilliseconds: 5000
- retryIntervalMilliseconds: 500
- server-lists: "{{ printf \"%s-zookeeper.%s:2181\" .Release.Name .Release.Namespace }}"
- timeToLiveSeconds: 600
- type: ZooKeeper
- type: Cluster
- props:
- proxy-frontend-database-protocol-type: MySQL
-## @section ZooKeeper chart parameters
-
-## ZooKeeper chart configuration
-## https://github.com/bitnami/charts/blob/master/bitnami/zookeeper/values.yaml
-##
-zookeeper:
- ## @param zookeeper.enabled Switch to enable or disable the ZooKeeper helm chart
- ##
- enabled: true
- ## @param zookeeper.replicaCount Number of ZooKeeper nodes
- ##
- replicaCount: 1
- ## ZooKeeper Persistence parameters
- ## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
- ## @param zookeeper.persistence.enabled Enable persistence on ZooKeeper using PVC(s)
- ## @param zookeeper.persistence.storageClass Persistent Volume storage class
- ## @param zookeeper.persistence.accessModes Persistent Volume access modes
- ## @param zookeeper.persistence.size Persistent Volume size
- ##
- persistence:
- enabled: false
- storageClass: ""
- accessModes:
- - ReadWriteOnce
- size: 8Gi
diff --git a/shardingsphere-operator/api/v1alpha1/proxy_types.go b/shardingsphere-operator/api/v1alpha1/proxy_types.go
index 920e308..bec7397 100644
--- a/shardingsphere-operator/api/v1alpha1/proxy_types.go
+++ b/shardingsphere-operator/api/v1alpha1/proxy_types.go
@@ -97,7 +97,7 @@ type ProxySpec struct {
// +optional
MySQLDriver *MySQLDriver `json:"mySQLDriver,omitempty"`
// +optional
- Resources *v1.ResourceRequirements `json:"resources,omitempty"`
+ Resources v1.ResourceRequirements `json:"resources,omitempty"`
// Probes are not allowed for ephemeral containers.
// +optional
LivenessProbe *v1.Probe `json:"livenessProbe,omitempty"`
diff --git a/shardingsphere-operator/api/v1alpha1/proxy_webhook.go b/shardingsphere-operator/api/v1alpha1/proxy_webhook.go
deleted file mode 100644
index b3a324d..0000000
--- a/shardingsphere-operator/api/v1alpha1/proxy_webhook.go
+++ /dev/null
@@ -1,162 +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.
- */
-
-package v1alpha1
-
-import (
- shardingwebhook "github.com/apache/shardingsphere-on-cloud/shardingsphere-operator/pkg/webhook"
-
- "github.com/pkg/errors"
- v1 "k8s.io/api/core/v1"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/api/resource"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/intstr"
- "k8s.io/apimachinery/pkg/util/validation/field"
- ctrl "sigs.k8s.io/controller-runtime"
- logf "sigs.k8s.io/controller-runtime/pkg/log"
- "sigs.k8s.io/controller-runtime/pkg/webhook"
-)
-
-var shardingsphereproxylog = logf.Log.WithName("shardingsphereproxy-resource")
-
-func (r *ShardingSphereProxy) SetupWebhookWithManager(mgr ctrl.Manager) error {
- return shardingwebhook.NewWebhookManagedBy(mgr).
- For(r).
- Complete()
-}
-
-//+kubebuilder:webhook:path=/apis/admission.shardingsphere.apache.org/v1alpha1/mutate-shardingsphere-sphere-ex-com-v1alpha1-proxy,mutating=true,failurePolicy=fail,sideEffects=None,groups=shardingsphere.apache.org,resources=shardingsphereproxies,verbs=create;update,versions=v1alpha1,name=mproxy.kb.io,admissionReviewVersions=v1
-
-var _ webhook.Defaulter = &ShardingSphereProxy{}
-
-// Default implements webhook.Defaulter so a webhook will be registered for the type
-func (r *ShardingSphereProxy) Default() {
- shardingsphereproxylog.Info("default", "name", r.Name)
- if r.Spec.StartupProbe == nil {
- r.Spec.StartupProbe = &v1.Probe{
- ProbeHandler: v1.ProbeHandler{
- TCPSocket: &v1.TCPSocketAction{
- Port: intstr.FromInt(int(r.Spec.Port)),
- },
- },
- PeriodSeconds: 5,
- FailureThreshold: 2,
- }
- }
- if r.Spec.ReadinessProbe == nil {
- r.Spec.ReadinessProbe = &v1.Probe{
- ProbeHandler: v1.ProbeHandler{
- TCPSocket: &v1.TCPSocketAction{
- Port: intstr.FromInt(int(r.Spec.Port)),
- },
- },
- PeriodSeconds: 10,
- }
- }
- if r.Spec.LivenessProbe == nil {
- r.Spec.LivenessProbe = &v1.Probe{
- ProbeHandler: v1.ProbeHandler{
- TCPSocket: &v1.TCPSocketAction{
- Port: intstr.FromInt(int(r.Spec.Port)),
- },
- },
-
- PeriodSeconds: 10,
- }
- }
- if r.Spec.Resources == nil {
- // The application for resources is based on the upper limit of cpu: 4core memory: 2Gi to apply for computing resources.
- // The cpu is applied according to 10%, and the memory is applied according to 80%
- cpuLimits, _ := resource.ParseQuantity("4")
- memoryLimits, _ := resource.ParseQuantity("2Gi")
- cpuRequest, _ := resource.ParseQuantity("400m")
- memoryRequest, _ := resource.ParseQuantity("1600Mbi")
- r.Spec.Resources = &v1.ResourceRequirements{
- Limits: v1.ResourceList{
- "cpu": cpuLimits,
- "memory": memoryLimits,
- },
- Requests: v1.ResourceList{
- "cpu": cpuRequest,
- "memory": memoryRequest,
- },
- }
- }
-}
-
-// +kubebuilder:webhook:path=/apis/admission.shardingsphere.apache.org/v1alpha1/validate-shardingsphere-sphere-ex-com-v1alpha1-proxy,mutating=false,failurePolicy=fail,sideEffects=None,groups=shardingsphere.apache.org,resources=proxies,verbs=create;update,versions=v1alpha1,name=vproxy.kb.io,admissionReviewVersions=v1
-
-var _ webhook.Validator = &ShardingSphereProxy{}
-
-// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
-func (r *ShardingSphereProxy) ValidateCreate() error {
- shardingsphereproxylog.Info("validate create", "name", r.Name)
- err := r.validateService()
- if err != nil {
- return err
- }
- err = r.validateInstance()
- if err != nil {
- return err
- }
- return nil
-}
-
-// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
-func (r *ShardingSphereProxy) ValidateUpdate(old runtime.Object) error {
- shardingsphereproxylog.Info("validate update", "name", r.Name)
- err := r.validateService()
- if err != nil {
- return err
- }
- err = r.validateInstance()
- if err != nil {
- return err
- }
- return nil
-}
-
-// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
-func (r *ShardingSphereProxy) ValidateDelete() error {
- return nil
-}
-func (r *ShardingSphereProxy) validateService() error {
- var allErrs field.ErrorList
- field.NewPath("spec").Child("serviceType")
- if r.Spec.ServiceType.NodePort != 0 && r.Spec.ServiceType.Type != v1.ServiceTypeNodePort {
- allErrs = append(allErrs, field.Invalid(field.NewPath("spec").Child("serviceType"), r.Spec.ServiceType, errors.New("nodePort: Forbidden: may not be used when `type` is 'ClusterIP'").Error()))
- return apierrors.NewInvalid(schema.GroupKind{
- Group: "shardingsphere.apache.org",
- Kind: "ShardingSphereProxy",
- }, r.Name, allErrs)
- }
- return nil
-}
-
-func (r *ShardingSphereProxy) validateInstance() error {
- var allErrs field.ErrorList
- if r.Spec.AutomaticScaling != nil && r.Spec.AutomaticScaling.MaxInstance < 1 {
- allErrs = append(allErrs, field.Invalid(field.NewPath("spec").Child("MaxInstance"), r.Spec.ServiceType, errors.New("If automatic scaling is enabled, the number of instances must be filled in.").Error()))
- return apierrors.NewInvalid(schema.GroupKind{
- Group: "shardingsphere.apache.org",
- Kind: "ShardingSphereProxy",
- }, r.Name, allErrs)
- }
- return nil
-}
diff --git a/shardingsphere-operator/api/v1alpha1/zz_generated.deepcopy.go b/shardingsphere-operator/api/v1alpha1/zz_generated.deepcopy.go
index 06c0e31..0b649d4 100644
--- a/shardingsphere-operator/api/v1alpha1/zz_generated.deepcopy.go
+++ b/shardingsphere-operator/api/v1alpha1/zz_generated.deepcopy.go
@@ -24,7 +24,7 @@ package v1alpha1
import (
"k8s.io/api/autoscaling/v2beta2"
"k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/runtime"
+ runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@@ -243,11 +243,7 @@ func (in *ProxySpec) DeepCopyInto(out *ProxySpec) {
*out = new(MySQLDriver)
**out = **in
}
- if in.Resources != nil {
- in, out := &in.Resources, &out.Resources
- *out = new(v1.ResourceRequirements)
- (*in).DeepCopyInto(*out)
- }
+ in.Resources.DeepCopyInto(&out.Resources)
if in.LivenessProbe != nil {
in, out := &in.LivenessProbe, &out.LivenessProbe
*out = new(v1.Probe)
diff --git a/shardingsphere-operator/main.go b/shardingsphere-operator/main.go
index ced8ad8..e0069ff 100644
--- a/shardingsphere-operator/main.go
+++ b/shardingsphere-operator/main.go
@@ -55,13 +55,12 @@ func main() {
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
- var webhookPort int
+
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
- flag.IntVar(&webhookPort, "webhook-port", 9443, "The port the webhook binds to")
opts := zap.Options{
Development: true,
TimeEncoder: zapcore.RFC3339TimeEncoder,
@@ -74,11 +73,9 @@ func main() {
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
- Port: webhookPort,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "0e5175ce.apache.org",
- CertDir: "/etc/operator/certs",
})
if err != nil {
setupLog.Error(err, "unable to start manager")
@@ -99,10 +96,6 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "ShardingSphereProxyServerConfig")
os.Exit(1)
}
- if err = (&v1alpha1.ShardingSphereProxy{}).SetupWebhookWithManager(mgr); err != nil {
- setupLog.Error(err, "unable to create webhook", "webhook", "ShardingSphereProxy")
- os.Exit(1)
- }
//+kubebuilder:scaffold:builder
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
diff --git a/shardingsphere-operator/pkg/reconcile/deployment.go b/shardingsphere-operator/pkg/reconcile/deployment.go
index d40c7a2..fb1bb0f 100644
--- a/shardingsphere-operator/pkg/reconcile/deployment.go
+++ b/shardingsphere-operator/pkg/reconcile/deployment.go
@@ -105,9 +105,9 @@ func ConstructCascadingDeployment(proxy *v1alpha1.ShardingSphereProxy) *v1.Deplo
if proxy.Spec.AutomaticScaling == nil {
dp.Spec.Replicas = &proxy.Spec.Replicas
}
- if proxy.Spec.Resources != nil {
- dp.Spec.Template.Spec.Containers[0].Resources = *proxy.Spec.Resources
- }
+
+ dp.Spec.Template.Spec.Containers[0].Resources = proxy.Spec.Resources
+
if proxy.Spec.LivenessProbe != nil {
dp.Spec.Template.Spec.Containers[0].LivenessProbe = proxy.Spec.LivenessProbe
}
@@ -178,7 +178,8 @@ func UpdateDeployment(proxy *v1alpha1.ShardingSphereProxy, act *v1.Deployment) *
act.Spec.Template.Spec.Containers[0].Image = fmt.Sprintf("%s:%s", imageName, proxy.Spec.Version)
act.Spec.Template.Spec.Containers[0].Env[0].Value = strconv.FormatInt(int64(proxy.Spec.Port), 10)
act.Spec.Template.Spec.Containers[0].Ports[0].ContainerPort = proxy.Spec.Port
- act.Spec.Template.Spec.Containers[0].Resources = *proxy.Spec.Resources
+
+ act.Spec.Template.Spec.Containers[0].Resources = proxy.Spec.Resources
act.Spec.Template.Spec.Containers[0].LivenessProbe = proxy.Spec.LivenessProbe
act.Spec.Template.Spec.Containers[0].ReadinessProbe = proxy.Spec.ReadinessProbe
act.Spec.Template.Spec.Containers[0].StartupProbe = proxy.Spec.StartupProbe
diff --git a/shardingsphere-operator/pkg/reconcile/reconcile_test.go b/shardingsphere-operator/pkg/reconcile/reconcile_test.go
index aed6768..9a12ef4 100644
--- a/shardingsphere-operator/pkg/reconcile/reconcile_test.go
+++ b/shardingsphere-operator/pkg/reconcile/reconcile_test.go
@@ -306,7 +306,7 @@ func Test_ConstructCascadingDeployment(t *testing.T) {
ProxyConfigName: "shardingsphere-proxy-config",
Port: 3307,
MySQLDriver: &v1alpha1.MySQLDriver{},
- Resources: &v1.ResourceRequirements{},
+ Resources: v1.ResourceRequirements{},
LivenessProbe: &v1.Probe{
ProbeHandler: v1.ProbeHandler{
TCPSocket: &v1.TCPSocketAction{},
@@ -443,9 +443,11 @@ func Test_ConstructCascadingDeployment(t *testing.T) {
if c.proxy.Spec.AutomaticScaling != nil {
assert.Equal(t, c.exp.Spec.Replicas, act.Spec.Replicas, c.message)
}
- if c.proxy.Spec.Resources != nil {
+
+ if len(c.exp.Spec.Template.Spec.Containers) > 0 {
assert.EqualValues(t, c.exp.Spec.Template.Spec.Containers[0].Resources, act.Spec.Template.Spec.Containers[0].Resources, c.message)
}
+
if c.proxy.Spec.LivenessProbe != nil {
assert.EqualValues(t, c.exp.Spec.Template.Spec.Containers[0].LivenessProbe, act.Spec.Template.Spec.Containers[0].LivenessProbe, c.message)
}
@@ -726,7 +728,7 @@ func Test_UpdateDeployment(t *testing.T) {
ProxyConfigName: "shardingsphere-proxy-config",
Port: 3307,
MySQLDriver: &v1alpha1.MySQLDriver{},
- Resources: &v1.ResourceRequirements{},
+ Resources: v1.ResourceRequirements{},
LivenessProbe: &v1.Probe{
ProbeHandler: v1.ProbeHandler{
TCPSocket: &v1.TCPSocketAction{},
@@ -863,7 +865,7 @@ func Test_UpdateDeployment(t *testing.T) {
assert.Equal(t, c.proxy.Spec.Replicas, *c.deploy.Spec.Replicas, c.message)
assert.Equal(t, c.proxy.Spec.ProxyConfigName, c.deploy.Spec.Template.Spec.Volumes[0].ConfigMap.Name, c.message)
assert.Equal(t, c.proxy.Spec.Port, c.deploy.Spec.Template.Spec.Containers[0].Ports[0].ContainerPort, c.message)
- assert.EqualValues(t, *c.proxy.Spec.Resources, c.deploy.Spec.Template.Spec.Containers[0].Resources, c.message)
+ assert.EqualValues(t, c.proxy.Spec.Resources, c.deploy.Spec.Template.Spec.Containers[0].Resources, c.message)
assert.EqualValues(t, c.proxy.Spec.LivenessProbe, c.deploy.Spec.Template.Spec.Containers[0].LivenessProbe, c.message)
assert.EqualValues(t, c.proxy.Spec.ReadinessProbe, c.deploy.Spec.Template.Spec.Containers[0].ReadinessProbe, c.message)
assert.EqualValues(t, c.proxy.Spec.StartupProbe, c.deploy.Spec.Template.Spec.Containers[0].StartupProbe, c.message)