-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature][scaleph-engine-doris] update doris instance service expose (#…
…668) * feature: add service form item for doris fe component * feature: add service form item for doris fe component * fix: kubernetes service error * feature: add doris service * feature: add doris service --------- Co-authored-by: wangqi <wangqi@xinxuan.net>
- Loading branch information
Showing
16 changed files
with
461 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...oris/src/main/java/cn/sliew/scaleph/engine/doris/service/DorisClusterEndpointService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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.service; | ||
|
||
import cn.sliew.scaleph.engine.doris.service.dto.DorisClusterFeEndpoint; | ||
|
||
public interface DorisClusterEndpointService { | ||
|
||
DorisClusterFeEndpoint getFEEndpoint(Long dorisInstanceId); | ||
} |
32 changes: 32 additions & 0 deletions
32
...doris/src/main/java/cn/sliew/scaleph/engine/doris/service/dto/DorisClusterFeEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* 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.service.dto; | ||
|
||
import lombok.Data; | ||
|
||
import java.net.URI; | ||
|
||
@Data | ||
public class DorisClusterFeEndpoint { | ||
|
||
private URI http; | ||
private URI rpc; | ||
private URI query; | ||
private URI editLog; | ||
} |
74 changes: 74 additions & 0 deletions
74
...main/java/cn/sliew/scaleph/engine/doris/service/impl/DorisClusterEndpointServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* 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.service.impl; | ||
|
||
import cn.sliew.scaleph.common.dict.common.YesOrNo; | ||
import cn.sliew.scaleph.engine.doris.service.DorisClusterEndpointService; | ||
import cn.sliew.scaleph.engine.doris.service.WsDorisOperatorInstanceService; | ||
import cn.sliew.scaleph.engine.doris.service.dto.DorisClusterFeEndpoint; | ||
import cn.sliew.scaleph.engine.doris.service.dto.WsDorisOperatorInstanceDTO; | ||
import cn.sliew.scaleph.kubernetes.service.ServiceService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.net.URI; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
@Service | ||
public class DorisClusterEndpointServiceImpl implements DorisClusterEndpointService { | ||
|
||
@Autowired | ||
private WsDorisOperatorInstanceService wsDorisOperatorInstanceService; | ||
@Autowired | ||
private ServiceService serviceService; | ||
|
||
@Override | ||
public DorisClusterFeEndpoint getFEEndpoint(Long dorisInstanceId) { | ||
WsDorisOperatorInstanceDTO instanceDTO = wsDorisOperatorInstanceService.selectOne(dorisInstanceId); | ||
if (instanceDTO.getDeployed() == YesOrNo.NO) { | ||
return null; | ||
} | ||
|
||
Optional<Map<String, URI>> optional = serviceService.getService(instanceDTO.getClusterCredentialId(), instanceDTO.getNamespace(), instanceDTO.getFeStatus().getAccessService()); | ||
if (optional.isEmpty()) { | ||
return null; | ||
} | ||
DorisClusterFeEndpoint result = new DorisClusterFeEndpoint(); | ||
Map<String, URI> uris = optional.get(); | ||
for (Map.Entry<String, URI> entry : uris.entrySet()) { | ||
switch (entry.getKey()) { | ||
case "http-port": | ||
result.setHttp(entry.getValue()); | ||
break; | ||
case "rpc-port": | ||
result.setRpc(entry.getValue()); | ||
break; | ||
case "query-port": | ||
result.setQuery(entry.getValue()); | ||
break; | ||
case "edit-log-port": | ||
result.setEditLog(entry.getValue()); | ||
break; | ||
default: | ||
} | ||
} | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
scaleph-kubernetes/src/main/java/cn/sliew/scaleph/kubernetes/service/ServiceService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.kubernetes.service; | ||
|
||
import java.net.URI; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
public interface ServiceService { | ||
|
||
Optional<URI> getIngress(Long clusterCredentialId, String namespace, String name); | ||
|
||
Optional<Map<String, URI>> getService(Long clusterCredentialId, String namespace, String name); | ||
} |
Oops, something went wrong.