-
Notifications
You must be signed in to change notification settings - Fork 0
Create secret #97
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
Create secret #97
Conversation
api/v1/postgres_types.go
Outdated
const SecretNamespace = "pgaas" | ||
|
||
func (p *Postgres) ToSecret(src *corev1.SecretList) (*corev1.Secret, error) { | ||
new := &corev1.Secret{} |
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.
new is a reserved word and irritates reading
api/v1/postgres_types.go
Outdated
return p.ToPeripheralResourceName() + "-passwords" | ||
} | ||
|
||
func (p *Postgres) ToSecretNamesapcedName() *types.NamespacedName { |
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.
typo
ac0c310
to
f4d4620
Compare
api/v1/postgres_types.go
Outdated
} | ||
} | ||
|
||
func (p *Postgres) ToSecretName() string { |
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.
ToUserPasswordsSecretName()
controllers/postgres_controller.go
Outdated
@@ -162,6 +162,12 @@ func (r *PostgresReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { | |||
return ctrl.Result{}, fmt.Errorf("unable to create or update corresponding CRD ClusterwideNetworkPolicy: %W", err) | |||
} | |||
|
|||
if instance.Spec.SecretName == "" { |
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.
Remove the check. Always update the secret, replacing the Data
block.
Decision: Suggestion:
|
controllers/status_controller.go
Outdated
} | ||
log.Info("secret created or updated", "operation result", result) | ||
|
||
if result == controllerutil.OperationResultCreated { |
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.
You're right here as well: The name will probably not change and could be derived automativally (by convention). Hence, we would not need the field secretName in the spec.
What we should do, however, is export the String-Suffix we use to generate the secret name (currently -password
) so it the same string will be used in the cloudctl
/cloud-api
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.
@majst01
We added an exported func ToUserPasswordsSecretName
to Postgres
. Can we remove secretName
from the spec.?
controllers/status_controller.go
Outdated
return ctrl.Result{}, nil | ||
} | ||
|
||
// SetupWithManager registers this controller for reconciliation of Postgresql resources | ||
func (r *StatusReconciler) SetupWithManager(mgr ctrl.Manager) error { | ||
return ctrl.NewControllerManagedBy(mgr). | ||
For(&zalando.Postgresql{}). | ||
// Owns(&corev1.Secret{}). // todo: better the watching on secrets that weren't generated by this controller |
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.
Not used, please remove.
for issue #93