Skip to content

Provide https support for health check#912

Merged
sunsingerus merged 2 commits intoAltinity:0.18.4from
ClibMouse:https_schema_support
Apr 7, 2022
Merged

Provide https support for health check#912
sunsingerus merged 2 commits intoAltinity:0.18.4from
ClibMouse:https_schema_support

Conversation

@bkuschel
Copy link
Copy Markdown
Contributor

@bkuschel bkuschel commented Apr 1, 2022

Thanks for taking the time to contribute to clickhouse-operator!

Please, read carefully instructions on how to make a Pull Request.

This will help a lot for maintainers to adopt your Pull Request.

Important items to consider before making a Pull Request

Please check items PR complies to:

  • All commits in the PR are squashed. More info
  • The PR is made into dedicated next-release branch, not into master branch1. More info
  • The PR is signed. More info

--

1 If you feel your PR does not affect any Go-code or any testable functionality (for example, PR contains docs only or supplementary materials), PR can be made into master branch, but it has to be confirmed by project's maintainer.

@Slach Slach requested review from Slach and sunsingerus April 2, 2022 05:00
Copy link
Copy Markdown
Collaborator

@sunsingerus sunsingerus left a comment

Choose a reason for hiding this comment

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

PR looks fine, but there are two items that would be nice to clarify in more details. In particularly, not sure about build .sh script and let's address DSN() generation section.

Comment thread dev/go_build_universal.sh
-X ${REPO}/pkg/version.BuiltAt=${NOW} \
" \
${GCFLAGS:-} \
$GCFLAG "${GCFLAGS:-}" \
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you, please, clarify, why would you like to create $GCFLAG as a separate var and not to add '-gcflags' to $GCFLAGS ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The original method had issues with the quotations being passed into go build. It wasn't parsing correctly, either wrapping the entire thing in single quotes (including the flag specificier) or each argument in single quotes. I was using go 1.17. I am not sure if it's particular to that version but doing it this way avoids the issue.

Comment thread dev/go_build_universal.sh

if [[ "" != "${GCFLAGS:-}" ]]; then
GCFLAGS="-gcflags ${GCFLAGS:-}"
GCFLAG='-gcflags'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

See my comment below on the call line

// 1. Metrics requests
// 2. Schema maintenance
// User credentials can be specified in additional ClickHouse config files located in `chUsersConfigsPath` folder
CHScheme string `json:"chScheme" yaml:"chScheme"`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This section is kind of deprecated and is kept for backward-compatibility only. That's OK, it's just nice extra.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I saw, wasn't sure, i thought it was no harm.

Comment thread pkg/model/clickhouse/connection.go Outdated
func (c *Connection) connect(ctx context.Context) {
c.l.V(2).Info("Establishing connection: %s", c.params.GetDSNWithHiddenCredentials())
dbConnection, err := databasesql.Open("clickhouse", c.params.GetDSN())
dbConnection, err := databasesql.Open("clickhouse", c.params.GetDSN()+"?tls_config=tls-settings")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just thinking aloud - may be these params should be not added to GetDSN(), but produced by GetDSN()?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Especially taking into account, that DSN is already aware of the scheme (be it http/https)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think I ended going this way because of this unit was importing the go driver here, so the crypto init/registration had to also happen here. The specific registration key is currently hard coded on unit initialization and wanted to confine the hardcoded key to the scope of this unit.
I can make it a constant constant ("tls-settings") in the ConnectionParam unit.

@bkuschel bkuschel requested a review from sunsingerus April 4, 2022 17:44
@bkuschel
Copy link
Copy Markdown
Contributor Author

bkuschel commented Apr 6, 2022

@sunsingerus Do you think this is ok to merge?

@sunsingerus sunsingerus merged commit d215047 into Altinity:0.18.4 Apr 7, 2022
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.

2 participants