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

Initial cmd state #3

Merged
merged 9 commits into from
May 13, 2022
Merged

Conversation

rejmond
Copy link

@rejmond rejmond commented May 10, 2022

Signed-off-by: Sergey Shlyanin sergey.shlyanin@xored.com

Description

Clone cmd-nse-icmp-responder repository content and rename package to nse-istio-proxy.

Sergey Shlyanin added 2 commits May 10, 2022 13:35
Signed-off-by: Sergey Shlyanin <sergey.shlyanin@xored.com>
Signed-off-by: Sergey Shlyanin <sergey.shlyanin@xored.com>
main.go Outdated
ConnectTo url.URL `default:"unix:///var/lib/networkservicemesh/nsm.io.sock" desc:"url to connect to" split_words:"true"`
MaxTokenLifetime time.Duration `default:"10m" desc:"maximum lifetime of tokens" split_words:"true"`
ServiceNames []string `default:"istio-proxy-responder" desc:"Name of provided services" split_words:"true"`
Payload string `default:"ETHERNET" desc:"Name of provided service payload" split_words:"true"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Payload should always be IP for this NSE.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. IP contants is used now in the registry client.

Payload string `default:"ETHERNET" desc:"Name of provided service payload" split_words:"true"`
Labels map[string]string `default:"" desc:"Endpoint labels"`
DNSConfigs dnstools.Decoder `default:"[]" desc:"DNSConfigs represents array of DNSConfig in json format. See at model definition: https://github.com/networkservicemesh/api/blob/main/pkg/api/networkservice/connectioncontext.pb.go#L426-L435" split_words:"true"`
CidrPrefix []string `default:"169.254.0.0/16" desc:"List of CIDR Prefix to assign IPv4 and IPv6 addresses from" split_words:"true"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/networkservicemesh/api/blob/main/pkg/api/networkservice/connectioncontext.pb.go#L426-L435 will move as main moves, use an absolute reference to a tag or commit for this comment.

main.go Outdated
DNSConfigs dnstools.Decoder `default:"[]" desc:"DNSConfigs represents array of DNSConfig in json format. See at model definition: https://github.com/networkservicemesh/api/blob/main/pkg/api/networkservice/connectioncontext.pb.go#L426-L435" split_words:"true"`
CidrPrefix []string `default:"169.254.0.0/16" desc:"List of CIDR Prefix to assign IPv4 and IPv6 addresses from" split_words:"true"`
IdleTimeout time.Duration `default:"0" desc:"timeout for automatic shutdown when there were no requests for specified time. Set 0 to disable auto-shutdown." split_words:"true"`
RegisterService bool `default:"true" desc:"if true then registers network service on startup" split_words:"true"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would this be false?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Removed this option.

main.go Outdated
CidrPrefix []string `default:"169.254.0.0/16" desc:"List of CIDR Prefix to assign IPv4 and IPv6 addresses from" split_words:"true"`
IdleTimeout time.Duration `default:"0" desc:"timeout for automatic shutdown when there were no requests for specified time. Set 0 to disable auto-shutdown." split_words:"true"`
RegisterService bool `default:"true" desc:"if true then registers network service on startup" split_words:"true"`
PBRConfigPath string `default:"/etc/policy-based-routing/config.yaml" desc:"Path to policy based routing config file" split_words:"true"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We aren't doing configurable PBR for this NSE.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Removed all PBR related functions and variables.

main.go Outdated
log.FromContext(ctx).Infof("the phases include:")
log.FromContext(ctx).Infof("1: get config from environment")
log.FromContext(ctx).Infof("2: retrieve spiffe svid")
log.FromContext(ctx).Infof("3: create icmp server ipam")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should fix the text here as its not icmp server. I'd suggest just changing it to 'create ipam' (and below to 'create nse'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rejmond Could you resolve the comment?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

main.go Outdated
}

// newPolicyRoutesGetter - watches the config file and dynamically updates policy routes.
func newPolicyRoutesGetter(ctx context.Context, configPath string) *policyRoutesGetter {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole function is probably unneeded in this NSE.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

main.go Outdated
return p
}

func (p *policyRoutesGetter) Get() []*networkservice.PolicyRoute {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole function is probably unneeded in this NSE

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

main.go Outdated
return p.policyRoutes.Load().([]*networkservice.PolicyRoute)
}

type policyRoutesGetter struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably unneeded in this NSE

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@rejmond rejmond marked this pull request as draft May 10, 2022 15:14
@rejmond
Copy link
Author

rejmond commented May 10, 2022

@edwarnicke Thank you for your comments, I will check everything.

Sergey Shlyanin added 4 commits May 11, 2022 15:12
Signed-off-by: Sergey Shlyanin <sergey.shlyanin@xored.com>
Signed-off-by: Sergey Shlyanin <sergey.shlyanin@xored.com>
Signed-off-by: Sergey Shlyanin <sergey.shlyanin@xored.com>
Signed-off-by: Sergey Shlyanin <sergey.shlyanin@xored.com>
@rejmond rejmond force-pushed the icmp-clone branch 11 times, most recently from 1be608c to ce964d6 Compare May 13, 2022 14:00
Signed-off-by: Sergey Shlyanin <sergey.shlyanin@xored.com>
@rejmond rejmond marked this pull request as ready for review May 13, 2022 14:09
Copy link
Member

@denis-tingaikin denis-tingaikin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rejmond Please resolve @edwarnicke comment and this can be merged. Thanks.

Sergey Shlyanin added 2 commits May 13, 2022 21:25
Signed-off-by: Sergey Shlyanin <sergey.shlyanin@xored.com>
Signed-off-by: Sergey Shlyanin <sergey.shlyanin@xored.com>
@denis-tingaikin
Copy link
Member

@edwarnicke Let us know if you still have any comments on this then we'll resolve them in separate PR.

@denis-tingaikin denis-tingaikin merged commit 1d61034 into networkservicemesh:main May 13, 2022
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

Successfully merging this pull request may close these issues.

3 participants