Skip to content

Commit

Permalink
feat: add superset api definition
Browse files Browse the repository at this point in the history
  • Loading branch information
whg517 committed May 14, 2024
1 parent 629841d commit 14eb047
Show file tree
Hide file tree
Showing 15 changed files with 5,401 additions and 28 deletions.
7 changes: 7 additions & 0 deletions api/v1alpha1/clusterconfig_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package v1alpha1

type ClusterConfigSpec struct {

// +kubebuilder:validation:Optional
ListenerClass string `json:"listenerClass,omitempty"`
}
8 changes: 8 additions & 0 deletions api/v1alpha1/image_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package v1alpha1

type ImageSpec struct {
Custom string `json:"custom,omitempty"`
Repo string `json:"repo,omitempty"`
KdsVersion string `json:"kdsVersion,omitempty"`
ProductVersion string `json:"productVersion,omitempty"`
}
36 changes: 36 additions & 0 deletions api/v1alpha1/node_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package v1alpha1

import (
apiv1alpha1 "github.com/zncdata-labs/superset-operator/pkg/apis/v1alpha1"
corev1 "k8s.io/api/core/v1"
)

type NodeSpec struct {
RoleGroups map[string]NodeRoleGroupSpec `json:"roleGroups,omitempty"`
Config *NodeConfigSpec `json:"config,omitempty"`
PodDisruptionBudget *apiv1alpha1.PodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
CommandOverrides []string `json:"commandOverrides,omitempty"`
EnvOverrides []string `json:"envOverrides,omitempty"`
ConfigOverrides *NodeConfigOverridesSpec `json:"configOverrides,omitempty"`
}

type NodeConfigSpec struct {
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
PodDisruptionBudget *apiv1alpha1.PodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
GracefulShutdownTimeout *string `json:"gracefulShutdownTimeoutSeconds,omitempty"`
Logging *apiv1alpha1.LoggingConfigSpec `json:"logging,omitempty"`
Resources *apiv1alpha1.ResourcesSpec `json:"resources,omitempty"`
}

type NodeRoleGroupSpec struct {
Replicas *int32 `json:"replicas,omitempty"`
Config *NodeConfigSpec `json:"config,omitempty"`
PodDisruptionBudget *apiv1alpha1.PodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
CommandOverrides []string `json:"commandOverrides,omitempty"`
EnvOverrides []string `json:"envOverrides,omitempty"`
ConfigOverrides *NodeConfigOverridesSpec `json:"configOverrides,omitempty"`
}

type NodeConfigOverridesSpec struct {
}
17 changes: 7 additions & 10 deletions api/v1alpha1/supersetcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,22 @@ limitations under the License.
package v1alpha1

import (
apiv1alpha1 "github.com/zncdata-labs/superset-operator/pkg/apis/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// SupersetClusterSpec defines the desired state of SupersetCluster
type SupersetClusterSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of SupersetCluster. Edit supersetcluster_types.go to remove/update
Foo string `json:"foo,omitempty"`
Image *ImageSpec `json:"image,omitempty"`
ClusterConfig *ClusterConfigSpec `json:"clusterConfig"`
ClusterOperation *apiv1alpha1.ClusterOperationSpec `json:"clusterOperation"`
Node *NodeSpec `json:"node"`
Worker *WorkerSpec `json:"worker"`
}

// SupersetClusterStatus defines the observed state of SupersetCluster
type SupersetClusterStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
36 changes: 36 additions & 0 deletions api/v1alpha1/worker_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package v1alpha1

import (
apiv1alpha1 "github.com/zncdata-labs/superset-operator/pkg/apis/v1alpha1"
corev1 "k8s.io/api/core/v1"
)

type WorkerSpec struct {
RoleGroups map[string]WorkerRoleGroupSpec `json:"roleGroups,omitempty"`
Config *WorkerConfigSpec `json:"config,omitempty"`
PodDisruptionBudget *apiv1alpha1.PodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
CommandOverrides []string `json:"commandOverrides,omitempty"`
EnvOverrides []string `json:"envOverrides,omitempty"`
ConfigOverrides *WorkerConfigOverridesSpec `json:"configOverrides,omitempty"`
}

type WorkerConfigSpec struct {
Affinity *corev1.Affinity `json:"affinity,omitempty"`
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
PodDisruptionBudget *apiv1alpha1.PodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
GracefulShutdownTimeout *string `json:"gracefulShutdownTimeoutSeconds,omitempty"`
Logging *apiv1alpha1.LoggingConfigSpec `json:"logging,omitempty"`
Resources *apiv1alpha1.ResourcesSpec `json:"resources,omitempty"`
}

type WorkerRoleGroupSpec struct {
Replicas *int32 `json:"replicas,omitempty"`
Config *WorkerConfigSpec `json:"config,omitempty"`
PodDisruptionBudget *apiv1alpha1.PodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
CommandOverrides []string `json:"commandOverrides,omitempty"`
EnvOverrides []string `json:"envOverrides,omitempty"`
ConfigOverrides *WorkerConfigOverridesSpec `json:"configOverrides,omitempty"`
}

type WorkerConfigOverridesSpec struct {
}
Loading

0 comments on commit 14eb047

Please sign in to comment.