operator-framework / operator-framework/java-operator-sdk
Consider composable non-CRD blocks for workflows / dependencies
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 944
- Forks
- 242
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 43
Description
Currently, all dependencies using the workflow model (seem to) require either declaring them in their own CRD, or expanding on the blocks used inside a single Reconciler.
It would be nice to be able to define a block of dependencies that is reusable in scope. In my particular case, this is so that we can create separate building blocks for commonly reused entities (see datastores, etc) that do not necessarily meet the case for having a standalone CRD.
This is for two reasons:
- The entities themselves maybe managed by other operators and we are considering dependency / ready states for the particular operator.
- The the individual deployments themselves do not reflect something that is of a desired scope for its own CRD. In several cases, this may be because we are developing an application and the particular implementation under the hood may change, or it is something that doesn't necessarily warrant its own set of description.
- The development of commons libraries for shared patterns between operators or, in the case of multi-controller operators, between different pieces.
Additionally, having a mechanism by which dependencies can be mapped at the level of the individual resource, especially in the case of multiple config maps, secrets, volumeclaims, etc, can then be declared at the point of the dependent resource.
class RedisConfigMap<T: HasMetadata>(val app: App) : AbstractNamedCRUDDependentResource<ConfigMap, T>(ConfigMap::class.java)
{
companion object {
fun <T: HasMetadata> withDiscriminator(app: App) : AbstractNamedCRUDDependentResource<ConfigMap, T> {
return RedisConfigMap<T>(app).withDiscriminator()
}
}
override fun desired(primary: T?, context: Context<T>?): ConfigMap {
return ConfigMapBuilder()
.withNewMetadata()
.withNamespace(primary!!.metadata.name)
.withName(name())
.endMetadata()
.addToData("redis-config", "")
.build()
}
override fun name(): String {
return "${app.appName}-redis-config"
}
Is an example of a piece of code I am working on (it's Kotlin, so, bear with me -- and thank you glasskube!)
It would be nice if, instead of piling the configuration into annotations on the Resolver, individual resources could also support declaring their dependencies.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the workflow model, Reconciler, and Resolver concepts referenced in the issue, then inspect AbstractNamedCRUDDependentResource and the RedisConfigMap example. Compare the current CRD and annotation-based dependency declarations with the requested reusable blocks and per-resource dependencies. Done means the supported scope and API for composable dependency blocks are defined and demonstrated, with coverage for reused resources such as ConfigMaps, Secrets, and PersistentVolumeClaims.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin, kubernetes
- Domain
- devops, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100