Skip to content

Commit e71c0d1

Browse files
author
Steve Boardwell
authored
Add optional annotations (#66)
1 parent 21256f0 commit e71c0d1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pkg/apis/db/v1alpha1/postgresuser_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ type PostgresUserSpec struct {
1515
SecretName string `json:"secretName"`
1616
// +optional
1717
Privileges string `json:"privileges"`
18+
// +optional
19+
Annotations map[string]string `json:"annotations,omitempty"`
1820
}
1921

2022
// PostgresUserStatus defines the observed state of PostgresUser

pkg/controller/postgresuser/postgresuser_controller.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
goerr "errors"
66
"fmt"
7+
78
"github.com/movetokube/postgres-operator/pkg/config"
89

910
"github.com/go-logr/logr"
@@ -267,11 +268,14 @@ func (r *ReconcilePostgresUser) newSecretForCR(cr *dbv1alpha1.PostgresUser, role
267268
labels := map[string]string{
268269
"app": cr.Name,
269270
}
271+
annotations := cr.Spec.Annotations
272+
270273
return &corev1.Secret{
271274
ObjectMeta: metav1.ObjectMeta{
272-
Name: fmt.Sprintf("%s-%s", cr.Spec.SecretName, cr.Name),
273-
Namespace: cr.Namespace,
274-
Labels: labels,
275+
Name: fmt.Sprintf("%s-%s", cr.Spec.SecretName, cr.Name),
276+
Namespace: cr.Namespace,
277+
Labels: labels,
278+
Annotations: annotations,
275279
},
276280
Data: map[string][]byte{
277281
"POSTGRES_URL": []byte(pgUserUrl),

0 commit comments

Comments
 (0)