-
Notifications
You must be signed in to change notification settings - Fork 1
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
Makefile will now process all files in "values" directory #30
Conversation
Thank you for this contribution. I have few questions.
|
|
||
# | ||
# Rules | ||
# | ||
dist/clusters/%.yml: values/%.yml |
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.
Use variables.
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 used the built in automatic variables:
https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
The real target is actually a so-called phony one "update"
update: $(CLUSTER_FILES)
The list of prerequites is matched against available rules.
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 know these variables. You use them as target definition.
-
What I mean, is that you defined variables on the top of Makefile, that actually, define properly all necessary files (values and clusters), and in the end you do not use these as your target.
How I would see that:
(FILES_CLUSTERS): $(FILES_VALUES)
dist/clusters/%.yml: values/%.yml | ||
kops toolbox template --fail-on-missing \ | ||
--format-yaml \ | ||
--template src/eu-west-1/templates \ | ||
--snippets src/eu-west-1/snippets \ | ||
--values $< \ | ||
> $@ | ||
kops replace --force -f $@ | ||
kops update cluster | ||
kops replace --force -f $@ --name $(patsubst dist/clusters/%.yml,%,$@) |
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.
Use variables, the same below.
|
||
# | ||
# Rules |
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.
How rules differ from targets?
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.
The rule merely describes how the target is created.
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.
- @myspotontheweb I think, we wrongly differ. Rules are defined as following. 1
target : prereq
recipe
This is the rule, how target is created and when it needs to be updated.
Ah! See. Correct me, if I am wrong.
You say: It is intended for the user to use targets only. Rules are internal definitions..
@@ -44,7 +47,7 @@ kops toolbox template --fail-on-missing \ | |||
|
|||
* Generate a cluster from template: | |||
``` | |||
kops create -f clusters/cluster-exampleenv.yml | |||
kops create -f dist/clusters/cluster-exampleenv.yml |
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.
Good catch! 👍
Remaining questions: clean targetI always include one as a way to recover from cases of partial command execution, or to simply force a regeneration of all files, for example
Never have to use it, I include in all my Makefiles SREs with limited accessNote sure the point you're making about sts and assumed roles. We have a simpler setup with kops clusters managed from a single shared S3 bucket, in each cloud account. We purposely don't share buckets between accounts, in order to isolate prod and nonprod infrastructure. |
|
@myspotontheweb A week passed since you have opened a pull-request. |
These changes make the automation more hands off
Testing
Create two dummy files to represent 2 additional kops clusters
Demonstrate the commands generated by Make (Note the "--name" parameters being passed so that multiple clusters can be updated)
Note: