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

Fallback to default Che secret name if none is given in case of turned on tls #191

Merged
merged 1 commit into from
Mar 13, 2020

Conversation

mmorhun
Copy link
Contributor

@mmorhun mmorhun commented Mar 12, 2020

Signed-off-by: Mykola Morhun mmorhun@redhat.com

What does this PR do?

Uses default che-tls secret name for securing Che ingresses if TLS is turned on and tlsSecretName is not provided in Che CR.

What issues does this PR fix or reference?

eclipse-che/che#16280

…d on tls

Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
tlsSecretName := cr.Spec.K8s.TlsSecretName
// If TLS is turned on but the secret is not set, try to use Che default value as k8s cluster defaults will not work.
tlsFlag, _ := strconv.ParseBool(tls)
if tlsFlag && tlsSecretName == "" {
Copy link
Contributor

@AndrienkoAleksandr AndrienkoAleksandr Mar 13, 2020

Choose a reason for hiding this comment

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

You can also use util.GetValue(stringFromCR, defaultStringValue)

Than code could be:

tlsSecretName := cr.Spec.K8s.TlsSecretName
tlsFlag, _ := strconv.ParseBool(tls)
if tlsFlag {
        tlsSecretName = util.getValue(tlsSecretName, "che-tls")
}

But it's optional, up to you.

@mmorhun mmorhun merged commit 347e4c9 into master Mar 13, 2020
@mmorhun mmorhun deleted the che-16280-1 branch March 13, 2020 08:58
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.

3 participants