-
Notifications
You must be signed in to change notification settings - Fork 1
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
CLI: add support for namespace other than flux-system #3532
Closed
Closed
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d7d550a
add support for namespace other than flux-system
waleedhammam 5cd8bdc
Merge branch 'main' into 3473-bootstrap-cli-allow-namespaces
waleedhammam 7d8a2bd
Merge branch 'main' into 3473-bootstrap-cli-allow-namespaces
waleedhammam 0c93e59
Merge branch 'main' into 3473-bootstrap-cli-allow-namespaces
waleedhammam f93e475
Merge branch 'main' into 3473-bootstrap-cli-allow-namespaces
waleedhammam 9f0b375
Merge branch 'main' into 3473-bootstrap-cli-allow-namespaces
waleedhammam 5ee291c
fix namespace issue
waleedhammam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,7 @@ const ( | |
type ConfigBuilder struct { | ||
logger logger.Logger | ||
kubeconfig string | ||
namespace string | ||
username string | ||
password string | ||
wGEVersion string | ||
|
@@ -59,6 +60,11 @@ func (c *ConfigBuilder) WithLogWriter(logger logger.Logger) *ConfigBuilder { | |
return c | ||
} | ||
|
||
func (c *ConfigBuilder) WithNamespace(namespace string) *ConfigBuilder { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where is flux-system resolved if no namespace is set? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the flag itself, if it's not passed, then automatically set to flux system |
||
c.namespace = namespace | ||
return c | ||
} | ||
|
||
func (c *ConfigBuilder) WithUsername(username string) *ConfigBuilder { | ||
c.username = username | ||
return c | ||
|
@@ -103,6 +109,8 @@ type Config struct { | |
KubernetesClient k8s_client.Client | ||
Logger logger.Logger | ||
|
||
Namespace string | ||
|
||
WGEVersion string // user want this version in the cluster | ||
|
||
Username string // cluster user username | ||
|
@@ -142,6 +150,7 @@ func (cb *ConfigBuilder) Build() (Config, error) { | |
return Config{ | ||
KubernetesClient: kubeHttp.Client, | ||
WGEVersion: cb.wGEVersion, | ||
Namespace: cb.namespace, | ||
Username: cb.username, | ||
Password: cb.password, | ||
Logger: cb.logger, | ||
|
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ const ( | |
nonExistingEntitlementSecretMsg = "entitlement file is not found, To get Weave GitOps Entitelment secret, please contact *[email protected]* and add it to your cluster" | ||
invalidEntitlementSecretMsg = "entitlement file is invalid, please verify the secret content. If you still facing issues, please contact *[email protected]*" | ||
expiredEntitlementSecretMsg = "entitlement file is expired at: %s, please contact *[email protected]*" | ||
entitlementCheckMsg = "verifying Weave GitOps Entitlement File" | ||
entitlementCheckMsg = "verifying Weave GitOps Entitlement File in namespace: %s" | ||
) | ||
|
||
// wge consts | ||
|
@@ -37,8 +37,8 @@ var CheckEntitlementSecret = BootstrapStep{ | |
} | ||
|
||
func checkEntitlementSecret(input []StepInput, c *Config) ([]StepOutput, error) { | ||
c.Logger.Actionf(entitlementCheckMsg) | ||
err := verifyEntitlementSecret(c.KubernetesClient) | ||
c.Logger.Actionf(entitlementCheckMsg, c.Namespace) | ||
err := verifyEntitlementSecret(c.KubernetesClient, c.Namespace) | ||
if err != nil { | ||
return []StepOutput{}, err | ||
} | ||
|
@@ -51,8 +51,8 @@ func checkEntitlementSecret(input []StepInput, c *Config) ([]StepOutput, error) | |
// verifing entitlement by the public key (private key is used for encrypting and public is for verification) | ||
// and making sure it's not expired | ||
// verifying username and password by making http request for downloading charts and ensuring it's authenticated | ||
func verifyEntitlementSecret(client k8s_client.Client) error { | ||
secret, err := utils.GetSecret(client, entitlementSecretName, WGEDefaultNamespace) | ||
func verifyEntitlementSecret(client k8s_client.Client, namespace string) error { | ||
secret, err := utils.GetSecret(client, entitlementSecretName, namespace) | ||
if err != nil { | ||
return fmt.Errorf("%s: %v", nonExistingEntitlementSecretMsg, err) | ||
} | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this flag different to
weave-gitops-enterprise/cmd/gitops/app/root/cmd.go
Line 120 in 3a2548b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm overriding it to be able to pass it to the commands
The root app doesn't refer it to a pointer or variable