-
Notifications
You must be signed in to change notification settings - Fork 326
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 more metadata about the target if possible #447
Conversation
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.
Thanks for the PR! Can you write tests for the changes as well please.
catalog/to-consul/resource.go
Outdated
for k, v := range baseService.Meta { | ||
r.Service.Meta[k] = v | ||
} |
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.
Consul metadata has some specific rules that must be followed so we can't map directly:
The meta object is a map of max 64 key/values with string semantics. Key can contain only ASCII chars and no special characters (A-Z a-z 0-9 _ and -). For performance and security reasons, values as well as keys are limited to 128 characters for keys, 512 for values. This object has the same limitations as the node meta object in node definition. All those meta data can be retrieved individually per instance of the service and all the instances of a given service have their own copy of it.
New create-federation-secret job
@lkysow updated the PR with your comments. Sorry for the |
@geobeau would you be able to rebase off of |
Done |
Maybe I can try to close the PR and repoen it if it still doesn't work |
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.
Looks pretty good. Don't worry about the tests, we need to fix them.
@@ -1601,6 +1634,7 @@ func createNodes(t *testing.T, client *fake.Clientset) (*apiv1.Node, *apiv1.Node | |||
func createEndpoints(t *testing.T, client *fake.Clientset, serviceName string, namespace string) { | |||
node1 := nodeName1 | |||
node2 := nodeName2 | |||
target_ref := apiv1.ObjectReference{Kind: "pod", Name: "foobar"} |
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.
target_ref := apiv1.ObjectReference{Kind: "pod", Name: "foobar"} | |
targetRef := apiv1.ObjectReference{Kind: "pod", Name: "foobar"} |
target_ref := apiv1.ObjectReference{Kind: "pod", Name: "foobar"} | |
target_ref := apiv1.ObjectReference{Kind: "pod", Name: "foobar"} |
@@ -1612,7 +1646,7 @@ func createEndpoints(t *testing.T, client *fake.Clientset, serviceName string, n | |||
Subsets: []apiv1.EndpointSubset{ | |||
{ | |||
Addresses: []apiv1.EndpointAddress{ | |||
{NodeName: &node1, IP: "1.1.1.1"}, | |||
{NodeName: &node1, IP: "1.1.1.1", TargetRef: &target_ref}, |
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.
{NodeName: &node1, IP: "1.1.1.1", TargetRef: &target_ref}, | |
{NodeName: &node1, IP: "1.1.1.1", TargetRef: &targetRef}, |
{NodeName: &node1, IP: "1.1.1.1", TargetRef: &target_ref}, | |
{NodeName: &node1, IP: "1.1.1.1", TargetRef: &target_ref}, |
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.
Done
@@ -1612,7 +1646,7 @@ func createEndpoints(t *testing.T, client *fake.Clientset, serviceName string, n | |||
Subsets: []apiv1.EndpointSubset{ | |||
{ | |||
Addresses: []apiv1.EndpointAddress{ | |||
{NodeName: &node1, IP: "1.1.1.1"}, | |||
{NodeName: &node1, IP: "1.1.1.1", TargetRef: &target_ref}, |
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.
{NodeName: &node1, IP: "1.1.1.1", TargetRef: &target_ref}, | |
{NodeName: &node1, IP: "1.1.1.1", TargetRef: &targetRef}, |
{NodeName: &node1, IP: "1.1.1.1", TargetRef: &target_ref}, | |
{NodeName: &node1, IP: "1.1.1.1", TargetRef: &target_ref}, |
require.NotContains(r, ConsulK8SRefValue, actual[0].Service.Meta) | ||
require.NotContains(r, ConsulK8SRefKind, actual[0].Service.Meta) |
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.
What is this testing?
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.
Actually it was a mistake, I redid it and added a comment. It was supposed to test that the second service didn't contain incorrect refs
@@ -1601,6 +1634,7 @@ func createNodes(t *testing.T, client *fake.Clientset) (*apiv1.Node, *apiv1.Node | |||
func createEndpoints(t *testing.T, client *fake.Clientset, serviceName string, namespace string) { | |||
node1 := nodeName1 | |||
node2 := nodeName2 | |||
target_ref := apiv1.ObjectReference{Kind: "pod", Name: "foobar"} |
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.
target_ref := apiv1.ObjectReference{Kind: "pod", Name: "foobar"} | |
targetRef := apiv1.ObjectReference{Kind: "pod", Name: "foobar"} |
target_ref := apiv1.ObjectReference{Kind: "pod", Name: "foobar"} | |
target_ref := apiv1.ObjectReference{Kind: "pod", Name: "foobar"} |
Changes proposed in this PR:
How I've tested this PR:
Checklist: