-
Notifications
You must be signed in to change notification settings - Fork 64
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
Allow specifying k8s annotations and labels for generated Deployments and other resources #632
Comments
we can use attributes with keys pre-defined in devfile ap, e.g. |
Attributes approach would work, but I'm not sure if it is a good way to approach this. There are also fields from k8s PodSpec and ContainerSpec that we will need to expose like |
For There are two cases we want to have more discussion with you, 1. single container case and 2. multi-container case
for container
for annotation The default run & build commands target Then library expects Odo to provide the proper annotation when generating the deployment spec, since Odo knows which commands to run, and which container should be treat as primary container in the deployment.
Library can provide validation function to Odo and returns warning if there is an annotation key with conflict value defined. but odo is responsible to pass in correct resource(e.g. containers, endpoints, etc.) and annotations when calling generator functions. |
This is not use case that is specfic to odo in any way.
If there is only one Deployment and devfile defines setting conflicting values for deployment labels or annotations than it should be an error state.
Yes tooling using library should pass extra annotations or labels, but the labels and annotations that we are talking about in this case are required for application to run and as such library generators should populate it accordingly. Because in some cases application won't run correctly if annotations and labels are not set properly I think that this should be part of the core devfile structure, and not just attributes. |
As discussed in the team meeting, each container can have an annotation field. The deployment annotation will append all container's annotation, except for containers with Now proposing the annotation with struct:
Example of a valid case:
Example of an invalid case:
|
I have a question about how this will work. For example, in the DevWorkspace Operator, we're required to maintain sync between the Devfile and the deployment it represents. Adding the istio annotation breaks that assumption, as istio will have to modify the deployment to inject sidecars and could cause conflicts. How is this handled in other applications (e.g. |
This is quite a common problem. Odo already had the similar problem with Service Biding Operator that injects volumes and environment variables into the Deployment.
The solution is to use server side apply. |
Sadly, I don't think server-side apply is supported in the controller runtime, but that makes sense. |
I think that operators pattern was the main reason this was added to api. |
As discussed in today's call, we changed the proposal to have container level annotation defines deployment & service annotation, and move ingress/route annotation to endpoint level.
Example of a valid case:
|
Which area this feature is related to?
/area api
/area library
Which functionality do you think we should add?
Add a way to define annotations and labels that should be applied to the generated Kubernetes resources.
In some cases annotations or labels can be application's functional requirement. In that case it should be defined in devfile.
Why is this needed? Is your feature request related to a problem?
In some cases it is required to add annotations or labels to the resources.
For example can Istio, requires Deployments to have
sidecar.istio.io/inject: "true"
annotation.Labels might be usefull ofr external visualizers, cleaners and other tools.
Related feature request for odo redhat-developer/odo#2623
The text was updated successfully, but these errors were encountered: