Commit ac5705d
committed
✨ Fakeclient: Add apply support
This change is a POC for adding apply patch support to the fake client.
This relies on the upstream support for this which is implemented in a
new [FieldManagedObjectTracker][0]. There are two major problems with
this for us though:
1. It requires a [type converter][1] which gets initialized with a
[parser][2] that knows how the type look like. It doesn't look like
it is possible to pass multiple parsers, which means the resulting
client can only deals with the set of types the parser knows about,
for example what is in client-go but it will not work with CRDs
2. We have some code that wants to look at the object after it was
patched to check if its valid - Since this is implemented in the
tracker, it doesn't look like its possible to dry run the patch
[0]: https://github.com/kubernetes/kubernetes/blob/4dc7a48ac6fb631a84e1974772bf7b8fd0bb9c59/staging/src/k8s.io/client-go/testing/fixture.go#L643
[1]: https://github.com/kubernetes/kubernetes/blob/4dc7a48ac6fb631a84e1974772bf7b8fd0bb9c59/staging/src/k8s.io/client-go/applyconfigurations/utils.go#L1739
[2]: https://github.com/kubernetes/kubernetes/blob/4dc7a48ac6fb631a84e1974772bf7b8fd0bb9c59/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go#L281 parent 5af6ffa commit ac5705d
2 files changed
+57
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
233 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
234 | 240 | | |
235 | 241 | | |
236 | 242 | | |
| |||
868 | 874 | | |
869 | 875 | | |
870 | 876 | | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
871 | 883 | | |
872 | 884 | | |
873 | 885 | | |
| |||
880 | 892 | | |
881 | 893 | | |
882 | 894 | | |
883 | | - | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
884 | 900 | | |
885 | 901 | | |
886 | 902 | | |
| |||
895 | 911 | | |
896 | 912 | | |
897 | 913 | | |
898 | | - | |
| 914 | + | |
899 | 915 | | |
900 | 916 | | |
901 | 917 | | |
| |||
954 | 970 | | |
955 | 971 | | |
956 | 972 | | |
957 | | - | |
| 973 | + | |
958 | 974 | | |
959 | 975 | | |
960 | 976 | | |
961 | 977 | | |
962 | 978 | | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
963 | 982 | | |
964 | 983 | | |
965 | 984 | | |
| |||
1005 | 1024 | | |
1006 | 1025 | | |
1007 | 1026 | | |
1008 | | - | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
1009 | 1039 | | |
1010 | 1040 | | |
1011 | 1041 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2169 | 2169 | | |
2170 | 2170 | | |
2171 | 2171 | | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
2172 | 2194 | | |
2173 | 2195 | | |
2174 | 2196 | | |
| |||
0 commit comments