-
Notifications
You must be signed in to change notification settings - Fork 106
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
[Feat] liqoctl gateway template check #2791
base: master
Are you sure you want to change the base?
Conversation
Hi @cheina97. Thanks for your PR! I am @adamjensenbot.
Make sure this PR appears in the liqo changelog, adding one of the following labels:
|
51ea3b0
to
675d0dd
Compare
675d0dd
to
1f68d98
Compare
@@ -36,6 +36,7 @@ spec: | |||
- port: "{{"{{ .Spec.Endpoint.Port }}"}}" | |||
protocol: UDP | |||
targetPort: "{{"{{ .Spec.Endpoint.Port }}"}}" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should align this file to the eks one also on what concerns empty lines
if err := cluster1.CheckTemplateGwClient(ctx, o); err != nil { | ||
return err | ||
} | ||
|
||
// Check if the Templates exists and is valid on cluster 2 | ||
if err := cluster2.CheckTemplateGwServer(ctx, o); err != nil { | ||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a flag to skip these checks
|
||
// GetNestedField returns the nested field of a map. | ||
// Example: GetNestedField(map[string]interface{}{"a": map[string]interface{}{"b": "c"}}, "a.b") returns "c". | ||
func GetNestedField(m map[string]interface{}, path string) (interface{}, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In modern go, I think any
type is identical to interface{}
and more idiomatic. Not entirely sure about this
|
||
_, err = maps.GetNestedField(port, "nodePort") | ||
if err != nil { | ||
return fmt.Errorf("unable to get spec.template.spec.service.spec.ports[0].nodePort int the server template, " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we add a flag to skip this check (as suggested by aleoli), we can add a suggestion of how to skip this check. Morevoer, we might also add a documentation page explaining the concept of template and how to add a field in the template, so that we can add a link to it in the error message
1f68d98
to
7d0788e
Compare
Description
This PR adds some checks in liqoctl (at peering time) about the gateway template used.
This checks are:
--server-service-nodeport
flag has been specified, it checks if the template selected support static nodeports--server-service-loadbalancerip
flag has been specified, it checks if the template selected support static load balancer ips