-
Notifications
You must be signed in to change notification settings - Fork 84
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
Notify the apb what cluster it's running on with extravars #577
Conversation
Changes Unknown when pulling 1042494 on rthallisey:extravars into ** on openshift:master**. |
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.
LGTM. I'll change my vote when the test(s) are implemented.
@@ -16,3 +16,8 @@ func (f fakeProvider) DestroySandbox(podName string, namespace string, targets [ | |||
//TODO: Write tests for DestroySandbox using the fake kubernetes client | |||
return | |||
} | |||
|
|||
func (f fakeProvider) GetRuntime() string { |
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 would like to see tests implemented for this change before giving the 👍
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.
deal
@@ -198,6 +198,8 @@ func createExtraVars(context *Context, parameters *Parameters) (string, error) { | |||
if context != nil { | |||
paramsCopy["namespace"] = context.Namespace | |||
} | |||
|
|||
paramsCopy["cluster"] = runtime.Provider.GetRuntime() |
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'm not sure if I believe this should be an extra variable or an environment variable that APBs should load and have default values for...
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'm curious the reason that you have this as an argument instead of an environment variable to the APB.
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.
+1 for curiosity David. The reason I went with extravars is because it will overwrite the value of cluster
right from the command line. Then we don't have to 1) add a default environment var to apb-base, 2) I don't need to rely on the user setting CLUSTER=kubernetes to run the playbooks locally, and 3) I can default the var right in the playbook:
vars:
cluster: kubernetes
docker run docker.io/ansibleplaybookbundle/mediawiki-apb provision --extra-vars cluster=kubernetes
ansible-playbook playbooks/provision.yaml --extra-vars "cluster=kubernetes"
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.
CONDACK, look at a test like @djzager said. Other than that this is acceptable.
Send the variable cluster as an extravar to the apb.
The executor file needs to be re done so tests can be created for each function.
Changes Unknown when pulling 07650ca on rthallisey:extravars into ** on openshift:master**. |
Changes Unknown when pulling 07650ca on rthallisey:extravars into ** on openshift:master**. |
@djzager I added the test in. Let me know if you have any more concerns. |
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.
LGTM. Thank you for adding tests.
…#577) * Notify the apb what cluster it's running on with extravars Send the variable cluster as an extravar to the apb. * Add tests for GetRuntime * Remove extravars test since it uses the runtime pkg The executor file needs to be re done so tests can be created for each function.
Describe what this PR does and why we need it:
Send the variable 'cluster' as an extravar to the apb so it can identify which playbook to run based on the runtime.
Changes proposed in this pull request
depends-on: ansibleplaybookbundle/postgresql-apb#23
depends-on: ansibleplaybookbundle/mediawiki-apb#17