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-doris scaleph-engine-flink-client scaleph-engine-seatunnel scaleph-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 metrics; + + /** + * HorizontalPodAutoscalerBehavior configures the scaling behavior of the target. 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 + */ + @Nullable + private Object behavior; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HPAScalingRules.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HPAScalingRules.java new file mode 100644 index 000000000..94c83fcd9 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HPAScalingRules.java @@ -0,0 +1,27 @@ +/* + * 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 HPAScalingRules { + + +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HorizontalPodAutoscalerBehavior.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HorizontalPodAutoscalerBehavior.java new file mode 100644 index 000000000..ea4b44956 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HorizontalPodAutoscalerBehavior.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.engine.doris.operator.spec; + +import lombok.Data; + +import javax.annotation.Nullable; + +/** + * HorizontalPodAutoscalerBehavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). + */ +@Data +public class HorizontalPodAutoscalerBehavior { + + /** + * scaleUp is scaling policy for scaling Up. If not set, the default value is the higher of: * increase no more than 4 pods per 60 seconds * double the number of pods per 60 seconds No stabilization is used. + */ + @Nullable + private Object scaleUp; + + /** + * scaleDown is scaling policy for scaling Down. If not set, the default value is to allow to scale down to minReplicas pods, with a 300 second stabilization window (i.e., the highest recommendation for the last 300sec is used). + */ + @Nullable + private Object scaleDown; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HorizontalScaler.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HorizontalScaler.java new file mode 100644 index 000000000..c018f9909 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/HorizontalScaler.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 HorizontalScaler { + + /** + * the deploy horizontal scaler name + */ + private String name; + + /** + * the deploy horizontal version. + */ + private AutoScalerVersion version; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricIdentifier.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricIdentifier.java new file mode 100644 index 000000000..f4563ed56 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricIdentifier.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.engine.doris.operator.spec; + +import io.fabric8.kubernetes.api.model.LabelSelector; +import lombok.Data; + +import javax.annotation.Nullable; + +/** + * MetricIdentifier defines the name and optionally selector for a metric + */ +@Data +public class MetricIdentifier { + + /** + * name is the name of the given metric + */ + private String name; + + /** + * 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. + */ + @Nullable + private LabelSelector selector; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricSourceType.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricSourceType.java new file mode 100644 index 000000000..d77ea44b6 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricSourceType.java @@ -0,0 +1,51 @@ +/* + * 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; + +/** + * MetricSourceType indicates the type of metric. + */ +public enum MetricSourceType { + + /** + * ObjectMetricSourceType is a metric describing a kubernetes object (for example, hits-per-second on an Ingress object). + */ + Object, + + /** + * PodsMetricSourceType is 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. + */ + Pods, + + /** + * ResourceMetricSourceType is a resource metric known to Kubernetes, as specified in requests and limits, 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 (the “pods” source). + */ + Resource, + + /** + * ContainerResourceMetricSourceType is a resource metric known to Kubernetes, as specified in requests and limits, describing a single container in 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 (the “pods” source). + */ + ContainerResource, + + /** + * ExternalMetricSourceType is 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). + */ + External, + +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricSpec.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricSpec.java new file mode 100644 index 000000000..3a962b868 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricSpec.java @@ -0,0 +1,56 @@ +/* + * 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; + +@Data +public class MetricSpec { + + /** + * 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 + */ + private MetricSourceType type; + + /** + * 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. + */ + @Nullable + private ObjectMetricSource object; + + /** + * 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. + */ + @Nullable + private ResourceMetricSource resource; + + /** + * 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. + */ + @Nullable + private Object containerResource; + + /** + * 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). + */ + @Nullable + private Object external; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricTarget.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricTarget.java new file mode 100644 index 000000000..80b71def6 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricTarget.java @@ -0,0 +1,54 @@ +/* + * 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.Quantity; +import lombok.Data; + +import javax.annotation.Nullable; + +/** + * MetricTarget defines the target value, average value, or average utilization of a specific metric + */ +@Data +public class MetricTarget { + + /** + * type represents whether the metric type is Utilization, Value, or AverageValue + */ + private MetricTargetType type; + + /** + * value is the target value of the metric (as a quantity). + */ + @Nullable + private Quantity value; + + /** + * averageValue is the target value of the average of the metric across all relevant pods (as a quantity) + */ + @Nullable + private Quantity averageValue; + + /** + * 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 + */ + @Nullable + private Integer averageUtilization; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricTargetType.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricTargetType.java new file mode 100644 index 000000000..b4f146c78 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/MetricTargetType.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; + +/** + * MetricTargetType specifies the type of metric being targeted, and should be either “Value”, “AverageValue”, or “Utilization” + */ +public enum MetricTargetType { + + /** + * AverageValueMetricType declares a MetricTarget is an + */ + AverageValue, + + /** + * UtilizationMetricType declares a MetricTarget is an AverageUtilization value + */ + Utilization, + + /** + * ValueMetricType declares a MetricTarget is a raw value + */ + Value; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ObjectMetricSource.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ObjectMetricSource.java new file mode 100644 index 000000000..1be52f7ba --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ObjectMetricSource.java @@ -0,0 +1,43 @@ +/* + * 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; + +/** + * ObjectMetricSource indicates how to scale on a metric describing a kubernetes object (for example, hits-per-second on an Ingress object). + */ +@Data +public class ObjectMetricSource { + + /** + * + */ + private Object describedObject; + + /** + * metric identifies the target metric by name and selector + */ + private Object metric; + + /** + * target specifies the target value for the given metric + */ + private MetricTarget target; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/PersistentVolume.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/PersistentVolume.java new file mode 100644 index 000000000..4dd8ccc11 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/PersistentVolume.java @@ -0,0 +1,44 @@ +/* + * 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.PersistentVolumeClaim; +import lombok.Data; + +/** + * PersistentVolume defines volume information and container mount information. + */ +@Data +public class PersistentVolume { + + /** + * PersistentVolumeClaimSpec is a list of claim spec about storage that pods are required. + */ + private PersistentVolumeClaim persistentVolumeClaimSpec; + + /** + * the mount path for component service. + */ + private String mountPath; + + /** + * the volume name associate with + */ + private String name; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/PodsMetricSource.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/PodsMetricSource.java new file mode 100644 index 000000000..2d1c5040d --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/PodsMetricSource.java @@ -0,0 +1,38 @@ +/* + * 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; + +/** + * PodsMetricSource indicates how to scale on 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. + */ +@Data +public class PodsMetricSource { + + /** + * metric identifies the target metric by name and selector + */ + private Object metric; + + /** + * target specifies the target value for the given metric + */ + private MetricTarget target; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ResourceMetricSource.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ResourceMetricSource.java new file mode 100644 index 000000000..d0605b557 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ResourceMetricSource.java @@ -0,0 +1,41 @@ +/* + * 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; + +/** + * ResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). + * The values will be averaged together before being compared to the target. + * 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. + * Only one “target” type should be set. + */ +@Data +public class ResourceMetricSource { + + /** + * name is the name of the resource in question. + */ + private Object name; + + /** + * target specifies the target value for the given metric + */ + private MetricTarget target; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ScalingPolicySelect.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ScalingPolicySelect.java new file mode 100644 index 000000000..e21d0b7e0 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ScalingPolicySelect.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; + +/** + * ScalingPolicySelect is used to specify which policy should be used while scaling in a certain direction + */ +public enum ScalingPolicySelect { + + /** + * DisabledPolicySelect disables the scaling in this direction. + */ + Disabled, + + /** + * MaxPolicySelect selects the policy with the highest possible change. + */ + Max, + + /** + * MinPolicySelect selects the policy with the lowest possible change. + */ + Min; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ServiceRole.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ServiceRole.java new file mode 100644 index 000000000..45a4fca33 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/ServiceRole.java @@ -0,0 +1,24 @@ +/* + * 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 ServiceRole { + + access, internal; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/SystemInitialization.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/SystemInitialization.java new file mode 100644 index 000000000..46c1bcc2f --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/spec/SystemInitialization.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.engine.doris.operator.spec; + +import lombok.Data; + +import java.util.List; + +@Data +public class SystemInitialization { + + /** + * Image for doris initialization, default is alpine:latest. + */ + private String initImage; + + /** + * Entrypoint array. Not executed within a shell. + */ + private List command; + + /** + * Arguments to the entrypoint. + */ + private List args; +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/status/CnStatus.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/status/CnStatus.java new file mode 100644 index 000000000..a32f3111d --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/status/CnStatus.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.status; + +import lombok.Data; + +@Data +public class CnStatus { +} diff --git a/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/status/DorisClusterStatus.java b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/status/DorisClusterStatus.java new file mode 100644 index 000000000..a9de661a2 --- /dev/null +++ b/scaleph-engine/scaleph-engine-doris/src/main/java/cn/sliew/scaleph/engine/doris/operator/status/DorisClusterStatus.java @@ -0,0 +1,22 @@ +/* + * 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.status; + +public class DorisClusterStatus { +} diff --git a/scaleph-support/scaleph-generator/src/main/java/cn/sliew/scaleph/generator/MybatisPlusGenerator.java b/scaleph-support/scaleph-generator/src/main/java/cn/sliew/scaleph/generator/MybatisPlusGenerator.java index 8b5e07689..12a505942 100644 --- a/scaleph-support/scaleph-generator/src/main/java/cn/sliew/scaleph/generator/MybatisPlusGenerator.java +++ b/scaleph-support/scaleph-generator/src/main/java/cn/sliew/scaleph/generator/MybatisPlusGenerator.java @@ -54,7 +54,7 @@ public class MybatisPlusGenerator { /** * just add table names here and run the {@link #main(String[])} method. */ - private static final String[] TABLES = {"sec_resource_web"}; + private static final String[] TABLES = {"sec_resource_web_role"}; public static void main(String[] args) { //自动生成配置 diff --git a/tools/docker/build/scaleph-seatunnel/Dockerfile b/tools/docker/build/scaleph-seatunnel/Dockerfile index 9f0c21a4c..2733d60e7 100644 --- a/tools/docker/build/scaleph-seatunnel/Dockerfile +++ b/tools/docker/build/scaleph-seatunnel/Dockerfile @@ -19,30 +19,22 @@ ARG BASE_RELEASE_IMAGE=flink:${FLINK_VERSION} FROM maven:3.8-eclipse-temurin-11 as build ARG SEATUNNEL_VERSION=2.3.3 +ARG TAR_FILE=apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz ENV SEATUNNEL_HOME=/opt/seatunnel - RUN mkdir -p $SEATUNNEL_HOME -ARG TAR_FILE=apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz - -#COPY $TAR_FILE $SEATUNNEL_HOME/$TAR_FILE -#RUN cd $SEATUNNEL_HOME ; \ -# tar -zxf $TAR_FILE --strip 1 -C $SEATUNNEL_HOME \ - -# forked from seatunnel k8s quick start -RUN wget https://archive.apache.org/dist/seatunnel/${SEATUNNEL_VERSION}/$TAR_FILE ; \ +RUN wget https://dlcdn.apache.org/seatunnel/${SEATUNNEL_VERSION}/$TAR_FILE ; \ tar -zxf $TAR_FILE --strip 1 -C $SEATUNNEL_HOME # strange behavior: replace mvnw by mvn on install-plugin.sh, remove useless comment on plugin_config RUN rm $SEATUNNEL_HOME/config/plugin_config COPY tools/docker/build/scaleph-seatunnel/plugin_config $SEATUNNEL_HOME/config -RUN rm $SEATUNNEL_HOME/bin/install-plugin.sh -COPY tools/docker/build/scaleph-seatunnel/install-plugin.sh $SEATUNNEL_HOME/bin +#RUN rm $SEATUNNEL_HOME/bin/install-plugin.sh +#COPY tools/docker/build/scaleph-seatunnel/install-plugin.sh $SEATUNNEL_HOME/bin -RUN cd $SEATUNNEL_HOME ; \ - sh -x bin/install-plugin.sh ${SEATUNNEL_VERSION} +RUN cd ${SEATUNNEL_HOME}|| sh bin/install-plugin.sh ${SEATUNNEL_VERSION} # BASE_RELEASE_IMAGE argument must be defined twice ARG FLINK_VERSION=1.15 diff --git a/tools/docker/build/scaleph-seatunnel/Dockerfile_backup b/tools/docker/build/scaleph-seatunnel/Dockerfile_backup new file mode 100644 index 000000000..f69818614 --- /dev/null +++ b/tools/docker/build/scaleph-seatunnel/Dockerfile_backup @@ -0,0 +1,55 @@ +# 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. + +ARG FLINK_VERSION=1.15 +ARG BASE_RELEASE_IMAGE=flink:${FLINK_VERSION} +FROM maven:3.8-eclipse-temurin-11 as build + +ARG SEATUNNEL_VERSION=2.3.3 + +ENV SEATUNNEL_HOME=/opt/seatunnel + +RUN mkdir -p $SEATUNNEL_HOME + +ARG TAR_FILE=apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz + +#COPY $TAR_FILE $SEATUNNEL_HOME/$TAR_FILE +#RUN cd $SEATUNNEL_HOME ; \ +# tar -zxf $TAR_FILE --strip 1 -C $SEATUNNEL_HOME \ + +# forked from seatunnel k8s quick start +RUN wget https://archive.apache.org/dist/seatunnel/${SEATUNNEL_VERSION}/$TAR_FILE ; \ + tar -zxf $TAR_FILE --strip 1 -C $SEATUNNEL_HOME + +# strange behavior: replace mvnw by mvn on install-plugin.sh, remove useless comment on plugin_config +RUN rm $SEATUNNEL_HOME/config/plugin_config +COPY tools/docker/build/scaleph-seatunnel/plugin_config $SEATUNNEL_HOME/config + +#RUN rm $SEATUNNEL_HOME/bin/install-plugin.sh +#COPY tools/docker/build/scaleph-seatunnel/install-plugin.sh $SEATUNNEL_HOME/bin + +RUN cd ${SEATUNNEL_HOME}|| sh bin/install-plugin.sh ${SEATUNNEL_VERSION} + +# BASE_RELEASE_IMAGE argument must be defined twice +ARG FLINK_VERSION=1.15 +ARG BASE_RELEASE_IMAGE=flink:${FLINK_VERSION} +FROM $BASE_RELEASE_IMAGE as release + +ENV SEATUNNEL_HOME=/opt/seatunnel + +RUN mkdir -p $SEATUNNEL_HOME + +COPY --from=build $SCALEPH_HOME $SCALEPH_HOME/ diff --git a/tools/docker/build/scaleph-seatunnel/Dockerfile_single b/tools/docker/build/scaleph-seatunnel/Dockerfile_single new file mode 100644 index 000000000..6474c835b --- /dev/null +++ b/tools/docker/build/scaleph-seatunnel/Dockerfile_single @@ -0,0 +1,38 @@ +# 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. + +ARG FLINK_VERSION=1.15 +ARG BASE_RELEASE_IMAGE=flink:${FLINK_VERSION} +FROM $BASE_RELEASE_IMAGE as release + +ARG SEATUNNEL_VERSION=2.3.3 + +ENV SEATUNNEL_HOME=/opt/seatunnel + +RUN mkdir -p $SEATUNNEL_HOME + +ARG TAR_FILE=apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz + +# forked from seatunnel k8s quick start +RUN wget https://dlcdn.apache.org/seatunnel/${SEATUNNEL_VERSION}/$TAR_FILE ; +RUN tar -xzvf $TAR_FILE --strip 1 -C $SEATUNNEL_HOME + + +#RUN wget https://dlcdn.apache.org/seatunnel/${SEATUNNEL_VERSION}/apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz +#RUN tar -xzvf apache-seatunnel-${SEATUNNEL_VERSION}-bin.tar.gz +#RUN mv apache-seatunnel-${SEATUNNEL_VERSION} ${SEATUNNEL_HOME} + +RUN cd ${SEATUNNEL_HOME}||sh bin/install-plugin.sh ${SEATUNNEL_VERSION} \ No newline at end of file diff --git a/tools/docker/mysql/init.d/scaleph-security-mysql.sql b/tools/docker/mysql/init.d/scaleph-security-mysql.sql index ad086b3d5..6d99e6db8 100644 --- a/tools/docker/mysql/init.d/scaleph-security-mysql.sql +++ b/tools/docker/mysql/init.d/scaleph-security-mysql.sql @@ -517,6 +517,21 @@ INSERT INTO `sec_resource_web`(`id`, `type`, `pid`, `name`, `path`, `redirect`, `creator`, `editor`) VALUES (63, '2', 51, 'setting', '/admin/setting', NULL, NULL, 'setting', './Admin/Setting', NULL, 'sys', 'sys'); + +drop table if exists sec_resource_web_role; +create table sec_resource_web_role +( + id bigint not null auto_increment comment '自增主键', + resource_web_id bigint not null, + role_id bigint not null, + creator varchar(32) comment '创建人', + create_time datetime not null default current_timestamp comment '创建时间', + editor varchar(32) comment '修改人', + update_time datetime not null default current_timestamp on update current_timestamp comment '修改时间', + primary key (id), + unique key (resource_web_id, role_id) +) engine = innodb comment = '资源-web与角色关联表'; + /* 部门表 */ drop table if exists sec_dept; create table sec_dept