Skip to content

Commit 362663a

Browse files
authored
feat: ssh key secret namespace (#79)
1 parent e22f2b3 commit 362663a

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

main.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func main() {
5252
shootTokenSecret string
5353
shootTokenPath string
5454
sshKeySecret string
55+
sshKeySecretNamespace string
5556
namespace string
5657
gracefulShutdownTimeout time.Duration
5758
reconcileInterval time.Duration
@@ -72,7 +73,7 @@ func main() {
7273
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
7374
"Enable leader election for controller manager. "+
7475
"Enabling this will ensure there is only one active controller manager")
75-
flag.StringVar(&namespace, "namespace", "default", "the namespace this controller is running")
76+
flag.StringVar(&namespace, "namespace", "", "the namespace this controller is running")
7677
flag.DurationVar(&reconcileInterval, "reconcile-interval", 10*time.Minute, "duration after which a resource is getting reconciled at minimum")
7778
flag.DurationVar(&firewallHealthTimeout, "firewall-health-timeout", 20*time.Minute, "duration after a created firewall not getting ready is considered dead")
7879
flag.DurationVar(&createTimeout, "create-timeout", 10*time.Minute, "duration after which a firewall in the creation phase will be recreated")
@@ -88,10 +89,15 @@ func main() {
8889
flag.StringVar(&shootKubeconfigSecret, "shoot-kubeconfig-secret-name", "", "the secret name of the generic kubeconfig for shoot access")
8990
flag.StringVar(&shootTokenSecret, "shoot-token-secret-name", "", "the secret name of the token for shoot access")
9091
flag.StringVar(&sshKeySecret, "ssh-key-secret-name", "", "the secret name of the ssh key for machine access")
92+
flag.StringVar(&sshKeySecretNamespace, "ssh-key-secret-namespace", "", "the secret name of the ssh key for machine access")
9193
flag.StringVar(&shootTokenPath, "shoot-token-path", "", "the path where to store the token file for shoot access")
9294

9395
flag.Parse()
9496

97+
if sshKeySecretNamespace == "" {
98+
sshKeySecretNamespace = namespace
99+
}
100+
95101
slogHandler, err := controllers.NewLogger(logLevel)
96102
if err != nil {
97103
ctrl.Log.WithName("setup").Error(err, "unable to parse log level")
@@ -130,6 +136,7 @@ func main() {
130136
LeaderElectionID: "firewall-controller-manager-leader-election",
131137
GracefulShutdownTimeout: &gracefulShutdownTimeout,
132138
})
139+
133140
if err != nil {
134141
log.Fatalf("unable to setup firewall-controller-manager %v", err)
135142
}
@@ -196,7 +203,7 @@ func main() {
196203
// secret for this controller and expose the access secrets through the firewall
197204
// status resource, which can be read by the firewall-controller
198205
// - the firewall-controller can then create a client from these secrets but
199-
// it has to contiuously update the token file because the token will expire
206+
// it has to continuously update the token file because the token will expire
200207
// - we can re-use the same approach for this controller as well and do not have
201208
// to do any additional mounts for the deployment of the controller
202209
//
@@ -247,7 +254,7 @@ func main() {
247254
ShootAPIServerURL: shootApiURL,
248255
ShootAccess: externalShootAccess,
249256
SSHKeySecretName: sshKeySecret,
250-
SSHKeySecretNamespace: namespace,
257+
SSHKeySecretNamespace: sshKeySecretNamespace,
251258
ShootAccessHelper: internalShootAccessHelper,
252259
Metal: mclient,
253260
ClusterTag: fmt.Sprintf("%s=%s", tag.ClusterID, clusterID),

0 commit comments

Comments
 (0)