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

Add documentation on creating custom endpoints #261

Open
glazychev-art opened this issue Nov 20, 2023 · 3 comments
Open

Add documentation on creating custom endpoints #261

glazychev-art opened this issue Nov 20, 2023 · 3 comments
Assignees

Comments

@glazychev-art
Copy link
Contributor

Description

For various reasons, current standard applications may not meet user requirements. We need to provide a description and instructions how to create a custom endpoint

@316953425
Copy link

316953425 commented Dec 22, 2023

hi @glazychev-art @denis-tingaikin
I noticed that @d-uzlov has put the how to customize endpoint task in the In Progress state. I looked at the task status (https://github.com/orgs/networkservicemesh/projects/22/views/1) and I noticed The remaining time is only 0.5 hours. I guess you may have completed write the relevant documents. I would like to ask if the relevant introductory documents have been completed now. If so, can you send me the information? I'm very sorry to say I couldn't find the location of the relevant documents,
Our company appreciate the nsm project very much and I am like to learn it
As a first time user of Go and k8s, it is too difficult for me without documentation. I would be very grateful for any help you can give me.
1703229248723

@denis-tingaikin
Copy link
Member

Hello @316953425

I've posted current version of this doc #261.

If you will have a time please have a look and let us know what things should be covered and we'll do improvements ;)

Preview: https://deploy-preview-266--nsm.netlify.app/docs/concepts/features/develop_nse

@316953425
Copy link

316953425 commented Dec 25, 2023

hi @denis-tingaikin
I think what you are doing is very important to the nsm community. It can help new people learn and understand nsm.
thanks a lot

My suggestion:
I think it might be easier for a newcomer to start with a simple example, such as (https://github.com/networkservicemesh/cmd-nse-icmp-responder/blob/main/main.go)
In the process of explaining this example, you can explain some core concepts in nsm
such as chain element mentioned in https://deploy-preview-266--nsm.netlify.app/docs/concepts/features/develop_nse and give examples.
Fox example:What does this code as followed mainly do?

	clientOptions := append(
		tracing.WithTracingDial(),
		grpc.WithBlock(),
		grpc.WithDefaultCallOptions(
			grpc.WaitForReady(true),
			grpc.PerRPCCredentials(token.NewPerRPCCredentials(spiffejwt.TokenGeneratorFunc(source, config.MaxTokenLifetime)))),
		grpc.WithTransportCredentials(
			grpcfd.TransportCredentials(
				credentials.NewTLS(
					tlsClientConfig,
				),
			),
		),
		grpcfd.WithChainStreamInterceptor(),
		grpcfd.WithChainUnaryInterceptor(),
	)

	if config.RegisterService {
		for _, serviceName := range config.ServiceNames {
			nsRegistryClient := registryclient.NewNetworkServiceRegistryClient(ctx,
				registryclient.WithClientURL(&config.ConnectTo),
				registryclient.WithDialOptions(clientOptions...),
				registryclient.WithAuthorizeNSRegistryClient(registryauthorize.NewNetworkServiceRegistryClient(
					registryauthorize.WithPolicies(config.RegistryClientPolicies...))))
			_, err = nsRegistryClient.Register(ctx, &registryapi.NetworkService{
				Name:    serviceName,
				Payload: config.Payload,
			})

			if err != nil {
				log.FromContext(ctx).Fatalf("unable to register ns %+v", err)
			}
		}
	}

	nseRegistryClient := registryclient.NewNetworkServiceEndpointRegistryClient(
		ctx,
		registryclient.WithClientURL(&config.ConnectTo),
		registryclient.WithDialOptions(clientOptions...),
		registryclient.WithNSEAdditionalFunctionality(
			clientinfo.NewNetworkServiceEndpointRegistryClient(),
			registrysendfd.NewNetworkServiceEndpointRegistryClient(),
		),
		registryclient.WithAuthorizeNSERegistryClient(registryauthorize.NewNetworkServiceEndpointRegistryClient(
			registryauthorize.WithPolicies(config.RegistryClientPolicies...))),
	)
	nse := getNseEndpoint(config, listenOn)
	nse, err = nseRegistryClient.Register(ctx, nse)
	logrus.Infof("nse: %+v", nse)

This is a document on how to develop the first module of nginx. I think this is a better way to get started. I hope you can refer to it. Thank you very much for your work.
https://tejgop.github.io/nginx-module-guide/#the-c-file

@denis-tingaikin denis-tingaikin moved this from In Progress to Under review in Release v1.12.0 Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Under review
Development

No branches or pull requests

3 participants