-
Notifications
You must be signed in to change notification settings - Fork 301
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
refactor(plus): Remove the spec
nesting level on both input and output
#347
Conversation
|
||
this.apiObject = new k8s.Deployment(this, 'Pod', { | ||
this.apiObject = new k8s.Deployment(this, 'Deployment', { |
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.
Latent copy-paste bug...this changes the generated deployment name which explains the changes in some snapshots.
@@ -122,7 +122,7 @@ function doSearch(uri, callback) { | |||
"apiVersion": "apps/v1", | |||
"kind": "Deployment", | |||
"metadata": Object { | |||
"name": "test-chart-deployment-pod-1ef542cf", | |||
"name": "test-chart-deployment-c5d38cbe", |
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.
See comment.
metadata: this.podMetadataTemplate.toJson(), | ||
spec: this.podSpecTemplate._toKube(), | ||
}, | ||
template: this._podTemplate._toPodTemplateSpec(), |
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.
toKube maybe?
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 can't :\
_toKube
is already implemented with a different return value in PodSpec
. See #347 (comment)
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.
oh you mean just without the underscore?
Your pull request will be updated and merged automatically (do not update manually). |
/** | ||
* @internal | ||
*/ | ||
public _toPodTemplateSpec(): k8s.PodTemplateSpec { |
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 felt right, letting this class be responsible for creating the template spec used by Job
and Deployment
. It did mean I have to change the name if we want to preserve a typed return value from these methods.
We can also make this class not extend PodSpec
but rather compose it and then we can use the normal _toKube
, but that felt a bit redundant.
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.
Makes me think we need to rename all these toKube methods to their respective output type
Your pull request will be updated and merged automatically (do not update manually). |
Your pull request will be updated and merged automatically (do not update manually). |
Removed the need to specify various
spec
properties for both pre and post instantiation. Applies to all constructs that used to accept a pod spec.Before
After
BREAKING CHANGE:
spec
was removed from all cdk8s+ constructs and that now have a flat structure. See Example for new usage.pod
to them.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license