Closed xxx7xxxx closed 3 years ago
It's good to refactor about reducing numbers of initializing containers
Updated as comments along with ImagePullPolicy assigned with IfNotPresent by default
scenarios 0
You seem not to delete the meshdeployment with the same name.
scenarios 1
According to the quick research, it seems we don't have that interface to block the system-level controller to deploy Deployment
immediately after it was creating. It seems not to give us the ability to register pre-hook.
scenarios 2
kubectl replace
will work fine instead of kubectl apply
, the mechanism of two interfaces decides the different results[1]. We add more fields for the original spec, so applying part of spec will cause the Not Found
issue.
Could we organize the canary labels in the mesh annotations?
Sure, the example could be:
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: spring-petclinic
name: vets-service
annotations:
mesh.megaease.com/enable: "true"
mesh.megaease.com/service-name: "vets-service"
mesh.megaease.com/service-labels: "version=beta,env=production"
It seems harder than structural labels to write and read, but acceptable for me.
FYI: Other mesh products leverage Dynamic Admission Control to modify objects sent to the API server to enforce custom defaults.
Updated with Dynamic Admission Control.
There are some conflicts should be resolved
Conflict fixed. I think it's cool to support more objects but this PR is big enough, I'd like to support them in my next contribution.
Detail
Actually, this is also a refactoring in implementing the new feature:
And there left something to complete, which of part were commented, and:
After them, I found more trivial or significant stuff needed to be improved, which will be opened issues in the next contribution.
Reference
There lists the old and new specs of deployment after injecting the sidecar. The same/unimportant part has been committed. We can see the two init containers have been merged into one, and the volumes and volumeMounts became more consistent. The config of k8s objects are complex enough, it's very important to manage the complexity of them carefully.
old-vets-service.yaml:
new-vets-service.yaml:
The diff of them: