Skip to content
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

fix: Reload registry TLS certificate when it is updated on the file system #805

Merged
merged 3 commits into from
Nov 11, 2024
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
2 changes: 1 addition & 1 deletion cmd/mindthegap/create/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func NewCommand(out output.Output) *cobra.Command {
return fmt.Errorf("failed to create local Docker registry: %w", err)
}
go func() {
if err := reg.ListenAndServe(); err != nil {
if err := reg.ListenAndServe(output.NewOutputLogr(out)); err != nil {
out.Error(err, "error serving Docker registry")
os.Exit(2)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/mindthegap/importcmd/imagebundle/image_bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func NewCommand(out output.Output) *cobra.Command {
return fmt.Errorf("failed to create local Docker registry: %w", err)
}
go func() {
if err := reg.ListenAndServe(); err != nil {
if err := reg.ListenAndServe(output.NewOutputLogr(out)); err != nil {
out.Error(err, "error serving Docker registry")
os.Exit(2)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/mindthegap/push/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func NewCommand(out output.Output, bundleCmdName string) *cobra.Command {
return fmt.Errorf("failed to create local Docker registry: %w", err)
}
go func() {
if err := reg.ListenAndServe(); err != nil {
if err := reg.ListenAndServe(output.NewOutputLogr(out)); err != nil {
out.Error(err, "error serving Docker registry")
os.Exit(2)
}
Expand Down
11 changes: 11 additions & 0 deletions cmd/mindthegap/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"

"github.com/spf13/cobra"
ctrllog "sigs.k8s.io/controller-runtime/pkg/log"

"github.com/mesosphere/dkp-cli-runtime/core/cmd/root"
"github.com/mesosphere/dkp-cli-runtime/core/output"
Expand All @@ -19,6 +20,12 @@ import (
"github.com/mesosphere/mindthegap/cmd/mindthegap/serve"
)

const (
// MinimumVerbosityForControllerRuntimeMessages is the minimum verbosity at which controller-runtime
// log messages are included in the output. Set to >= 1 to exclude from default output.
MinimumVerbosityForControllerRuntimeMessages = 1
)

func NewCommand(in io.Reader, out, errOut io.Writer) (*cobra.Command, output.Output) {
rootCmd, rootOpts := root.NewCommand(out, errOut)

Expand Down Expand Up @@ -53,6 +60,10 @@ func Execute() {
// disable cobra built-in error printing, we output the error with formatting.
rootCmd.SilenceErrors = true

// All packages in the controller-runtime module expect this logger to be
// defined within 30 seconds of initialization.
ctrllog.SetLogger(output.NewOutputLogr(out))

if err := rootCmd.Execute(); err != nil {
out.Error(err, "")
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion cmd/mindthegap/serve/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func NewCommand(
out.Infof("Listening on %s\n", reg.Address())

go func() {
if err := reg.ListenAndServe(); err != nil &&
if err := reg.ListenAndServe(output.NewOutputLogr(out)); err != nil &&
!errors.Is(err, http.ErrServerClosed) {
out.Error(err, "error serving Docker registry")
os.Exit(2)
Expand Down
Loading
Loading