Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Support for root certificate rotation via CLI #5207

Merged
merged 6 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ endif
LDFLAGS ?= "-X $(BUILD_DATE_VAR)=$(BUILD_DATE) -X $(BUILD_VERSION_VAR)=$(VERSION) -X $(BUILD_GITCOMMIT_VAR)=$(GIT_SHA) -s -w"

# These two values are combined and passed to go test
GO_TEST_FLAGS ?=
E2E_FLAGS ?= -installType=KindCluster
E2E_FLAGS_DEFAULT := -test.v -ginkgo.v -ginkgo.progress -ctrRegistry $(CTR_REGISTRY) -osmImageTag $(CTR_TAG)

Expand Down Expand Up @@ -152,7 +153,7 @@ kind-reset:
.PHONY: test-e2e
test-e2e: DOCKER_BUILDX_OUTPUT=type=docker
test-e2e: docker-build-osm build-osm docker-build-tcp-echo-server
go test ./tests/e2e $(E2E_FLAGS_DEFAULT) $(E2E_FLAGS)
go test $(GO_TEST_FLAGS) ./tests/e2e $(E2E_FLAGS_DEFAULT) $(E2E_FLAGS)

.env:
cp .env.example .env
Expand Down
26 changes: 26 additions & 0 deletions cmd/cli/alpha.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package main

import (
"fmt"
"io"

"github.com/spf13/cobra"
)

const alphaDescription = `
This command consists of multiple subcommands related that are in alpha.
`

func newAlphaCmd(out io.Writer) *cobra.Command {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have any other OSM CLI commands that we would characterize as "alpha" or could "preview" just be added in a warning for the command's help and output?

Copy link
Contributor Author

@jsturtevant jsturtevant Nov 14, 2022

Choose a reason for hiding this comment

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

good question, I am up for either and easy change to make. I modeled it after kubectl alpha which I like because it is very clear that is experimental when using it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like this approach, but I am curious to see what other maintainers think.

cmd := &cobra.Command{
Use: "alpha",
Short: "commands that are in alpha",
Long: alphaDescription,
Args: cobra.NoArgs,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
fmt.Fprintf(out, "*** This command is in Preview. Only run in dev/test environments ***\n")
},
}
cmd.AddCommand(newCertificateCmd(out))
return cmd
}
24 changes: 24 additions & 0 deletions cmd/cli/certificate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"io"

"github.com/spf13/cobra"
)

const certificateDescription = `
This command consists of multiple subcommands related to managing certificates
associated with osm installations.
`

func newCertificateCmd(out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "certificate",
Short: "commands for managing MeshRootCertificates",
Aliases: []string{"mrc"},
Long: certificateDescription,
Args: cobra.NoArgs,
}
cmd.AddCommand(newCertificateRotateCmd(out))
return cmd
}
Loading