-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix app-namespace usage for cluster options (#1333)
During the introduction of defaultNamespace feature, we started using --app-namespace flag from kapp which should be used carefully when using cluster options instead of service account Signed-off-by: Praveen Rewar <8457124+praveenrewar@users.noreply.github.com>
- Loading branch information
1 parent
1185416
commit e66ee80
Showing
7 changed files
with
206 additions
and
12 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
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2023 VMware, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package e2e | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
// Secrets represents a secret with target cluster kubeconfig | ||
type Secrets struct { | ||
Name string | ||
Namespace string | ||
Kubeconfig string | ||
} | ||
|
||
// ForTargetCluster can be used to get secret with target cluster kubeconfig | ||
func (s Secrets) ForTargetCluster() string { | ||
indentedKubeconfig := "" | ||
for _, line := range strings.Split(s.Kubeconfig, "\n") { | ||
if line != "" { | ||
indentedKubeconfig += " " + line + "\n" | ||
} | ||
} | ||
return fmt.Sprintf(` | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: %s | ||
namespace: %s | ||
annotations: | ||
kapp.k14s.io/change-rule.apps: "delete after deleting kappctrl-e2e.k14s.io/apps" | ||
kapp.k14s.io/change-rule.instpkgs: "delete after deleting kappctrl-e2e.k14s.io/packageinstalls" | ||
type: Opaque | ||
stringData: | ||
value: | | ||
%s | ||
`, s.Name, s.Namespace, indentedKubeconfig) | ||
} |