Open kim0 opened 5 years ago
@sagikazarmark .. I'm hitting major issues making use of this provider due to the above. Unfortunately, during the course of testing I have to live edit many objects and expected the provider to detect and re-apply the configs when run. That does not happen.
Hoping we can get a quick fix please, since detecting config drift, is a core feature of terraform.
Thanks a lot for this provider
Hey @kim0
Sorry, I haven't been able to allocate much time on this provider lately.
I wonder if #2 would be a solution. We plan to rewrite the current provider using threeway diff checking (the same algorithm kubectl apply
uses to decide what it should do).
Thanks .. I guess I'm a little worried if you try to diff on your own, that the diffing would break from the many fields which are added dynamically by kubernetes (like, selflink, revision, last-applied-configuration ...etc). Not sure if there's a smart way to ignore those and only diff the "important" fields.
Actually, just diffing against last-applied-configuration, was my way of only diffing those important fields. I also know that recent version of kubernetes offer "server side diff", which might be something we want to use. But overall, I'm Ok with anything that works
PS: One last question, I'm a little confused if today, the provider is able to detect manual changes to kubernetes and reapply the yaml files, or not ? Does that functionality exist today, even if it's blindly reapplies ?
Thanks
We wrote a library for diffing k8s objects: https://github.com/banzaicloud/k8s-objectmatcher
The plan is to use it in this provider as well.
Is your feature request related to a problem? Please describe.
Yes, when applying any manifest (say HPA). Then changing it live
kubectl edit hpa foo
. Then usingterraform apply
, it should but does NOT detect that the object has changed outside its controlDescribe the solution you'd like to see
Kubernetes tracks the last applied configuration in
kubectl.kubernetes.io/last-applied-configuration
.. This provider after creating a resource, should parse out that field and store it in TF state. Every time the state is refreshed, it should be refreshed. In case, there is a difference between 2 runs, the update method should be called and the yaml files reappliedDescribe alternatives you've considered
resourceVersion
numberskubectl diff -f
to detect any drift