|
10 | 10 | import io.fabric8.kubernetes.api.model.rbac.ClusterRoleBinding;
|
11 | 11 | import io.fabric8.kubernetes.api.model.rbac.Role;
|
12 | 12 | import io.fabric8.kubernetes.api.model.rbac.RoleBinding;
|
13 |
| -import io.fabric8.zjsonpatch.JsonDiff; |
14 | 13 | import io.javaoperatorsdk.operator.ReconcilerUtils;
|
15 | 14 | import io.javaoperatorsdk.operator.api.config.ConfigurationServiceProvider;
|
16 | 15 | import io.javaoperatorsdk.operator.api.reconciler.Context;
|
@@ -50,29 +49,4 @@ protected void updateClonedActual(R actual, R desired) {
|
50 | 49 | var desiredSpec = ReconcilerUtils.getSpec(desired);
|
51 | 50 | ReconcilerUtils.setSpec(actual, desiredSpec);
|
52 | 51 | }
|
53 |
| - |
54 |
| - @Override |
55 |
| - public boolean matches(R actual, R desired, boolean equality) { |
56 |
| - final var objectMapper = ConfigurationServiceProvider.instance().getObjectMapper(); |
57 |
| - |
58 |
| - // reflection will be replaced by this: |
59 |
| - // https://github.com/fabric8io/kubernetes-client/issues/3816 |
60 |
| - var desiredSpecNode = objectMapper.valueToTree(ReconcilerUtils.getSpec(desired)); |
61 |
| - var actualSpecNode = objectMapper.valueToTree(ReconcilerUtils.getSpec(actual)); |
62 |
| - var diffJsonPatch = JsonDiff.asJson(desiredSpecNode, actualSpecNode); |
63 |
| - // In case of equality is set to true, no diffs are allowed, so we return early if diffs exist |
64 |
| - // On contrary (if equality is false), "add" is allowed for cases when for some |
65 |
| - // resources Kubernetes fills-in values into spec. |
66 |
| - final var diffNumber = diffJsonPatch.size(); |
67 |
| - if (equality && diffNumber > 0) { |
68 |
| - return false; |
69 |
| - } |
70 |
| - for (int i = 0; i < diffNumber; i++) { |
71 |
| - String operation = diffJsonPatch.get(i).get("op").asText(); |
72 |
| - if (!operation.equals("add")) { |
73 |
| - return false; |
74 |
| - } |
75 |
| - } |
76 |
| - return true; |
77 |
| - } |
78 | 52 | }
|
0 commit comments