-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ability to override admin console and lam host ports (#1201)
* feat: ability to override admin console and lam host ports * kots overrides * f * Revert "kots overrides" This reverts commit edbded1. * update kots
- Loading branch information
Showing
22 changed files
with
522 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
|
||
"github.com/replicatedhq/embedded-cluster/pkg/defaults" | ||
"github.com/urfave/cli/v2" | ||
k8snet "k8s.io/utils/net" | ||
) | ||
|
||
func getAdminColsolePortFlag() cli.Flag { | ||
return &cli.StringFlag{ | ||
Name: "admin-console-port", | ||
Usage: "Port on which the Admin Console will be served", | ||
Value: strconv.Itoa(defaults.AdminConsolePort), | ||
Hidden: false, | ||
} | ||
} | ||
|
||
func getAdminConsolePortFromFlag(c *cli.Context) (int, error) { | ||
portStr := c.String("admin-console-port") | ||
if portStr == "" { | ||
return defaults.AdminConsolePort, nil | ||
} | ||
// TODO: add first class support for service node port range and validate the port | ||
port, err := k8snet.ParsePort(portStr, false) | ||
if err != nil { | ||
return 0, fmt.Errorf("invalid admin console port: %w", err) | ||
} | ||
return port, nil | ||
} | ||
|
||
func getLocalArtifactMirrorPortFlag() cli.Flag { | ||
return &cli.StringFlag{ | ||
Name: "local-artifact-mirror-port", | ||
Usage: "Port on which the Local Artifact Mirror will be served", | ||
Value: strconv.Itoa(defaults.LocalArtifactMirrorPort), | ||
Hidden: false, | ||
} | ||
} | ||
|
||
func getLocalArtifactMirrorPortFromFlag(c *cli.Context) (int, error) { | ||
portStr := c.String("local-artifact-mirror-port") | ||
if portStr == "" { | ||
return defaults.LocalArtifactMirrorPort, nil | ||
} | ||
// TODO: add first class support for service node port range and validate the port does not | ||
// conflict with this range | ||
port, err := k8snet.ParsePort(portStr, false) | ||
if err != nil { | ||
return 0, fmt.Errorf("invalid local artifact mirror port: %w", err) | ||
} | ||
if portStr == c.String("admin-console-port") { | ||
return 0, fmt.Errorf("local artifact mirror port cannot be the same as admin console port") | ||
} | ||
return port, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.