-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Project Template (v2) #27
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
Conversation
|
@VojtechVitek @smarterclayton review pls? all changes should be already there and it should be updated and simplified for the latest JSON. |
pkg/template/template.go
Outdated
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.
Seems to me like a useless wrapper.
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.
It is used in tests, it might be used in the cmd tool.
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.
This is a useless wrapper (it doesn't do enough to justify existence) - use json.Marshal directly in the tests.
2ae4faa to
9b71d15
Compare
|
@smarterclayton thanks, updated! |
5eff6ba to
bde0ff7
Compare
pkg/template/generator/template.go
Outdated
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.
s/GeneratorTemplate/ExpressionValueGenerator/ ?
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 prefer shorter names ;-) It is in fact generator template.
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.
It still doesn't sound right to me :)
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.
If it's a value generator that should be part of the name.
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.
Needs godoc
pkg/template/template.go
Outdated
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.
Godoc and justification for it being public?
4f9fb4a to
00a315f
Compare
|
@smarterclayton refactored & rebased. Review pls. |
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.
So this will be turned into a replicationcontroller definition as part of the processing into a config file?
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 deployment config controller does that post creation - dconfigs indicate a desire for the described resources to exist but it's their responsibility to create those resources.
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.
ok, what/where is the deployment config controller?
my current mental model is:
project.json -> env variable generator -> project.json(variables resolved) -> k8s config generator -> config.json(consisting of k8s api objects, basically looks like @mfojtik 's "stapled together objects" config.json) -> calls to k8s apiserver
Where does the deployment config controller fit into that?
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.
ok, talked to clayton and he got me straightened out: deployment config will be a k8s api object.
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.
@bparees @smarterclayton so just to clarify, the workflow @bparees proposed above is correct?
I mean, the steps are:
- POST http://localhost:8081/osapi/v1beta1/templates <- project.json -> project_substituted.json
- POST http://localhost:8081/osapi/v1beta1/??? <- project_substituted.json -> config.json
./kubecfg.sh apply config.json
00a315f to
654e07e
Compare
654e07e to
3f8b50d
Compare
|
@smarterclayton any comments? Merge? |
|
Will take a look before monday |
|
That'd be awesome. Thanks! |
|
code lgtm :-) nice job with refactoring @VojtechVitek! |
|
@smarterclayton @VojtechVitek I just noticed that when we adding custom parameters, we actually appending them to the parameter list, which might be a problem when the parameter with the same name already exists in the template. I added method |
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.
Can you provide any case this can happen during runtime? The only I can think of is that somebody will remove all generators and then call GenerateParameterValue, which is very unlikely to happen.
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.
Correct. It's just a check for possible generator initialization failure. We should be safe to remove this, as we have a test case for this.
|
The last commit just improve the test coverage to 93%. |
pkg/template/template.go
Outdated
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 godoc formatting http://blog.golang.org/godoc-documenting-go-code
40ccf02 to
9fb6c6f
Compare
9fb6c6f to
0988895
Compare
|
@smarterclayton @bparees @VojtechVitek according to the mails we exchanges, I will move this PR to the OpenShift kubernetes fork, refactor the example to look more like a k8s Config and add the REST endpoint to OpenShift k8s. Does it sound OK? |
|
PR moved to k8s: openshift/kubernetes#7 |
This PR contains an updated version of the Project Template support based on the latest JSON schema.
It is re-using existing Kubernetes structs and the transformation process is independent from the the data structures.