-
Notifications
You must be signed in to change notification settings - Fork 35
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
feat: add ability to add ConfigMap checksum as resource annotations #4174
Conversation
Signed-off-by: Denis Luchkin-Zhou <wyvernzora@gmail.com>
*/ | ||
public addChecksumTo(obj: base.Resource) { | ||
obj.metadata.addAnnotation( | ||
`checksum/${this.node.id}`, |
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.
node.id
is unique only in a given scope, node.addr
will give an app unique id.
`checksum/${this.node.id}`, | |
`cdk8s.io/config-map.${this.node.addr}.checksum`, |
}, | ||
}); | ||
const ns = new Namespace(chart, 'my-namespace', {}); | ||
cm.addChecksumTo(ns); |
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.
Please add documentation for this feature to https://github.com/cdk8s-team/cdk8s-plus/blob/k8s-30/main/docs/plus/config-map.md
No need. At least not right now.
Agree. But its ok. Exposing lazy strings is also quite awkward.
We try to avoid it, but also recognize sometimes it is needed. This seems like one of those times 👍 |
This PR has not received a response in a while and will be closed soon. If you want to keep it open, please leave a comment below @mentioning a maintainer. |
Please reconsider. |
Note: draft change do not merge
One common practice that I have seen is adding the checksum of config map contents as annotations to workloads, so that when a config map is updated, the associated deployments can also get updated and bounced. This PR is an attempt to implement such functionality, though I am not sure about some aspects of this change and would appreciate some feedback.
Specific things that I'd like some feedback on:
cm.checksum
. While the type of that property would need to bestring
, but in fact it needs to beLazy
that produces a string. I am not sure what the practice is for exposing aLazy
as a property on a construct.ConfigMap
results in this awkwardaddChecksumTo()
API. I'd appreciate any input on what would be a good API pattern for adding these checksum annotations.json-stable-stringify
to make sure that hashes come out consistent. What are the opinions of this project on adding dependencies?