Skip to content

KGLOBAL-1755: Add link error fields to cluster linking list CLI operation#1435

Merged
Andrew Grant (andrewgrantcflt) merged 5 commits intomainfrom
KGLOBAL-1755
Sep 14, 2022
Merged

KGLOBAL-1755: Add link error fields to cluster linking list CLI operation#1435
Andrew Grant (andrewgrantcflt) merged 5 commits intomainfrom
KGLOBAL-1755

Conversation

@andrewgrantcflt
Copy link
Member

@andrewgrantcflt Andrew Grant (andrewgrantcflt) commented Sep 14, 2022

JIRA

https://confluentinc.atlassian.net/browse/KGLOBAL-1755

Details

Updates the CLI to handle the new link error fields introduced. I tested running the CLI against a cluster in prod that doesnt have the REST changes to make sure it works against clusters without the new changes and thus is backwards compatible.

The cloud SDK was updated in confluentinc/ccloud-sdk-go-v2#53.

Testing

Ran make test after updating the golden files

Checklist

  1. [CRUCIAL] Is the change for CP or CCloud functionalities that are already live in prod?
    • yes: ok
    • no: DO NOT MERGE until the required functionalites are live in prod

What

References

Test & Review

Comment on lines +19 to +21
LinkState string
LinkError string
LinkErrorMessage string

Choose a reason for hiding this comment

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

Let's add these fields to confluent kafka link describe too?

Choose a reason for hiding this comment

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

The describe command actually maps to getting the link config i.e. adminClient.describeConfigs so we can't return this data for it.

Copy link

@brianstrauch Brian Strauch (brianstrauch) Sep 14, 2022

Choose a reason for hiding this comment

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

Oh, interesting. Maybe that should've been put in confluent kafka link configuration list.

Choose a reason for hiding this comment

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

Yeah I'd probably agree. In fact confluent kafka link list ultimately calls adminClient.describeClusterLinks which is a bit confusing. We might want to do some refactoring at some point.

Choose a reason for hiding this comment

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

This would be a breaking change, so I'll add a note about it to our confluent v3 wiki page.

Copy link
Member Author

@andrewgrantcflt Andrew Grant (andrewgrantcflt) Sep 14, 2022

Choose a reason for hiding this comment

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

What's the breaking change here?

Choose a reason for hiding this comment

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

Renaming confluent kafka link describe to confluent kafka link configuration list

Choose a reason for hiding this comment

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

Yeah it would be. We aren't actively working on doing that as of now, just to clarify.

------------+-------------------+-------------------------
link-1 | cluster-1 | cluster-2
link-2 | cluster-1 | cluster-2
Link Name | Source Cluster Id | Destination Cluster Id | Link State | Link Error | Link Error Message

Choose a reason for hiding this comment

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

It seems redundant to be prefixing all of these new fields with "Link"... the user knows they're getting information on links since they ran confluent kafka link list to get this output. Why not call these "State", "Error", and "Error Message"?

Choose a reason for hiding this comment

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

We're also running out of horizontal space 😄

Choose a reason for hiding this comment

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

Agreed. Let me try and trim those names that start with Link

@andrewgrantcflt
Copy link
Member Author

The Mac build is failing with:

make depsFailed in 
00:02
go install github.com/goreleaser/goreleaser@v1.4.1 && \00:01
	go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.0 && \00:01
	go install github.com/mitchellh/golicense@v0.2.0 && \00:01
	go install gotest.tools/gotestsum@v1.8.200:02
# golang.org/x/sys/unix00:02
../go/1.18.0/pkg/mod/golang.org/x/sys@v0.0.0-20190312061237-fead79001313/unix/zsyscall_darwin_amd64.go:28:3: //go:linkname must refer to declared function or variable00:02
../go/1.18.0/pkg/mod/golang.org/x/sys@v0.0.0-20190312061237-fead79001313/unix/zsyscall_darwin_amd64.go:43:3: //go:linkname must refer to declared function or variable00:02
../go/1.18.0/pkg/mod/golang.org/x/sys@v0.0.0-20190312061237-fead79001313/unix/zsyscall_darwin_amd64.go:59:3: //go:linkname must refer to declared function or variable00:02
../go/1.18.0/pkg/mod/golang.org/x/sys@v0.0.0-20190312061237-fead79001313/unix/zsyscall_darwin_amd64.go:75:3: //go:linkname must refer to declared function or variable00:02
../go/1.18.0/pkg/mod/golang.org/x/sys@v0.0.0-20190312061237-fead79001313/unix/zsyscall_darwin_amd64.go:90:3: //go:linkname must refer to declared function or variable00:02
../go/1.18.0/pkg/mod/golang.org/x/sys@v0.0.0-20190312061237-fead79001313/unix/zsyscall_darwin_amd64.go:105:3: //go:linkname must refer to declared function or variable00:02
../go/1.18.0/pkg/mod/golang.org/x/sys@v0.0.0-20190312061237-fead79001313/unix/zsyscall_darwin_amd64.go:121:3: //go:linkname must refer to declared function or variable00:02
../go/1.18.0/pkg/mod/golang.org/x/sys@v0.0.0-20190312061237-fead79001313/unix/zsyscall_darwin_amd64.go:136:3: //go:linkname must refer to declared function or variable00:02
../go/1.18.0/pkg/mod/golang.org/x/sys@v0.0.0-20190312061237-fead79001313/unix/zsyscall_darwin_amd64.go:151:3: //go:linkname must refer to declared function or variable00:02
../go/1.18.0/pkg/mod/golang.org/x/sys@v0.0.0-20190312061237-fead79001313/unix/zsyscall_darwin_amd64.go:166:3: //go:linkname must refer to declared function or variable

Brian Strauch (@brianstrauch) any chance you've seen this before?

@andrewgrantcflt
Copy link
Member Author

Per https://stackoverflow.com/questions/71507321/go-1-18-build-error-on-mac-unix-syscall-darwin-1-13-go253-golinkname-mus I'll try updating golang.org/x/sys

Comment on lines +8 to +9
"github.com/spf13/cobra"
"strings"

Choose a reason for hiding this comment

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

Can you group these imports separately?

Choose a reason for hiding this comment

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

Updated to:

import (
	"strings"

	kafkarestv3 "github.com/confluentinc/ccloud-sdk-go-v2/kafkarest/v3"
	"github.com/spf13/cobra"

	pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
	"github.com/confluentinc/cli/internal/pkg/errors"
	"github.com/confluentinc/cli/internal/pkg/output"
)

Comment on lines +19 to +21
LinkState string
LinkError string
LinkErrorMessage string

Choose a reason for hiding this comment

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

Renaming confluent kafka link describe to confluent kafka link configuration list

camelToSpacedListFields := camelToSpaced(listFields)
var humanLabels []string
for _, humanLabel := range camelToSpacedListFields {
humanLabels = append(humanLabels, strings.TrimPrefix(humanLabel, "Link "))

Choose a reason for hiding this comment

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

We should remove the prefix in the JSON and YAML output too (and in the struct fields, so this edge case doesn't need to be hardcoded)

Choose a reason for hiding this comment

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

Are programs supposed to consume the JSON and YAML output? I'm wondering if we should actually leave Link in tbh otherwise we become inconsistent with basically all the other APIs (REST, AdminClient, RPC).

For just the human readable part I understand wanting to remove the redundancy but if programs are supposed to parse the JSON and YAML I think I'd prefer to stay consistent with the other interfaces.

Choose a reason for hiding this comment

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

+1 if this is how the fields are named in the API

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.

2 participants