-
Notifications
You must be signed in to change notification settings - Fork 56
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
K8SPG-487: add global annotations and labels for cr.yaml
#956
Open
pooknull
wants to merge
6
commits into
main
Choose a base branch
from
K8SPG-487
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+270
−1
Open
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
015aa9c
K8SPG-487: add global annotations and labels for `cr.yaml`
pooknull d14307b
fix
pooknull 0311793
Merge branch 'main' into K8SPG-487
pooknull 8a1bce3
Merge remote-tracking branch 'origin/main' into K8SPG-487
pooknull c635811
fix unit-tests
pooknull bbcf318
Merge branch 'main' into K8SPG-487
pooknull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: 300 | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
labels: | ||
app.kubernetes.io/instance: init-deploy | ||
app.kubernetes.io/managed-by: percona-postgresql-operator | ||
app.kubernetes.io/name: percona-postgresql | ||
app.kubernetes.io/part-of: percona-postgresql | ||
pgv2.percona.com/version: 2.6.0 | ||
postgres-operator.crunchydata.com/cluster: init-deploy | ||
postgres-operator.crunchydata.com/pgbackrest: "" | ||
postgres-operator.crunchydata.com/pgbackrest-config: "" | ||
test-label: test | ||
name: init-deploy-pgbackrest | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
labels: | ||
app.kubernetes.io/instance: init-deploy | ||
app.kubernetes.io/managed-by: percona-postgresql-operator | ||
app.kubernetes.io/name: percona-postgresql | ||
app.kubernetes.io/part-of: percona-postgresql | ||
postgres-operator.crunchydata.com/cluster: init-deploy | ||
postgres-operator.crunchydata.com/cluster-certificate: replication-client-tls | ||
test-label: test | ||
name: init-deploy-replication-cert | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
labels: | ||
app.kubernetes.io/instance: init-deploy | ||
app.kubernetes.io/managed-by: percona-postgresql-operator | ||
app.kubernetes.io/name: percona-postgresql | ||
app.kubernetes.io/part-of: percona-postgresql | ||
postgres-operator.crunchydata.com/cluster: init-deploy | ||
postgres-operator.crunchydata.com/pguser: postgres | ||
postgres-operator.crunchydata.com/role: pguser | ||
test-label: test | ||
name: init-deploy-pguser-postgres | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
labels: | ||
app.kubernetes.io/instance: init-deploy | ||
app.kubernetes.io/managed-by: percona-postgresql-operator | ||
app.kubernetes.io/name: percona-postgresql | ||
app.kubernetes.io/part-of: percona-postgresql | ||
postgres-operator.crunchydata.com/cluster: init-deploy | ||
postgres-operator.crunchydata.com/pguser: init-deploy | ||
postgres-operator.crunchydata.com/role: pguser | ||
test-label: test | ||
name: init-deploy-pguser-init-deploy | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
labels: | ||
app.kubernetes.io/component: pgbouncer | ||
app.kubernetes.io/instance: init-deploy | ||
app.kubernetes.io/managed-by: percona-postgresql-operator | ||
app.kubernetes.io/name: percona-postgresql | ||
app.kubernetes.io/part-of: percona-postgresql | ||
pgv2.percona.com/version: 2.6.0 | ||
postgres-operator.crunchydata.com/cluster: init-deploy | ||
postgres-operator.crunchydata.com/role: pgbouncer | ||
test-label: test | ||
name: init-deploy-pgbouncer | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
labels: | ||
app.kubernetes.io/instance: init-deploy | ||
app.kubernetes.io/managed-by: percona-postgresql-operator | ||
app.kubernetes.io/name: percona-postgresql | ||
app.kubernetes.io/part-of: percona-postgresql | ||
postgres-operator.crunchydata.com/cluster: init-deploy | ||
postgres-operator.crunchydata.com/cluster-certificate: postgres-tls | ||
test-label: test | ||
name: init-deploy-cluster-cert | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
labels: | ||
test-label: test | ||
name: init-deploy-cluster-ca-cert | ||
ownerReferences: | ||
- apiVersion: postgres-operator.crunchydata.com/v1beta1 | ||
kind: PostgresCluster | ||
name: init-deploy | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
labels: | ||
postgres-operator.crunchydata.com/cluster: init-deploy | ||
test-label: test | ||
name: init-deploy-config | ||
ownerReferences: | ||
- apiVersion: postgres-operator.crunchydata.com/v1beta1 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: PostgresCluster | ||
name: init-deploy | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
labels: | ||
app.kubernetes.io/instance: init-deploy | ||
app.kubernetes.io/managed-by: percona-postgresql-operator | ||
app.kubernetes.io/name: percona-postgresql | ||
app.kubernetes.io/part-of: percona-postgresql | ||
pgv2.percona.com/version: 2.6.0 | ||
postgres-operator.crunchydata.com/cluster: init-deploy | ||
postgres-operator.crunchydata.com/pgbackrest: "" | ||
postgres-operator.crunchydata.com/pgbackrest-config: "" | ||
test-label: test | ||
name: init-deploy-pgbackrest-config | ||
ownerReferences: | ||
- apiVersion: postgres-operator.crunchydata.com/v1beta1 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: PostgresCluster | ||
name: init-deploy | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
labels: | ||
app.kubernetes.io/component: pgbouncer | ||
app.kubernetes.io/instance: init-deploy | ||
app.kubernetes.io/managed-by: percona-postgresql-operator | ||
app.kubernetes.io/name: percona-postgresql | ||
app.kubernetes.io/part-of: percona-postgresql | ||
pgv2.percona.com/version: 2.6.0 | ||
postgres-operator.crunchydata.com/cluster: init-deploy | ||
postgres-operator.crunchydata.com/role: pgbouncer | ||
test-label: test | ||
name: init-deploy-pgbouncer | ||
ownerReferences: | ||
- apiVersion: postgres-operator.crunchydata.com/v1beta1 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: PostgresCluster | ||
name: init-deploy | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
generation: 1 | ||
labels: | ||
app.kubernetes.io/instance: init-deploy | ||
app.kubernetes.io/managed-by: percona-postgresql-operator | ||
app.kubernetes.io/name: percona-postgresql | ||
app.kubernetes.io/part-of: percona-postgresql | ||
pgv2.percona.com/version: 2.6.0 | ||
postgres-operator.crunchydata.com/cluster: init-deploy | ||
postgres-operator.crunchydata.com/data: pgbackrest | ||
postgres-operator.crunchydata.com/pgbackrest: "" | ||
postgres-operator.crunchydata.com/pgbackrest-dedicated: "" | ||
test-label: test | ||
name: init-deploy-repo-host | ||
ownerReferences: | ||
- apiVersion: postgres-operator.crunchydata.com/v1beta1 | ||
blockOwnerDeletion: true | ||
controller: true | ||
kind: PostgresCluster | ||
name: init-deploy | ||
spec: | ||
template: | ||
metadata: | ||
annotations: | ||
test-annotation: test | ||
labels: | ||
app.kubernetes.io/instance: init-deploy | ||
app.kubernetes.io/managed-by: percona-postgresql-operator | ||
app.kubernetes.io/name: percona-postgresql | ||
app.kubernetes.io/part-of: percona-postgresql | ||
pgv2.percona.com/version: 2.6.0 | ||
postgres-operator.crunchydata.com/cluster: init-deploy | ||
postgres-operator.crunchydata.com/data: pgbackrest | ||
postgres-operator.crunchydata.com/pgbackrest: "" | ||
postgres-operator.crunchydata.com/pgbackrest-dedicated: "" | ||
test-label: test | ||
status: | ||
availableReplicas: 1 | ||
collisionCount: 0 | ||
currentReplicas: 1 | ||
observedGeneration: 1 | ||
readyReplicas: 1 | ||
replicas: 1 | ||
updatedReplicas: 1 | ||
|
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 |
---|---|---|
|
@@ -369,6 +369,7 @@ func (r *PGClusterReconciler) reconcileOldCACert(ctx context.Context, cr *v2.Per | |
// K8SPG-555: We should create an empty secret with old name, so that crunchy part can populate it | ||
// instead of creating secrets unique to the cluster | ||
// TODO: remove when 2.4.0 will become unsupported | ||
|
||
if err := r.Client.Create(ctx, oldCASecret); err != nil { | ||
return errors.Wrap(err, "failed to create ca secret") | ||
} | ||
|
@@ -409,6 +410,12 @@ func (r *PGClusterReconciler) reconcileOldCACert(ctx context.Context, cr *v2.Per | |
if !k8serrors.IsNotFound(err) { | ||
newCASecret.Data = oldCASecret.Data | ||
} | ||
|
||
if cr.CompareVersion("2.6.0") >= 0 && cr.Spec.Metadata != nil { | ||
newCASecret.Annotations = cr.Spec.Metadata.Annotations | ||
newCASecret.Labels = cr.Spec.Metadata.Labels | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't catch this place, if we will have different annotations (for example for extentions too), should we put it to secret annotations? |
||
|
||
if err := r.Client.Create(ctx, newCASecret); err != nil { | ||
return errors.Wrap(err, "failed to create updated CA secret") | ||
} | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we want to have a
test
prefix here in the CR? Maybe something likeexample-annotation
orannotation-key
. Test feels like a leftover from some testing.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.
@pooknull wdyt about this?