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

The grpc config should change some values ? #109

Open
cyxinda opened this issue Sep 26, 2023 · 0 comments
Open

The grpc config should change some values ? #109

cyxinda opened this issue Sep 26, 2023 · 0 comments

Comments

@cyxinda
Copy link

cyxinda commented Sep 26, 2023

case 1:

If the alpha grpc service is accessed using ingress, the nginx(ingress) should be added some annotations, otherwise the grpc service will not be normally accessible by the client. These annotations are as follow:

  ingress_grpc:
    enabled: true
    ingressClassName: nginx
    hostname: "grpc-dgraph.knowdee.com"
    annotations: 
      nginx.ingress.kubernetes.io/backend-protocol: GRPC
      nginx.ingress.kubernetes.io/ssl-redirect: "true"
    tls: 
    - hosts: 
      - grpc-dgraph.knowdee.com
      secretName: dgraph-dgraph-alpha-tls-secret

My java client is :

import io.dgraph.DgraphClient;
import io.dgraph.DgraphGrpc;
import io.dgraph.DgraphProto;
import io.dgraph.Transaction;
import io.grpc.ManagedChannel;
import io.grpc.netty.GrpcSslContexts;
import io.grpc.netty.NettyChannelBuilder;
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import lombok.extern.slf4j.Slf4j;
import javax.net.ssl.SSLException;
import java.util.HashMap;
import java.util.Map;
@Slf4j
public class Dgraph {
    public static void main(String[] args) throws SSLException {
        SslContextBuilder builder = GrpcSslContexts.forClient();
        SslContext sslContext = builder.build();
        ManagedChannel channel = NettyChannelBuilder.forAddress("grpc-dgraph.knowdee.com", 443)
                .sslContext(sslContext)
                .build();
        DgraphGrpc.DgraphStub stub = DgraphGrpc.newStub(channel);
        DgraphClient dgraphClient = new DgraphClient(stub);
        DgraphProto.Version v = dgraphClient.checkVersion();
        log.info("dgraph version is {}",v.getTag());
        String json = "{    findNames(func: has(name)){            name     }    }";
        Map<String, String> vars = new HashMap<>();
        try (Transaction transaction = dgraphClient.newReadOnlyTransaction()) {
            DgraphProto.Response response = transaction.queryWithVars(json, vars);
            String result = response.getJson().toStringUtf8();
            log.info("result is {}",result);
        }
    }
}

case 2:

the value of type should be type: kubernetes.io/tls not type: Opaque in the file of dgraph/templates/alpha/secret-tls.yaml and dgraph/templates/zero/dgraph/templates/zero .
When I use tls certificate with base64 encode, the Opaque value will cause tls certificate of ingress is invalid .
截图 2023-09-26 15-49-23
截图 2023-09-26 15-46-08

the helm chart version is dgraph/dgraph:0.2.2 .

root@oldsix:/data2/tmp/dgraph/package# helm search repo dgraph
NAME                    CHART VERSION   APP VERSION     DESCRIPTION                                       
dgraph/dgraph           0.2.2           v23.0.1         Dgraph is a horizontally scalable and distribut...
dgraph/dgraph-lambda    0.0.2           v1.2.4          Serverless platform for running JavaScript on S...
dgraph/ratel            0.1.1           v21.12.0        A Helm chart for Kubernetes 

All.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant