@Override
    public ShenyuMemoryConfig parse(final V1Ingress ingress, final CoreV1Api coreV1Api) {
        ShenyuMemoryConfig res = new ShenyuMemoryConfig();

        if (Objects.nonNull(ingress.getSpec())) {
            // Parse the webSocket backend
            V1IngressBackend webSocketBackend = ingress.getSpec().getDefaultBackend();
            List<V1IngressRule> rules = ingress.getSpec().getRules();
            List<V1IngressTLS> tlsList = ingress.getSpec().getTls();

            String namespace = Objects.requireNonNull(ingress.getMetadata()).getNamespace();
            List<WebSocketUpstream> webSocketUpstreamList = parseDefaultWebSocketService(webSocketBackend, namespace);

            if (Objects.isNull(rules) || CollectionUtils.isEmpty(rules)) {
                // if rules is null, defaultBackend become global default
                if (Objects.nonNull(webSocketBackend) && Objects.nonNull(webSocketBackend.getService())) {
                    IngressConfiguration defaultRouteConfig = getDefaultRouteConfig(webSocketUpstreamList, ingress.getMetadata().getAnnotations());
                    res.setGlobalDefaultBackend(Pair.of(Pair.of(namespace + "/" + ingress.getMetadata().getName(), webSocketBackend.getService().getName()),
                            defaultRouteConfig));
                }
            } else {
                // if rules is not null, defaultBackend is default in this ingress
                List<IngressConfiguration> routeList = new ArrayList<>(rules.size());
                for (V1IngressRule ingressRule : rules) {
                    List<IngressConfiguration> routes = parseIngressRule(ingressRule, webSocketUpstreamList,
                            Objects.requireNonNull(ingress.getMetadata()).getNamespace(), ingress.getMetadata().getAnnotations());
                    routeList.addAll(routes);
                }
                res.setRouteConfigList(routeList);
            }

            // Parse tls
            if (Objects.nonNull(tlsList) && CollectionUtils.isNotEmpty(tlsList)) {
                List<SslCrtAndKeyStream> sslList = new ArrayList<>();
                for (V1IngressTLS tls : tlsList) {
                    String secretName = tls.getSecretName();
                    List<String> hosts = tls.getHosts();
                    if (Objects.nonNull(secretName) && CollectionUtils.isNotEmpty(hosts)) {
                        try {
                            V1Secret secret = coreV1Api.readNamespacedSecret(secretName, namespace, "ture");
                            if (Objects.nonNull(secret.getData())) {
                                InputStream keyCertChainInputStream = new ByteArrayInputStream(secret.getData().get("tls.crt"));
                                InputStream keyInputStream = new ByteArrayInputStream(secret.getData().get("tls.key"));
                                hosts.forEach(host ->
                                        sslList.add(new SslCrtAndKeyStream(host, keyCertChainInputStream, keyInputStream))
                                );
                            }
                        } catch (ApiException e) {
                            LOG.error("parse tls failed ", e);
                        }
                    }
                }
                res.setTlsConfigList(sslList);
            }
        }
        return res;
    }
Parse ingress to ShenyuMemoryConfig.

@param ingress ingress resource
@param coreV1Api coreV1Api
@return ShenyuMemoryConfig
shenyu-kubernetes-controller/src/main/java/org/apache/shenyu/k8s/parser/WebSocketParser.java