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

Fixes #10234 - Postgres SSL Certificate fix #10300

Merged
merged 3 commits into from
Feb 7, 2023

Conversation

reddymh
Copy link
Contributor

@reddymh reddymh commented Jan 2, 2023

Signed-off-by: Rajshekar Reddy reddymh@gmail.com

Fixes #10234

Please do not open a pull request until you have checked ALL of these:

  • Create the PR as draft .
  • Run make pre-commit -B to fix codegen and lint problems.
  • Sign-off your commits (otherwise the DCO check will fail).
  • Use a conventional commit message (otherwise the commit message check will fail).
  • "Fixes #" is in both the PR title (for release notes) and this description (to automatically link and close the issue).
  • Add unit or e2e tests. Say how you tested your changes. If you changed the UI, attach screenshots.
  • Github checks are green.
  • [] Once required tests have passed, mark your PR "Ready for review".

If changes were requested, and you've made them, dismiss the review to get it reviewed again.

@rohankmr414
Copy link
Member

@reddymh have you tested this on your end?

Comment on lines +104 to +105
WORKDIR /home/argo

Copy link
Member

Choose a reason for hiding this comment

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

do we really need this? can't we use absolute paths for files in persist/sqldb/sqldb.go

Copy link
Member

Choose a reason for hiding this comment

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

WorkDir is needed to refer to where all the binary and files need to be copied. Can we config the path?

config/config.go Outdated
Comment on lines 234 to 238
SSL bool `json:"ssl,omitempty"`
SSLMode string `json:"sslMode,omitempty"`
CaCertSecret apiv1.SecretKeySelector `json:"caCertSecret,omitempty"`
ServerCertSecret apiv1.SecretKeySelector `json:"serverCertSecret,omitempty"`
ServerKeySecret apiv1.SecretKeySelector `json:"serverKeySecret,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rohankmr414 tried in visual studio and not getting any lint error but again I will cross check on lint errors.

Copy link
Member

Choose a reason for hiding this comment

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

Can you run make lint in the repo directory? That'll fix it

@@ -53,9 +54,44 @@ func CreatePostGresDBSession(kubectlConfig kubernetes.Interface, namespace strin
}

if cfg.SSL {
if cfg.SSLMode != "" {
if cfg.SSLMode != "" && cfg.SSLMode != "disable" {
pgCertPath := "./pgcerts"
Copy link
Member

Choose a reason for hiding this comment

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

can we use the absolute path here and get rid of WORKDIR /home/argo from Dockerfile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rohankmr414 we ca use absolute path. I thought argo server already using workdir in Dockerfile so I thought same thing we can use for argo controller.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see any issues with it as well, it's just an extra change that can be avoided.

cc: @sarabala1979

Copy link
Member

Choose a reason for hiding this comment

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

Can we add another element in structs to configure the path and have a default value too?

Copy link
Contributor Author

@reddymh reddymh Jan 7, 2023

Choose a reason for hiding this comment

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

@sarabala1979 @rohankmr414 then we need to use constructor for this field in the struct.
Do you need this change?

Copy link
Member

Choose a reason for hiding this comment

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

@reddymh yes you can add a field to the spec

Copy link
Contributor Author

@reddymh reddymh Jan 26, 2023

Choose a reason for hiding this comment

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

@rohankmr414 / @sarabala1979 added field to the spec and default vault if the variable is not configured in configmap or not defined.
Please review and approve the same

@rohankmr414
Copy link
Member

can you also sign off your commits for DCO https://github.com/argoproj/argoproj/blob/master/community/CONTRIBUTING.md#legal

@reddymh
Copy link
Contributor Author

reddymh commented Jan 5, 2023

yes . we have tested and running in prod as well

@reddymh
Copy link
Contributor Author

reddymh commented Jan 26, 2023

can you also sign off your commits for DCO https://github.com/argoproj/argoproj/blob/master/community/CONTRIBUTING.md#legal

I have added signoff but still showing DCO - action required

config/config.go Outdated
SSL bool `json:"ssl,omitempty"`
SSLMode string `json:"sslMode,omitempty"`
CaCertSecret apiv1.SecretKeySelector `json:"caCertSecret,omitempty"`
ServerCertSecret apiv1.SecretKeySelector `json:"serverCertSecret,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

This field and the next are mapped to the sslcert and sslkey options in the PostgreSQL connection options. The PostgreSQL documentation defines them as client certificate and key filename, so naming them server cert and server key is incorrect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vladlosev changed the ServerCertSecret and ServerKeySecret as ClientCertSecret and ClientCertSecret and will change respective helm chart as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sarabala1979 sarabala1979 enabled auto-merge (squash) January 30, 2023 19:08
auto-merge was automatically disabled January 31, 2023 13:52

Head branch was pushed to by a user without write access

Copy link
Contributor

@vladlosev vladlosev left a comment

Choose a reason for hiding this comment

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

FWIW

@rohankmr414
Copy link
Member

I have added signoff but still showing DCO - action required
@reddymh you'll have to sign off all your commits, you can also squash all your commits into one and then sign off the commit, you can also go to the details of the failing check and click the button to accept the DCO

Signed-off-by: Rajshekar Reddy <reddymh@gmail.com>
Signed-off-by: Rajshekar Reddy <reddymh@gmail.com>
Signed-off-by: Rajshekar Reddy <reddymh@gmail.com>
@reddymh
Copy link
Contributor Author

reddymh commented Feb 1, 2023

I have added signoff but still showing DCO - action required
@reddymh you'll have to sign off all your commits, you can also squash all your commits into one and then sign off the commit, you can also go to the details of the failing check and click the button to accept the DCO

@rohankmr414 @sarabala1979 @vladlosev Can we merge the PR?

@reddymh reddymh removed the request for review from alexec February 6, 2023 10:23
@reddymh reddymh requested review from sarabala1979 and removed request for jessesuen February 6, 2023 10:23
@sarabala1979 sarabala1979 merged commit 5d0db00 into argoproj:master Feb 7, 2023
isubasinghe pushed a commit to isubasinghe/argo-workflows that referenced this pull request Feb 9, 2023
Signed-off-by: Rajshekar Reddy <reddymh@gmail.com>
GoshaDo pushed a commit to GoshaDo/argo-workflows that referenced this pull request Feb 9, 2023
Signed-off-by: Rajshekar Reddy <reddymh@gmail.com>
Signed-off-by: goshado <goshatoo@gmail.com>
@tooptoop4
Copy link
Contributor

@reddymh do u think this caused #10498?

JPZ13 added a commit to pipekit/argo-workflows that referenced this pull request Mar 22, 2023
JPZ13 added a commit to pipekit/argo-workflows that referenced this pull request Mar 22, 2023
…#10300)" (#16)

This PR:
- reverts the broken postgres connection PR
terrytangyuan added a commit that referenced this pull request Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to have Postgresql SSL Certificate option when sslmode is enabled
6 participants