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

Bug 1794313: Some cluster operators fail to come up because RHV CA is not trusted by a pod #3261

Merged
merged 1 commit into from Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -41,4 +41,5 @@ data:
ovirt_password: {{.CloudCreds.Ovirt.Base64encodePassword}}
ovirt_cafile: {{.CloudCreds.Ovirt.Base64encodeCAFile}}
ovirt_insecure: {{.CloudCreds.Ovirt.Base64encodeInsecure}}
ovirt_ca_bundle: {{.CloudCreds.Ovirt.Base64encodeCABundle}}
{{- end}}
1 change: 1 addition & 0 deletions pkg/asset/installconfig/ovirt/config.go
Expand Up @@ -18,6 +18,7 @@ type Config struct {
Password string `yaml:"ovirt_password"`
CAFile string `yaml:"ovirt_cafile,omitempty"`
Insecure bool `yaml:"ovirt_insecure,omitempty"`
CABundle string `yaml:"ovirt_ca_bundle,omitempty"`
}

// LoadOvirtConfig from the following location (first wins):
Expand Down
27 changes: 26 additions & 1 deletion pkg/asset/installconfig/ovirt/credentials.go
@@ -1,6 +1,9 @@
package ovirt

import (
"fmt"
"net/url"

"gopkg.in/AlecAivazis/survey.v1"
)

Expand All @@ -23,7 +26,7 @@ func askCredentials() (Config, error) {
err = survey.AskOne(
&survey.Confirm{
Message: "Is the installed oVirt certificate trusted?",
Default: false,
Default: true,
Help: "",
},
&ovirtCertTrusted,
Expand All @@ -33,6 +36,28 @@ func askCredentials() (Config, error) {
}
c.Insecure = !ovirtCertTrusted

if ovirtCertTrusted {
ovirtURL, err := url.Parse(c.URL)
if err != nil {
// should have passed validation, this is unexpected
return c, err
}
pemURL := fmt.Sprintf(
"%s://%s/ovirt-engine/services/pki-resource?resource=ca-certificate&format=X509-PEM-CA",
ovirtURL.Scheme,
ovirtURL.Host)

err = survey.AskOne(&survey.Multiline{
Message: "Enter oVirt's CA bundle",
Help: "Obtain oVirt CA bundle from " + pemURL,
},
&c.CABundle,
survey.ComposeValidators(survey.Required))
if err != nil {
return c, err
}
}

err = survey.Ask([]*survey.Question{
{
Prompt: &survey.Input{
Expand Down
1 change: 1 addition & 0 deletions pkg/asset/manifests/openshift.go
Expand Up @@ -175,6 +175,7 @@ func (o *Openshift) Generate(dependencies asset.Parents) error {
Base64encodePassword: base64.StdEncoding.EncodeToString([]byte(conf.Password)),
Base64encodeCAFile: base64.StdEncoding.EncodeToString([]byte(conf.CAFile)),
Base64encodeInsecure: base64.StdEncoding.EncodeToString([]byte(strconv.FormatBool(conf.Insecure))),
Base64encodeCABundle: base64.StdEncoding.EncodeToString([]byte(conf.CABundle)),
},
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/asset/manifests/template.go
Expand Up @@ -44,6 +44,7 @@ type OvirtCredsSecretData struct {
Base64encodePassword string
Base64encodeCAFile string
Base64encodeInsecure string
Base64encodeCABundle string
}

type cloudCredsSecretData struct {
Expand Down