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
Default lxd region #9056
Default lxd region #9056
Conversation
Update the pollster interaction so that we can have default naming for object key names. To improve the UI/UX for adding a LXD cloud interactively we want to state that there can be a region and that it can be default, we do allow you to override this when adding a cloud, but a sane default should suffice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed with @SimonRichardson
Interesting, that if you created different LXD clusters (and assuming the network set-up allowed containers to communicate), you could add them as regions to one LXD cloud.
This would be a way of getting around the requirement of homogeneous machines per LXD cluster - a vanilla cluster, a GPU cluster etc as regions of a single cloud.
Ping @mitechie with these musings.
|
Singular: "region", | ||
Plural: "regions", | ||
Default: "default", | ||
PromptDefault: "use default", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the Default is "default", having PromptDefault as "use default" had me confused. Whether "default" was literal or not. Suggest not setting a PromptDefault. Then the Default will be picked up for the prompt, e.g.:
Enter region name [default]:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix the wording...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #9057
@@ -65,6 +65,7 @@ type environProvider struct { | |||
var cloudSchema = &jsonschema.Schema{ | |||
Type: []jsonschema.Type{jsonschema.ObjectType}, | |||
Required: []string{cloud.EndpointKey, cloud.AuthTypesKey}, | |||
Order: []string{cloud.EndpointKey, cloud.AuthTypesKey, cloud.RegionsKey}, | |||
// Order doesn't matter since there's only one thing to ask about. Add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment no longer valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, I'll remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #9057
if schema.Default != nil { | ||
var def string | ||
if schema.PromptDefault != nil { | ||
def = fmt.Sprintf("%v", schema.PromptDefault) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any chance you want to add allowing for an env var here as with pr 9015? then we can uncomment provider/openstack/provider.go: 126 and remove the TODO. :-D
if schema.PromptDefault != nil {
def = fmt.Sprintf("%v", schema.PromptDefault)
}
var defFromEnvVar string
if len(schema.EnvVars) > 0 {
for _, envVar := range schema.EnvVars {
value := os.Getenv(envVar)
if value != "" {
defFromEnvVar = value
def = defFromEnvVar
break
}
}
}
if def == "" {
def = fmt.Sprintf("%v", schema.Default)
}
and a change at line 415 perhaps too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that in another PR
There is a small bug... You can now juju add-cloud for openstack and not provide a region, where this wasn't possible before. |
Wow, that's really strange... I'll fix asap Monday |
It's actually because the default is |
Description of change
Update the pollster interaction so that we can have default naming
for object key names. To improve the UI/UX for adding a LXD cloud
interactively we want to state that there can be a region and that
it can be default, we do allow you to override this when adding a
cloud, but a sane default should suffice.
QA steps
Then verify with:
Documentation changes
Allows you to set a default region when adding a cloud, so that when
calling
juju clouds
the default region is correctly set.Bug reference
N/A