You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/12/30 06:18:49 UTC

[GitHub] [shardingsphere-on-cloud] mlycore commented on issue #166: [Refactor] Merge CRDs ShardingSphereProxy and ShardingSphereProxyServerConfig into ComputeNode

mlycore commented on issue #166:
URL: https://github.com/apache/shardingsphere-on-cloud/issues/166#issuecomment-1367747836

   ```golang
   
   // ComputeNodeList contains a list of ShardingSphereProxy
   type ComputeNodeList struct {
           metav1.TypeMeta `json:",inline"`
           metav1.ListMeta `json:"metadata,omitempty"`
           Items           []ComputeNode `json:"items"`
   }
   
   // ComputeNode is the Schema for the proxies API
   type ComputeNode struct {
           metav1.TypeMeta   `json:",inline"`
           metav1.ObjectMeta `json:"metadata,omitempty"`
   
           Spec   ComputeNodeSpec   `json:"spec,omitempty"`
           Status ComputeNodeStatus `json:"status,omitempty"`
   }
   
   type PrivilegeType string
   const (
         AllPermitted PrivilegeType = "ALL_PERMITTED"
   )
   
   type Privilege struct {
         Type PrivilegeType `json:"type"`
   }
   
   type User struct {
         User string `json:"user"`
         Password string `json:"password"`
   }
   
   type Authority struct {
         Privilege Privilege `json:"privilege"`
         Users []User `json:"users"`
   }
   
   type RepositoryType string
   const (
         RepositoryTypeZookeeper RepositoryType = "ZooKeeper"
         RepositoryTypeEtcd RepositoryType = "Etcd"
         RepositoryTypeMate RepositoryType = "Mate"
   )
   
   type Repository struct {
         Type RepositoryType `json:"type"`
         Properties map[string]string `json:"properties"`
   }
   
   type ModeType string
   const (
         ModeTypeCluster ModeType = "cluster"
         ModeTypeStandalone ModeType = "memory"
   )
   type ServerMode struct {
         Repository Repository `json:"repositoryType"`
         Type ModeType `json:"type"`
         Properties map[string]string `json:"properties"`
   }
   
   type ServerConfig struct {
          Authority Authority `json:"authority"`
          Mode ServerMode `json:"mode"`
   }
   
   type LogbackConfig struct {
         
   }
   
   // AutomaticScaling HPA configuration
   type AutomaticScaling struct {
           // +optional
           ScaleUpWindows int32 `json:"scaleUpWindows,omitempty"`
           // +optional
           ScaleDownWindows int32 `json:"scaleDownWindows,omitempty"`
           // +optional
           Target int32 `json:"target,omitempty"`
           // +optional
           MaxInstance int32 `json:"maxInstance,omitempty"`
           // +optional
           MinInstance int32 `json:"minInstance,omitempty"`
           // +optional
           CustomMetrics []autoscalingv2beta2.MetricSpec `json:"customMetrics,omitempty"`
   }
   
   
   // ServiceType defines the Service in Kubernetes of ShardingSphere-Proxy
   type Service struct {
           Ports []ServicePort `json:"ports,omitempty"`
   
           // +kubebuilder:validation:Enum=ClusterIP;NodePort;LoadBalancer;ExternalName
           Type v1.ServiceType `json:"type"`
   }
   
   type ProxyProbe struct {
           // Probes are not allowed for ephemeral containers.
           // +optional
           LivenessProbe *v1.Probe `json:"livenessProbe,omitempty"`
           // Probes are not allowed for ephemeral containers.
           // +optional
           ReadinessProbe *v1.Probe `json:"readinessProbe,omitempty" `
           // Probes are not allowed for ephemeral containers.
           // +optional
           StartupProbe *v1.Probe `json:"startupProbe,omitempty"`
   }
   
   
   type JDBCType string
   const (
       JDBCTypeMySQL JDBCType = "mysql"
       JDBCTypePostgreSQL JDBCType = "postgresql"
   )
   
   // MySQLDriver Defines the mysql-driven version in ShardingSphere-proxy
   type JDBC struct {
           Type: JDBCType `json:"type"`
           // +kubebuilder:validation:Pattern=`^([1-9]\d|[1-9])(\.([1-9]\d|\d)){2}$`
           // mysql-driven version,must be x.y.z
           Version string `json:"version"`
   }
   
   // ProxySpec defines the desired state of ShardingSphereProxy
   type ComputeNodeSpec struct {
           ServerConfig ServerConfig `json:"serverConfig,omitempty"`
           LogbackConfig LogbackConfig `json:"logbackConfig,omitempty"`
   
           // +optional
           AutomaticScaling *AutomaticScaling `json:"automaticScaling,omitempty"`
           //Replicas is the expected number of replicas of ShardingSphere-Proxy
           Replicas int32 `json:"replicas"`      
           
           
           Probes ProxyProbe `json:"probes"`
           
           Service     Service     `json:"serviceType"`   
           
           // +optional
           JDBC *JDBC `json:"jdbc,omitempty"`
   
           // Version  is the version of ShardingSphere-Proxy
           Version     string      `json:"version"`
           // +optional
           ImagePullSecrets []v1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
   
           //Port is ShardingSphere-Proxy startup port
           Ports []corev1.Port `json:"ports"`
           
           Env []corev1.EnvVar `json:"env"`
   
           // +optional
           Resources v1.ResourceRequirements `json:"resources,omitempty"`
   }
   
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org