Skip to content
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

PT-2248 - pt-k8s-debug-collector does not run pg_gather with K8SPG 2 #654

Conversation

svetasmirnova
Copy link
Collaborator

@svetasmirnova svetasmirnova commented Aug 3, 2023

  • Added check for K8SPG 2, so can run pg_gather for it

  • Added new allowed value for option --resource: -- pgv2 for K8SPG 2
    -- auto to auto-detect custom resource

  • Option --resource has now default value "auto"

  • Updated documentation

  • Added test cases for new options

  • The contributed code is licensed under GPL v2.0

  • Contributor Licence Agreement (CLA) is signed

  • util/update-modules has been ran

  • Documention updated

  • Test suite update

- Added check for K8SPG 2, so can run pg_gather for it
- Added new allowed value for option --resource:
-- pgv2 for K8SPG 2
-- auto to auto-detect custom resource
- Option --resource has now default value "auto"
- Updated documentation
- Added test cases for new options
if cr.Spec.SecretName != "" {
user, err = d.getDataFromSecret(cr.Spec.SecretName, "username", namespace)
} else {
user, err = d.getDataFromSecret(crName+"-pguser-cluster1", "user", namespace)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the secret name depends on the cluster name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it should be something like

Suggested change
user, err = d.getDataFromSecret(crName+"-pguser-cluster1", "user", namespace)
user, err = d.getDataFromSecret(crName+"-pguser-"+crName, "user", namespace)

?

if cr.Spec.SecretName != "" {
pass, err = d.getDataFromSecret(cr.Spec.SecretName, "password", namespace)
} else {
pass, err = d.getDataFromSecret(crName+"-pguser-cluster1", "password", namespace)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the secret name depends on the cluster name

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this should be something like

Suggested change
pass, err = d.getDataFromSecret(crName+"-pguser-cluster1", "password", namespace)
pass, err = d.getDataFromSecret(crName+"-pguser-"+crName, "password", namespace)

?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but I want to mention that it's not guaranteed to have this user in cluster. if the end user configured spec.users, operator doesn't create this user. but we plan to change this logic and have a default user. @nmarukovich am i right?

Copy link
Collaborator Author

@svetasmirnova svetasmirnova Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also please confirm if currently this user name is created as:

<CLUSTER NAME>-<pguser of anything, specified in spec.users>-<CLUSTER NAME>

So for default configuration this is cluster1-pguser-cluster1 and could be, for example mysupercluster-mysuperuser-mysupercluster? Or other variations are also possible?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by default it's <CLUSTER NAME>-pguser-<CLUSTER NAME>
if an user is specified in spec.users it'll be <CLUSTER NAME>-pguser-<USERNAME>
and please note that the secret name is customizable with spec.users[].secretName

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, implemented! Please review the updated patch.

- Implemented custom user and secrets handling (in case when no default
  user exists).
- Merge branch '3.x' into PT-2248_pt-k8s-debug-collector_does_not_run_pg_gather_with_K8SPG2
@svetasmirnova svetasmirnova merged commit cd727bf into 3.x Sep 13, 2023
3 of 4 checks passed
@svetasmirnova svetasmirnova deleted the PT-2248_pt-k8s-debug-collector_does_not_run_pg_gather_with_K8SPG2 branch September 13, 2023 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants