Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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: 3 additions & 0 deletions cmd/cluster-bootstrap/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var (
requiredPodClauses []string
waitForTearDownEvent string
earlyTearDown bool
clusterProfile string
}
)

Expand All @@ -44,6 +45,7 @@ func init() {
cmdStart.Flags().StringSliceVar(&startOpts.requiredPodClauses, "required-pods", defaultRequiredPods, "List of pods name prefixes with their namespace (written as <namespace>/<pod-prefix>) that are required to be running and ready before the start command does the pivot, or alternatively a list of or'ed pod prefixes with a description (written as <desc>:<namespace>/<pod-prefix>|<namespace>/<pod-prefix>|...).")
cmdStart.Flags().StringVar(&startOpts.waitForTearDownEvent, "tear-down-event", "", "if this optional event name of the form <ns>/<event-name> is given, the event is waited for before tearing down the bootstrap control plane")
cmdStart.Flags().BoolVar(&startOpts.earlyTearDown, "tear-down-early", true, "tear down immediate after the non-bootstrap control plane is up and bootstrap-success event is created.")
cmdStart.Flags().StringVar(&startOpts.clusterProfile, "cluster-profile", "", "The cluster profile.")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what is this? What happens with the file? Add proper docs.

}

func runCmdStart(cmd *cobra.Command, args []string) error {
Expand All @@ -59,6 +61,7 @@ func runCmdStart(cmd *cobra.Command, args []string) error {
RequiredPodPrefixes: podPrefixes,
WaitForTearDownEvent: startOpts.waitForTearDownEvent,
EarlyTearDown: startOpts.earlyTearDown,
ClusterProfile: startOpts.clusterProfile,
})
if err != nil {
return err
Expand Down
8 changes: 7 additions & 1 deletion pkg/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
bootstrapPodsRunningTimeout = 20 * time.Minute
// how long we wait until the assets must all be created
assetsCreatedTimeout = 60 * time.Minute
SingleNodeProductionEdge = "single-node-production-edge"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is this? It is no edge. Is it a profile? Please name it that way.

)

type Config struct {
Expand All @@ -35,6 +36,7 @@ type Config struct {
RequiredPodPrefixes map[string][]string
WaitForTearDownEvent string
EarlyTearDown bool
ClusterProfile string
}

type startCommand struct {
Expand All @@ -44,6 +46,7 @@ type startCommand struct {
requiredPodPrefixes map[string][]string
waitForTearDownEvent string
earlyTearDown bool
clusterProfile string
}

func NewStartCommand(config Config) (*startCommand, error) {
Expand All @@ -54,6 +57,7 @@ func NewStartCommand(config Config) (*startCommand, error) {
requiredPodPrefixes: config.RequiredPodPrefixes,
waitForTearDownEvent: config.WaitForTearDownEvent,
earlyTearDown: config.EarlyTearDown,
clusterProfile: config.ClusterProfile,
}, nil
}

Expand Down Expand Up @@ -127,7 +131,9 @@ func (b *startCommand) Run() error {
if err = waitUntilPodsRunning(ctx, client, b.requiredPodPrefixes); err != nil {
return err
}
cancel()
if b.clusterProfile != SingleNodeProductionEdge {
cancel()
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Adding this logic here and the knowledge that it depends on the profile IMO is wrong. Instead make the behaviour the feature, i.e. the flag: --terminte-early-when-pods-running.

assetsDone.Wait()

// notify installer that we are ready to tear down the temporary bootstrap control plane
Expand Down