From a2e6332aaaaebf497b8c27be3feb032651c565a0 Mon Sep 17 00:00:00 2001 From: Shakeel Rao Date: Mon, 21 Oct 2024 14:39:05 -0400 Subject: [PATCH 1/4] format auth methods --- app/namespace.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/namespace.go b/app/namespace.go index f318ff1..ca1f781 100644 --- a/app/namespace.go +++ b/app/namespace.go @@ -48,6 +48,15 @@ const ( AuthMethodAPIKeyOrMTLS = "api_key_or_mtls" ) +var ( + AuthMethods = []string{ + AuthMethodRestricted, + AuthMethodMTLS, + AuthMethodAPIKey, + AuthMethodAPIKeyOrMTLS, + } +) + var ( CaCertificateFlag = &cli.StringFlag{ Name: CaCertificateFlagName, @@ -927,7 +936,8 @@ func NewNamespaceCommand(getNamespaceClientFn GetNamespaceClientFn) (CommandOut, ResourceVersionFlag, &cli.StringFlag{ Name: authMethodFlagName, - Usage: "The authentication method used for the namespace (e.g. 'mtls', 'api_key')", + Aliases: []string{"am"}, + Usage: fmt.Sprintf("The authentication method used for the namespace (i.e. %s)", formatAuthMethods()), Required: true, }, }, @@ -1997,6 +2007,14 @@ func compareCodecSpec(existing, replacement *namespace.CodecServerPropertySpec) return diff.Diff(string(existingBytes), string(replacementBytes)), nil } +func formatAuthMethods() string { + var methods []string + for _, m := range AuthMethods { + methods = append(methods, fmt.Sprintf("'%s'", m)) + } + return strings.Join(methods, ", ") +} + func disruptiveChange(old namespace.AuthMethod, new namespace.AuthMethod) bool { return old != namespace.AUTH_METHOD_RESTRICTED && new != namespace.AUTH_METHOD_API_KEY_OR_MTLS } From bbb6aa9d7bc81b77bf9eff515cbf0660cc9bdc01 Mon Sep 17 00:00:00 2001 From: Shakeel Rao Date: Mon, 21 Oct 2024 15:53:45 -0400 Subject: [PATCH 2/4] skip protogen dir --- .golangci.yaml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .golangci.yaml diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..9aad802 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,2 @@ +exclude_dirs: + - protogen From 460477877c98fcebd7bcffce80ae82ba9ac833d8 Mon Sep 17 00:00:00 2001 From: Shakeel Rao Date: Mon, 21 Oct 2024 15:57:50 -0400 Subject: [PATCH 3/4] verbose: temp --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a2c69e8..aa21137 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ tools: @go install github.com/golang/mock/mockgen@latest lint: - golangci-lint run + golangci-lint run --verbose $(COVER_ROOT): @mkdir -p $(COVER_ROOT) From dc46cf7239ce7bfd52f13d3d07d9fd27dd7ff63d Mon Sep 17 00:00:00 2001 From: Shakeel Rao Date: Mon, 21 Oct 2024 16:08:28 -0400 Subject: [PATCH 4/4] upgrade lint version --- .golangci.yaml | 2 -- Makefile | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 .golangci.yaml diff --git a/.golangci.yaml b/.golangci.yaml deleted file mode 100644 index 9aad802..0000000 --- a/.golangci.yaml +++ /dev/null @@ -1,2 +0,0 @@ -exclude_dirs: - - protogen diff --git a/Makefile b/Makefile index aa21137..7258a08 100644 --- a/Makefile +++ b/Makefile @@ -45,11 +45,11 @@ release: $(call build,tcld,windows,amd64,.exe) tools: - @go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2 + @go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.1 @go install github.com/golang/mock/mockgen@latest lint: - golangci-lint run --verbose + golangci-lint run $(COVER_ROOT): @mkdir -p $(COVER_ROOT)