Add secret names

[ZITADOPER-1]
This commit is contained in:
Haim Kortovich
2024-05-20 14:44:15 -05:00
parent 225aa5ee33
commit 1107dd3e8a
2 changed files with 10 additions and 3 deletions

View File

@@ -49,7 +49,6 @@ type MachineUserStatus struct {
UserId string `json:"userId"`
// +kubebuilder:default=""
KeyId string `json:"keyId"`
// +kubebuilder:default=""
PATId string `json:"patId"`
}
@@ -97,6 +96,14 @@ func (d *MachineUser) ZitadelClusterRef(ctx context.Context, refresolver *RefRes
return ref, nil
}
func (d *MachineUser) PatSecretName() string {
return d.Name + "-pat-secret"
}
func (d *MachineUser) JWTSecretName() string {
return d.Name + "-machinekey-secret"
}
//+kubebuilder:object:root=true
// MachineUserList contains a list of MachineUser

View File

@@ -191,7 +191,7 @@ func (wr *wrappedMachineUserReconciler) reconcilePAT(ctx context.Context, ztdCli
return fmt.Errorf("Error adding PAT: %v", err)
}
key := types.NamespacedName{
Name: wr.MachineUser.Name + "-pat-secret",
Name: wr.MachineUser.PatSecretName(),
Namespace: wr.MachineUser.Namespace,
}
patSecret, err := wr.Builder.BuildSecret(builder.SecretOpts{
@@ -240,7 +240,7 @@ func (wr *wrappedMachineUserReconciler) reconcileJWT(ctx context.Context, ztdCli
return fmt.Errorf("Error adding JWT: %v", err)
}
key := types.NamespacedName{
Name: wr.MachineUser.Name + "-machinekey-secret",
Name: wr.MachineUser.JWTSecretName(),
Namespace: wr.MachineUser.Namespace,
}