Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Add cluster connection settings user input in cluster modal #217

Merged

Conversation

arbulu89
Copy link
Contributor

@arbulu89 arbulu89 commented Sep 7, 2021

Implement the option to customize the ansible ssh connection settings, specifically the user that is used during the ssh connections.
This is done through the cluster settings modal.

It follows the next logic:

  • User stored data goes to: trento/v0/clusters/mycluster/user_settings/connection/ as map
  • If the data is not stored, the code tries to use the Azure metadata information to get the OsProfile admin user name
  • Ansible inventory is changed based on this logic, adding the ansible_user value

Demo:

connection_settings

Follow up issues:
#218
#219

@arbulu89
Copy link
Contributor Author

arbulu89 commented Sep 9, 2021

@fabriziosestito @rtorrero @aleksei-burlakov @dottorblaster @stefanotorresi
I need a review here to complete all the changes for the 0.4.0 release

Comment on lines +385 to +396
func azureMeta(userIndex int) map[string]interface{} {
return map[string]interface{}{
"provider": cloud.Azure,
"metadata": &cloud.AzureMetadata{
Compute: cloud.Compute{
OsProfile: cloud.OsProfile{
AdminUserName: fmt.Sprintf("defuser%d", userIndex),
},
},
},
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Very declarative, I like it!

Copy link
Contributor

@dottorblaster dottorblaster left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@fabriziosestito fabriziosestito left a comment

Choose a reason for hiding this comment

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

@arbulu89 I tried to run the PR on gollum, the default user is an empty column in the modal.
Is this desired or we want to show "root" in the case we are not running on Azure?

image

P.S: Please don't laugh at my cluster petname

@arbulu89
Copy link
Contributor Author

@arbulu89 I tried to run the PR on gollum, the default user is an empty column in the modal.
Is this desired or we want to show "root" in the case we are not running on Azure?

image

P.S: Please don't laugh at my cluster petname

This value is coming from the cloud metadata, so in libvirt we don't have it. Behind the scenes, if it is not being shown there root will be used.
The thing is that there is not any way of getting this default value, so using root would be a hardcoded value on the code.
We could put it there to have at least some value in the web ui

@fabriziosestito
Copy link
Member

@arbulu89 I tried to run the PR on gollum, the default user is an empty column in the modal.
Is this desired or we want to show "root" in the case we are not running on Azure?
image
P.S: Please don't laugh at my cluster petname

This value is coming from the cloud metadata, so in libvirt we don't have it. Behind the scenes, if it is not being shown there root will be used.
The thing is that there is not any way of getting this default value, so using root would be a hardcoded value on the code.
We could put it there to have at least some value in the web ui

Oh ok, yes I would go with the hardcoded one in case we are not on azure, just to be consistent with the UI

@arbulu89
Copy link
Contributor Author

arbulu89 commented Sep 13, 2021

@arbulu89 I tried to run the PR on gollum, the default user is an empty column in the modal.
Is this desired or we want to show "root" in the case we are not running on Azure?
image
P.S: Please don't laugh at my cluster petname

This value is coming from the cloud metadata, so in libvirt we don't have it. Behind the scenes, if it is not being shown there root will be used.
The thing is that there is not any way of getting this default value, so using root would be a hardcoded value on the code.
We could put it there to have at least some value in the web ui

Oh ok, yes I would go with the hardcoded one in case we are not on azure, just to be consistent with the UI

root default user now is showed in the modal if there is not any cloud metadata found (874c1cd):

image

@arbulu89 arbulu89 force-pushed the feature/cluster-connection-settings branch from 874c1cd to f824d65 Compare September 13, 2021 08:46
@arbulu89 arbulu89 merged commit 9b13a21 into trento-project:runner Sep 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants