-
Notifications
You must be signed in to change notification settings - Fork 0
/
basedomain.go
43 lines (36 loc) · 1.28 KB
/
basedomain.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package installconfig
import (
survey "gopkg.in/AlecAivazis/survey.v1"
"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/validate"
)
type baseDomain struct {
BaseDomain string
}
var _ asset.Asset = (*baseDomain)(nil)
// Dependencies returns no dependencies.
func (a *baseDomain) Dependencies() []asset.Asset {
return []asset.Asset{}
}
// Generate queries for the base domain from the user.
func (a *baseDomain) Generate(asset.Parents) error {
bd, err := asset.GenerateUserProvidedAsset(
a.Name(),
&survey.Question{
Prompt: &survey.Input{
Message: "Base Domain",
Help: "The base domain of the cluster. All DNS records will be sub-domains of this base and will also include the cluster name.\n\nFor AWS, this must be a previously-existing public Route 53 zone. You can check for any already in your account with:\n\n $ aws route53 list-hosted-zones --query 'HostedZones[? !(Config.PrivateZone)].Name' --output text",
},
Validate: survey.ComposeValidators(survey.Required, func(ans interface{}) error {
return validate.DomainName(ans.(string))
}),
},
"OPENSHIFT_INSTALL_BASE_DOMAIN",
)
a.BaseDomain = bd
return err
}
// Name returns the human-friendly name of the asset.
func (a *baseDomain) Name() string {
return "Base Domain"
}