From e7089f54b9f7c81f150e06e60e3437bc37184fa5 Mon Sep 17 00:00:00 2001
From: kalencaya <1942460489@qq.com>
Date: Tue, 14 Nov 2023 21:36:21 +0800
Subject: [PATCH] [Bug][docker] fix scaleph-seatunnel image error (#638)
* feature: add doris operator
* feature: add web-resource and role relation table
* feature: add web-resource and role relation mapper
* feature: add web-resource and role relation mapper
* fix: seatunnel base image
---
pom.xml | 5 +
scaleph-api/pom.xml | 6 +-
.../master/security/SecResourceWebRole.java | 42 ++++++
.../security/SecResourceWebRoleMapper.java | 53 +++++++
.../mapper/master/security/SecRoleMapper.java | 7 +-
.../security/SecResourceWebRoleMapper.xml | 78 ++++++++++
.../mapper/master/security/SecRoleMapper.xml | 3 +-
scaleph-engine/pom.xml | 1 +
scaleph-engine/scaleph-engine-doris/pom.xml | 43 ++++++
.../engine/doris/operator/DorisCluster.java | 36 +++++
.../engine/doris/operator/spec/AdminUser.java | 28 ++++
.../operator/spec/AutoScalerVersion.java | 23 +++
.../operator/spec/AutoScalingPolicy.java | 52 +++++++
.../engine/doris/operator/spec/BaseSpec.java | 133 ++++++++++++++++++
.../engine/doris/operator/spec/BeSpec.java | 29 ++++
.../doris/operator/spec/BrokerSpec.java | 33 +++++
.../engine/doris/operator/spec/CnSpec.java | 33 +++++
.../doris/operator/spec/ConfigMapInfo.java | 35 +++++
.../doris/operator/spec/DorisClusterSpec.java | 31 ++++
.../doris/operator/spec/DorisServicePort.java | 31 ++++
.../engine/doris/operator/spec/Endpoints.java | 40 ++++++
.../doris/operator/spec/ExportService.java | 37 +++++
.../engine/doris/operator/spec/FeAddress.java | 39 +++++
.../engine/doris/operator/spec/FeSpec.java | 25 ++++
.../engine/doris/operator/spec/HPAPolicy.java | 40 ++++++
.../doris/operator/spec/HPAScalingRules.java | 27 ++++
.../spec/HorizontalPodAutoscalerBehavior.java | 42 ++++++
.../doris/operator/spec/HorizontalScaler.java | 35 +++++
.../doris/operator/spec/MetricIdentifier.java | 42 ++++++
.../doris/operator/spec/MetricSourceType.java | 51 +++++++
.../doris/operator/spec/MetricSpec.java | 56 ++++++++
.../doris/operator/spec/MetricTarget.java | 54 +++++++
.../doris/operator/spec/MetricTargetType.java | 40 ++++++
.../operator/spec/ObjectMetricSource.java | 43 ++++++
.../doris/operator/spec/PersistentVolume.java | 44 ++++++
.../doris/operator/spec/PodsMetricSource.java | 38 +++++
.../operator/spec/ResourceMetricSource.java | 41 ++++++
.../operator/spec/ScalingPolicySelect.java | 40 ++++++
.../doris/operator/spec/ServiceRole.java | 24 ++++
.../operator/spec/SystemInitialization.java | 42 ++++++
.../doris/operator/status/CnStatus.java | 25 ++++
.../operator/status/DorisClusterStatus.java | 22 +++
.../generator/MybatisPlusGenerator.java | 2 +-
.../docker/build/scaleph-seatunnel/Dockerfile | 18 +--
.../build/scaleph-seatunnel/Dockerfile_backup | 55 ++++++++
.../build/scaleph-seatunnel/Dockerfile_single | 38 +++++
.../mysql/init.d/scaleph-security-mysql.sql | 15 ++
47 files changed, 1657 insertions(+), 20 deletions(-)
create mode 100644 scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/security/SecResourceWebRole.java
create mode 100644 scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/security/SecResourceWebRoleMapper.java
create mode 100644 scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecResourceWebRoleMapper.xml
create mode 100644 scaleph-engine/scaleph-engine-doris/pom.xml
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/DorisCluster.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AdminUser.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AutoScalerVersion.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AutoScalingPolicy.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BaseSpec.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BeSpec.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BrokerSpec.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/CnSpec.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ConfigMapInfo.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/DorisClusterSpec.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/DorisServicePort.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/Endpoints.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ExportService.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/FeAddress.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/FeSpec.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HPAPolicy.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HPAScalingRules.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HorizontalPodAutoscalerBehavior.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HorizontalScaler.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricIdentifier.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricSourceType.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricSpec.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricTarget.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricTargetType.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ObjectMetricSource.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/PersistentVolume.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/PodsMetricSource.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ResourceMetricSource.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ScalingPolicySelect.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ServiceRole.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/SystemInitialization.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/status/CnStatus.java
create mode 100644 scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/status/DorisClusterStatus.java
create mode 100644 tools/docker/build/scaleph-seatunnel/Dockerfile_backup
create mode 100644 tools/docker/build/scaleph-seatunnel/Dockerfile_single
diff --git a/pom.xml b/pom.xml
index 9cf76e8a7..b7ce5da37 100644
--- a/pom.xml
+++ b/pom.xml
@@ -268,6 +268,11 @@
scaleph-api${project.version}
+
+ ${project.groupId}
+ scaleph-engine-doris
+ ${project.version}
+ ${project.groupId}scaleph-engine-flink-client
diff --git a/scaleph-api/pom.xml b/scaleph-api/pom.xml
index 87012c16e..00e64f01f 100644
--- a/scaleph-api/pom.xml
+++ b/scaleph-api/pom.xml
@@ -29,7 +29,11 @@
- cn.sliew
+ ${project.parent.groupId}
+ scaleph-engine-doris
+
+
+ ${project.parent.groupId}scaleph-engine-sql-gateway
diff --git a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/security/SecResourceWebRole.java b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/security/SecResourceWebRole.java
new file mode 100644
index 000000000..b3bb64a86
--- /dev/null
+++ b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/entity/master/security/SecResourceWebRole.java
@@ -0,0 +1,42 @@
+/*
+ * 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 cn.sliew.scaleph.dao.entity.master.security;
+
+import cn.sliew.scaleph.dao.entity.BaseDO;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * 资源-web与角色关联表
+ */
+@Data
+@TableName("sec_resource_web_role")
+@Schema(name = "SecResourceWebRole对象", description = "资源-web与角色关联表")
+public class SecResourceWebRole extends BaseDO {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableField("resource_web_id")
+ private Long resourceWebId;
+
+ @TableField("role_id")
+ private Long roleId;
+}
diff --git a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/security/SecResourceWebRoleMapper.java b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/security/SecResourceWebRoleMapper.java
new file mode 100644
index 000000000..e9b883fd8
--- /dev/null
+++ b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/security/SecResourceWebRoleMapper.java
@@ -0,0 +1,53 @@
+/*
+ * 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 cn.sliew.scaleph.dao.mapper.master.security;
+
+import cn.sliew.scaleph.common.dict.security.RoleStatus;
+import cn.sliew.scaleph.dao.entity.master.security.SecResourceWeb;
+import cn.sliew.scaleph.dao.entity.master.security.SecResourceWebRole;
+import cn.sliew.scaleph.dao.entity.master.security.SecRole;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 资源-web与角色关联表 Mapper 接口
+ */
+@Repository
+public interface SecResourceWebRoleMapper extends BaseMapper {
+
+ /**
+ * 查询 资源-web 关联的角色
+ */
+ Page selectRelatedRolesByWebResource(Page page,
+ @Param("resourceWebId") Long resourceWebId,
+ @Param("status") RoleStatus status,
+ @Param("name") String name);
+
+ /**
+ * 查询 资源-web 未关联的角色
+ */
+ Page selectUnrelatedRolesByWebResource(Page page,
+ @Param("resourceWebId") Long resourceWebId,
+ @Param("status") RoleStatus status,
+ @Param("name") String name);
+
+ Page selectAllResourceWebWithAuthorizeStatus(@Param("roleId") Long roleId);
+}
diff --git a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/security/SecRoleMapper.java b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/security/SecRoleMapper.java
index 61bae8237..cff382e6d 100644
--- a/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/security/SecRoleMapper.java
+++ b/scaleph-dao/src/main/java/cn/sliew/scaleph/dao/mapper/master/security/SecRoleMapper.java
@@ -18,14 +18,14 @@
package cn.sliew.scaleph.dao.mapper.master.security;
-import java.io.Serializable;
-import java.util.List;
-
import cn.sliew.scaleph.dao.entity.master.security.SecRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
+import java.io.Serializable;
+import java.util.List;
+
/**
*
* 角色表 Mapper 接口
@@ -36,6 +36,7 @@
*/
@Repository
public interface SecRoleMapper extends BaseMapper {
+
/**
* 查询部门对应的角色信息
*
diff --git a/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecResourceWebRoleMapper.xml b/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecResourceWebRoleMapper.xml
new file mode 100644
index 000000000..fdb65d1b7
--- /dev/null
+++ b/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecResourceWebRoleMapper.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,
+ creator,
+ create_time,
+ editor,
+ update_time,
+ resource_web_id, role_id
+
+
+
+
+
+
+
diff --git a/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecRoleMapper.xml b/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecRoleMapper.xml
index 8878c2139..08f4470ff 100644
--- a/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecRoleMapper.xml
+++ b/scaleph-dao/src/main/resources/cn/sliew/scaleph/dao/mapper/master/security/SecRoleMapper.xml
@@ -86,7 +86,6 @@
-
-
+
diff --git a/scaleph-engine/pom.xml b/scaleph-engine/pom.xml
index c0cd9c712..2b38fcbc0 100644
--- a/scaleph-engine/pom.xml
+++ b/scaleph-engine/pom.xml
@@ -30,6 +30,7 @@
pom
+ scaleph-engine-dorisscaleph-engine-flink-clientscaleph-engine-seatunnelscaleph-engine-flink
diff --git a/scaleph-engine/scaleph-engine-doris/pom.xml b/scaleph-engine/scaleph-engine-doris/pom.xml
new file mode 100644
index 000000000..547e50507
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/pom.xml
@@ -0,0 +1,43 @@
+
+
+
+
+ 4.0.0
+
+ cn.sliew
+ scaleph
+ 1.0.5-SNAPSHOT
+ ../../pom.xml
+
+ scaleph-engine-doris
+
+
+
+ ${project.parent.groupId}
+ scaleph-project
+
+
+
+ io.fabric8
+ kubernetes-client
+
+
+
+
\ No newline at end of file
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/DorisCluster.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/DorisCluster.java
new file mode 100644
index 000000000..40df42f32
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/DorisCluster.java
@@ -0,0 +1,36 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator;
+
+import cn.sliew.scaleph.engine.doris.operator.spec.DorisClusterSpec;
+import cn.sliew.scaleph.engine.doris.operator.status.DorisClusterStatus;
+import io.fabric8.kubernetes.api.model.Namespaced;
+import io.fabric8.kubernetes.client.CustomResource;
+import io.fabric8.kubernetes.model.annotation.Group;
+import io.fabric8.kubernetes.model.annotation.Kind;
+import io.fabric8.kubernetes.model.annotation.Version;
+
+@Version("v1")
+@Group("doris.selectdb.com")
+@Kind("DorisCluster")
+public class DorisCluster extends CustomResource implements Namespaced {
+
+
+
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AdminUser.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AdminUser.java
new file mode 100644
index 000000000..c6903ad6b
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AdminUser.java
@@ -0,0 +1,28 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+@Data
+public class AdminUser extends BaseSpec {
+
+ private String name;
+ private String password;
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AutoScalerVersion.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AutoScalerVersion.java
new file mode 100644
index 000000000..81cd489f7
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AutoScalerVersion.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.sliew.scaleph.engine.doris.operator.spec;
+
+public enum AutoScalerVersion {
+ v1, v2;
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AutoScalingPolicy.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AutoScalingPolicy.java
new file mode 100644
index 000000000..8fe2b5dfc
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/AutoScalingPolicy.java
@@ -0,0 +1,52 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+import javax.annotation.Nullable;
+
+/**
+ * AutoScalingPolicy defines the auto scale
+ */
+@Data
+public class AutoScalingPolicy {
+
+ /**
+ * the policy of cn autoscale. operator use autoscaling v2.
+ */
+ private Object hpaPolicy;
+
+ /**
+ * version represents the autoscaler version for cn service. only support v1,,v2
+ */
+ private AutoScalerVersion version;
+
+ /**
+ * the min numbers of target.
+ */
+ @Nullable
+ private Integer minReplicas;
+
+ /**
+ * the max numbers of target.
+ */
+ @Nullable
+ private Integer maxReplicas;
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BaseSpec.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BaseSpec.java
new file mode 100644
index 000000000..14ca0963a
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BaseSpec.java
@@ -0,0 +1,133 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator.spec;
+
+import io.fabric8.kubernetes.api.model.*;
+import lombok.Data;
+
+import javax.annotation.Nullable;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * BaseSpec describe the foundation spec of pod about doris components.
+ */
+@Data
+public class BaseSpec {
+
+ /**
+ * annotation for fe pods. user can config monitor annotation for collect to monitor system.
+ */
+ private Map annotations;
+
+ /**
+ * (Optional) If specified, the pod’s nodeSelector,displayName=“Map of nodeSelectors to match when scheduling pods on nodes”
+ */
+ @Nullable
+ private Map nodeSelector;
+
+ /**
+ * podLabels for user selector or classify pods
+ */
+ @Nullable
+ private Map podLabels;
+
+ /**
+ * Image for a doris cn deployment.
+ */
+ private String image;
+
+ /**
+ * ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod
+ */
+ @Nullable
+ private List imagePullSecrets;
+
+ /**
+ * serviceAccount for cn access cloud service.
+ */
+ private String serviceAccount;
+
+ /**
+ * Replicas is the number of desired cn Pod.
+ */
+ @Nullable
+ private Integer replicas;
+
+ /**
+ * fixme 错误
+ * (Members of ResourceRequirements are embedded into this type.)
+ */
+ private ResourceRequirements ResourceRequirements;
+
+ /**
+ * (Optional) Tolerations for scheduling pods onto some dedicated nodes
+ */
+ @Nullable
+ private List tolerations;
+
+ /**
+ * the reference for cn configMap.
+ */
+ @Nullable
+ private ConfigMapInfo configMapInfo;
+
+ /**
+ cnEnvVars is a slice of environment variables that are added to the pods, the default is empty.
+ */
+ @Nullable
+ private List envVars;
+
+ /**
+ * SystemInitialization for fe, be and cn setting system parameters.
+ */
+ private SystemInitialization systemInitialization;
+
+ /**
+ *
+ */
+ private List persistentVolumes;
+
+ /**
+ * If specified, the pod’s scheduling constraints.
+ */
+ @Nullable
+ private Affinity affinity;
+
+ /**
+ * HostAliases is an optional list of hosts and IPs that will be injected into the pod’s hosts file if specified. This is only valid for non-hostNetwork pods.
+ */
+ @Nullable
+ private List hostAliases;
+
+ /**
+ * expose the be listen ports
+ */
+ private ExportService service;
+
+ /**
+ * specify register fe addresses
+ */
+ private FeAddress feAddress;
+
+ /**
+ * A special supplemental group that applies to all containers in a pod. Some volume types allow the Kubelet to change the ownership of that volume to be owned by the pod:
+ */
+ private Long fsGroup;
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BeSpec.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BeSpec.java
new file mode 100644
index 000000000..648748b1f
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BeSpec.java
@@ -0,0 +1,29 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+/**
+ * BeSpec describes a template for creating copies of a be software service.
+ */
+@Data
+public class BeSpec extends BaseSpec {
+
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BrokerSpec.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BrokerSpec.java
new file mode 100644
index 000000000..952ea2ee8
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/BrokerSpec.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+/**
+ * BrokerSpec describes a template for creating copies of a broker software service, if deploy broker we recommend you add affinity for deploy with be pod.
+ */
+@Data
+public class BrokerSpec extends BaseSpec {
+
+ /**
+ * expose the cn listen ports
+ */
+ private ExportService service;
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/CnSpec.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/CnSpec.java
new file mode 100644
index 000000000..e757abd9e
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/CnSpec.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+/**
+ * CnSpec describes a template for creating copies of a cn software service. cn, the service for external table.
+ */
+@Data
+public class CnSpec extends BaseSpec {
+
+ /**
+ * AutoScalingPolicy auto scaling strategy
+ */
+ private AutoScalingPolicy autoScalingPolicy;
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ConfigMapInfo.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ConfigMapInfo.java
new file mode 100644
index 000000000..f827e02ae
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ConfigMapInfo.java
@@ -0,0 +1,35 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+@Data
+public class ConfigMapInfo {
+
+ /**
+ * the config info for start progress.
+ */
+ private String configMapName;
+
+ /**
+ * the config response key in configmap.
+ */
+ private String resolveKey;
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/DorisClusterSpec.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/DorisClusterSpec.java
new file mode 100644
index 000000000..c8c9c7561
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/DorisClusterSpec.java
@@ -0,0 +1,31 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+@Data
+public class DorisClusterSpec {
+
+ private FeSpec feSpec;
+ private BeSpec beSpec;
+ private CnSpec cnSpec;
+ private BrokerSpec brokerSpec;
+ private AdminUser adminUser;
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/DorisServicePort.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/DorisServicePort.java
new file mode 100644
index 000000000..2c2bf7dc6
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/DorisServicePort.java
@@ -0,0 +1,31 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+/**
+ * 仅在 NodeType 场景起作用
+ */
+@Data
+public class DorisServicePort {
+
+ private Integer nodePort;
+ private Integer targetPort;
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/Endpoints.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/Endpoints.java
new file mode 100644
index 000000000..2ad045413
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/Endpoints.java
@@ -0,0 +1,40 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Endpoints describe the address outside k8s.
+ */
+@Data
+public class Endpoints {
+
+ /**
+ * the ip or domain array.
+ */
+ private List address;
+
+ /**
+ * the fe port that for query. the field query_port defines in fe config.
+ */
+ private Integer port;
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ExportService.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ExportService.java
new file mode 100644
index 000000000..24a068412
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ExportService.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cn.sliew.scaleph.engine.doris.operator.spec;
+
+import cn.sliew.scaleph.common.dict.flink.ServiceExposedType;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ExportService {
+
+ /**
+ * fixme k8s 的 type
+ * https://github.com/selectdb/doris-operator/blob/master/doc/api.md#exportservice
+ */
+ private ServiceExposedType type;
+ private List servicePorts;
+ private String loadBalancerIP;
+
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/FeAddress.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/FeAddress.java
new file mode 100644
index 000000000..19a8a2341
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/FeAddress.java
@@ -0,0 +1,39 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+/**
+ * FeAddress specify the fe address, please set it when you deploy fe outside k8s or deploy components use crd except fe, if not set .
+ */
+@Data
+public class FeAddress {
+
+ /**
+ * the service name that proxy fe on k8s. the service must in same namespace with fe.
+ */
+ private String serviceName;
+
+ /**
+ * the fe addresses if not deploy by crd, user can use k8s deploy fe observer.
+ */
+ private Endpoints endpoints;
+
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/FeSpec.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/FeSpec.java
new file mode 100644
index 000000000..30b332c6b
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/FeSpec.java
@@ -0,0 +1,25 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+@Data
+public class FeSpec extends BaseSpec {
+}
diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HPAPolicy.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HPAPolicy.java
new file mode 100644
index 000000000..e65538a13
--- /dev/null
+++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HPAPolicy.java
@@ -0,0 +1,40 @@
+/*
+ * 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 cn.sliew.scaleph.engine.doris.operator.spec;
+
+import lombok.Data;
+
+import javax.annotation.Nullable;
+import java.util.List;
+
+@Data
+public class HPAPolicy {
+
+ /**
+ * Metrics specifies how to scale based on a single metric the struct copy from k8s.io/api/autoscaling/v2beta2/types.go. the redundancy code will hide the restriction about HorizontalPodAutoscaler version and kubernetes releases matching issue. the splice will have unsafe.Pointer convert, so be careful to edit the struct fileds.
+ */
+ @Nullable
+ private List