Skip to content

Commit 18d923d

Browse files
committed
[Fix-4530] Fix resolve pagination error when changing pages on the Registry
1 parent 5e98cf1 commit 18d923d

5 files changed

Lines changed: 84 additions & 32 deletions

File tree

.github/workflows/backend.yaml

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,55 @@ jobs:
246246
version: v1.35.2+k3s1
247247
k3d-args: -s 1 --network dinky_net --api-port 172.28.0.1:6550
248248
k3d-tag: v5.7.5
249-
- name: Get k3s kube config
250-
run: k3d kubeconfig get --all && mkdir ./kube && k3d kubeconfig get --all > ./kube/k3s.yaml && sed -i 's/0.0.0.0/172.28.0.1/g' ./kube/k3s.yaml
251249
- name: Init k8s RBAC and namespace
252250
run: |
253251
kubectl create namespace dinky
254252
kubectl create serviceaccount dinky -n dinky
255253
kubectl create clusterrolebinding flink-role-binding-dinky --clusterrole=edit --serviceaccount=dinky:dinky
254+
cat <<EOF | kubectl apply -f -
255+
apiVersion: rbac.authorization.k8s.io/v1
256+
kind: ClusterRole
257+
metadata:
258+
name: dinky-node-reader
259+
rules:
260+
- apiGroups: [""]
261+
resources: ["nodes"]
262+
verbs: ["get", "list", "watch"]
263+
---
264+
apiVersion: rbac.authorization.k8s.io/v1
265+
kind: ClusterRoleBinding
266+
metadata:
267+
name: dinky-node-reader-binding
268+
roleRef:
269+
apiGroup: rbac.authorization.k8s.io
270+
kind: ClusterRole
271+
name: dinky-node-reader
272+
subjects:
273+
- kind: ServiceAccount
274+
name: dinky
275+
namespace: dinky
276+
EOF
277+
mkdir ./kube
278+
cat <<EOF > ./kube/k3s.yaml
279+
apiVersion: v1
280+
kind: Config
281+
clusters:
282+
- name: k3d-default
283+
cluster:
284+
server: https://172.28.0.1:6550
285+
insecure-skip-tls-verify: true
286+
users:
287+
- name: dinky
288+
user:
289+
token: $(kubectl create token dinky -n dinky)
290+
contexts:
291+
- name: dinky
292+
context:
293+
cluster: k3d-default
294+
namespace: dinky
295+
user: dinky
296+
current-context: dinky
297+
EOF
256298
- name: Init k3s main images
257299
run: |
258300
docker exec k3d-k3s-default-server-0 crictl pull library/busybox:latest

dinky-admin/src/main/resources/mapper/DocumentMapper.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@
4646
<if test='param.subtype!=null and param.subtype!=""'>
4747
and a.subtype = #{param.subtype}
4848
</if>
49+
<if test='param.enabled != null and param.enabled != ""'>
50+
and a.enabled =
51+
<choose>
52+
<when test='param.enabled == true or param.enabled == 1 or param.enabled == "true" or param.enabled == "1"'>1</when>
53+
<otherwise>0</otherwise>
54+
</choose>
55+
</if>
4956
<if test='param.version!=null and param.version!=""'>
5057
and a.version = #{param.version}
5158
</if>

dinky-gateway/src/main/java/org/dinky/gateway/kubernetes/KubernetesGateway.java

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@
4141
import org.apache.flink.kubernetes.KubernetesClusterClientFactory;
4242
import org.apache.flink.kubernetes.KubernetesClusterDescriptor;
4343
import org.apache.flink.kubernetes.configuration.KubernetesConfigOptions;
44-
import org.apache.flink.kubernetes.kubeclient.Fabric8FlinkKubeClient;
45-
import org.apache.flink.kubernetes.kubeclient.FlinkKubeClient;
4644
import org.apache.flink.python.PythonOptions;
4745

48-
import java.lang.reflect.Method;
46+
import java.lang.reflect.InvocationTargetException;
4947
import java.util.Collections;
5048
import java.util.Map;
5149
import java.util.UUID;
@@ -55,7 +53,6 @@
5553
import cn.hutool.core.io.FileUtil;
5654
import cn.hutool.core.lang.Assert;
5755
import cn.hutool.core.text.StrFormatter;
58-
import cn.hutool.core.util.ReflectUtil;
5956
import cn.hutool.core.util.StrUtil;
6057
import io.fabric8.kubernetes.api.model.Pod;
6158
import lombok.Data;
@@ -226,26 +223,37 @@ public TestResult test() {
226223
// Test mode no jobName, use uuid .
227224
addConfigParas(KubernetesConfigOptions.CLUSTER_ID, UUID.randomUUID().toString());
228225
initConfig();
229-
FlinkKubeClient client = k8sClientHelper.getClient();
230-
if (client instanceof Fabric8FlinkKubeClient) {
231-
Object internalClient = ReflectUtil.getFieldValue(client, "internalClient");
232-
Method method = ReflectUtil.getMethod(internalClient.getClass(), "getVersion");
233-
Object versionInfo = method.invoke(internalClient);
234-
logger.info(
235-
"k8s cluster link successful ; k8s version: {} ; platform: {}",
236-
ReflectUtil.getFieldValue(versionInfo, "gitVersion"),
237-
ReflectUtil.getFieldValue(versionInfo, "platform"));
238-
}
226+
String namespace = configuration.get(KubernetesConfigOptions.NAMESPACE);
227+
k8sClientHelper.getKubernetesClient().pods().inNamespace(namespace).list();
228+
logger.info("k8s cluster link successful ; namespace: {}", namespace);
239229
return TestResult.success();
240230
} catch (Exception e) {
241231
logger.error(Status.GATEWAY_KUBERNETES_TEST_FAILED.getMessage(), e);
232+
String errorDetail = extractTestErrorDetail(e);
242233
return TestResult.fail(
243-
StrFormatter.format("{}:{}", Status.GATEWAY_KUBERNETES_TEST_FAILED.getMessage(), e.getMessage()));
234+
StrFormatter.format("{} {}", Status.GATEWAY_KUBERNETES_TEST_FAILED.getMessage(), errorDetail));
244235
} finally {
245236
close();
246237
}
247238
}
248239

240+
static String extractTestErrorDetail(Throwable throwable) {
241+
Throwable rootCause = throwable;
242+
while (rootCause instanceof InvocationTargetException
243+
&& ((InvocationTargetException) rootCause).getTargetException() != null) {
244+
rootCause = ((InvocationTargetException) rootCause).getTargetException();
245+
}
246+
while (rootCause.getCause() != null && rootCause.getCause() != rootCause) {
247+
rootCause = rootCause.getCause();
248+
}
249+
250+
String message = rootCause.getMessage();
251+
if (StringUtils.isBlank(message)) {
252+
return rootCause.getClass().getName();
253+
}
254+
return StrFormatter.format("{}: {}", rootCause.getClass().getName(), message);
255+
}
256+
249257
@Override
250258
public void killCluster() {
251259
log.info("Start kill cluster: " + config.getFlinkConfig().getJobName());

dinky-web/src/pages/RegCenter/Document/components/DocumentProTable/index.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,12 @@ const DocumentTableList: React.FC = () => {
120120
title: l('rc.doc.functionType'),
121121
sorter: true,
122122
dataIndex: 'type',
123-
filterMultiple: true,
124-
filters: true,
125123
valueEnum: DOCUMENT_TYPE_ENUMS
126124
},
127125
{
128126
title: l('rc.doc.subFunctionType'),
129127
sorter: true,
130128
dataIndex: 'subtype',
131-
filters: true,
132-
filterMultiple: true,
133129
valueEnum: DOCUMENT_FUNCTION_TYPE_ENUMS,
134130
renderFormItem: (item, { type }, form) => {
135131
const currentType = form.getFieldValue('type');
@@ -141,8 +137,6 @@ const DocumentTableList: React.FC = () => {
141137
title: l('rc.doc.category'),
142138
sorter: true,
143139
dataIndex: 'category',
144-
filterMultiple: true,
145-
filters: true,
146140
valueEnum: DOCUMENT_CATEGORY_ENUMS
147141
},
148142
{
@@ -174,11 +168,11 @@ const DocumentTableList: React.FC = () => {
174168
{
175169
title: l('global.table.isEnable'),
176170
dataIndex: 'enabled',
177-
hideInSearch: true,
178-
filters: STATUS_MAPPING(),
179-
filterMultiple: false,
180171
hideInDescriptions: true,
181-
valueEnum: STATUS_ENUM(),
172+
valueType: 'select',
173+
valueEnum: Object.fromEntries(
174+
STATUS_MAPPING().map(item => [item.value, { text: item.text, status: item.value === 1 ? 'Success' : 'Error' }])
175+
),
182176
render: (_, record) => {
183177
return (
184178
<EnableSwitchBtn

e2e_test/tools/env.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ def addStandaloneCluster(session: Session) -> int:
3333

3434
def addApplicationCluster(session: Session, params: dict) -> Optional[int]:
3535
name = params['name']
36-
test_connection_yarn_resp = session.post(url("api/clusterConfiguration/testConnect"), json=params)
37-
assertRespOk(test_connection_yarn_resp, "Test yarn connectivity")
38-
test_connection_yarn_resp = session.put(url("api/clusterConfiguration/saveOrUpdate"), json=params)
39-
assertRespOk(test_connection_yarn_resp, "Add Yarn Application Cluster")
36+
cluster_type = params["type"]
37+
test_connection_resp = session.post(url("api/clusterConfiguration/testConnect"), json=params)
38+
assertRespOk(test_connection_resp, f"Test {cluster_type} connectivity")
39+
save_cluster_resp = session.put(url("api/clusterConfiguration/saveOrUpdate"), json=params)
40+
assertRespOk(save_cluster_resp, f"Add {cluster_type} cluster")
4041
get_app_list = session.get(url(f"api/clusterConfiguration/list?keyword={name}"), json=params)
41-
assertRespOk(get_app_list, "Get Yarn Application Cluster")
42+
assertRespOk(get_app_list, f"Get {cluster_type} cluster")
4243
for data in get_app_list.json()["data"]:
4344
if data["name"] == name:
4445
return data['id']

0 commit comments

Comments
 (0)