Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持与AIOS集成部署功能 #77

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions application.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
server:
port: 8888

servlet:
context-path: /openmldb-featinsight
openmldb:
zk_cluster: openmldb-zk:2181
zk_cluster: 172.27.231.51:2181
zk_path: /openmldb
apiserver: openmldb-zk:9080
apiserver: 172.27.231.51:9080
skip_index_check: false
username: root
password: 123456
password:
prophet:
token_auth_enabled: true
pdms_uri: http://172.27.128.190:40121/telamon
130 changes: 130 additions & 0 deletions cicd/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
apiVersion: v1
kind: Service
metadata:
name: openmldb-featinsight
namespace: prophet
labels:
app: openmldb-featinsight
enable-on-api-gw: "true"
annotations:
api-gw-conf: '{"gw-api-confs":[{"listen-paths":"/openmldb-featinsight","enable-auth":false}]}'
spec:
type: ClusterIP
selector:
app: openmldb-featinsight
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: openmldb-featinsight
name: openmldb-featinsight
namespace: prophet
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: openmldb-featinsight
release: aios
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: openmldb-featinsight
prophet.4paradigm.com/deployment: openmldb-featinsight
release: aios
name: openmldb-featinsight
spec:
imagePullSecrets:
- name: docker-secret
nodeSelector:
prophet.4paradigm.com/system: "true"
restartPolicy: Always
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 420
name: openmldb-featinsight-configmap
name: openmldb-featinsight-configmap
containers:
- env:
- name: MY_POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: MY_POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: MY_POD_SERVICE_ACCOUNT
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.serviceAccountName
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: MY_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: TZ
value: Asia/Shanghai
image: harbor.4pd.io/studio/openmldb-featinsight:v0.1.1
imagePullPolicy: IfNotPresent
livenessProbe:
tcpSocket:
port: 80
initialDelaySeconds: 60
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 1
failureThreshold: 3
name: app
ports:
- containerPort: 80
protocol: TCP
resources: {}
volumeMounts:
- mountPath: /app/application.yml
name: openmldb-featinsight-configmap
subPath: application.yml
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: openmldb-featinsight
name: openmldb-featinsight-configmap
namespace: prophet
data:
application.yml: |-
server:
port: 80
openmldb:
zk_cluster: 172.27.231.51:2181
zk_path: /openmldb
apiserver: 172.27.231.51:9080
skip_index_check: false
username: root
password:
prophet:
token_auth_enabled: true
pdms_uri: http://172.27.128.190:40121/telamon
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM openjdk:17-oracle
FROM harbor.4pd.io/inf/base-jdk8-ubuntu:1.0.0

WORKDIR /app

ADD featinsight-0.1.0-SNAPSHOT.jar /app/
ADD featinsight-0.1.1-SNAPSHOT.jar /app/

EXPOSE 8888

CMD ["java", "-jar", "/app/featinsight-0.1.0-SNAPSHOT.jar"]
CMD ["java", "-jar", "/app/featinsight-0.1.1-SNAPSHOT.jar"]

2 changes: 1 addition & 1 deletion docker/build_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -ex

docker build -t registry.cn-shenzhen.aliyuncs.com/tobe43/featinsight .
docker build -t harbor.4pd.io/studio/openmldb-featinsight:v0.1.1 .
6 changes: 2 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,12 @@
<dependency>
<groupId>com.4paradigm.openmldb</groupId>
<artifactId>openmldb-native</artifactId>
<version>0.8.5-allinone</version>
<!-- <version>0.8.4-SNAPSHOT</version> -->
<version>0.9.1-allinone-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.4paradigm.openmldb</groupId>
<artifactId>openmldb-jdbc</artifactId>
<version>0.8.5</version>
<!-- <version>0.8.4-SNAPSHOT</version> -->
<version>0.9.1-SNAPSHOT</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package com._4paradigm.openmldb.featureplatform.client;

import com._4paradigm.openmldb.featureplatform.dao.model.FesqlTableColumn;
import com._4paradigm.openmldb.featureplatform.dao.model.SimpleTableInfo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

import java.io.IOException;
import java.util.List;
import java.util.Map;

public class ProphetTelamonClient {

private static final ObjectMapper objectMapper = new ObjectMapper();

private final CloseableHttpClient httpClient;
private final String apiEndpoint;
private final Map<String, String> headers;

public ProphetTelamonClient(String apiEndpoint, Map<String, String> headers) {
this.httpClient = HttpClients.createDefault();
this.apiEndpoint = apiEndpoint;
this.headers = headers;
}

/**
* Get Prophet table-schema.
*
* @return
* @throws Exception
*/
public List<FesqlTableColumn> getTableSchema(String tablePrn) throws Exception {
String endpoint = String.format("%s/v1/tables?prn=%s", this.apiEndpoint, tablePrn);
HttpGet request = new HttpGet(endpoint);
for (Map.Entry<String, String> entry : headers.entrySet()) {
request.setHeader(entry.getKey(), entry.getValue());
}
HttpResponse response = httpClient.execute(request);
HttpEntity entity = response.getEntity();
String responseBody = EntityUtils.toString(entity);

if (response.getStatusLine().getStatusCode() != 200) {
throw new IOException("Fail to request server and get error: " + responseBody);
}
QueryTableResponse tableResponse = objectMapper.readValue(responseBody, QueryTableResponse.class);
if (!"0".equals(tableResponse.getStatus()) || tableResponse.getData().getList().isEmpty()) {
throw new Exception(String.format("Fail get table prn: %s, responseBody: %s", tablePrn, response));
}
return tableResponse.getData().getList().get(0).getSchema();
}

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
private static class QueryTableResponse {
private String status;
private String msg;
private TableList data;

}

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
private static class TableList {
private List<TableInfo> list;
}

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
private static class TableInfo {
private String prn;
private String name;
private List<FesqlTableColumn> schema;
}

public void close() throws IOException {
this.httpClient.close();
}
}
Loading