qontract-reconcile 0.10.1rc763__py3-none-any.whl → 0.10.1rc765__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {qontract_reconcile-0.10.1rc763.dist-info → qontract_reconcile-0.10.1rc765.dist-info}/METADATA +1 -1
  2. {qontract_reconcile-0.10.1rc763.dist-info → qontract_reconcile-0.10.1rc765.dist-info}/RECORD +27 -31
  3. reconcile/external_resources/aws.py +85 -0
  4. reconcile/external_resources/factories.py +133 -0
  5. reconcile/external_resources/integration.py +95 -0
  6. reconcile/external_resources/manager.py +350 -0
  7. reconcile/external_resources/meta.py +4 -0
  8. reconcile/external_resources/metrics.py +20 -0
  9. reconcile/external_resources/model.py +244 -0
  10. reconcile/external_resources/reconciler.py +249 -0
  11. reconcile/external_resources/secrets_sync.py +229 -0
  12. reconcile/external_resources/state.py +246 -0
  13. reconcile/saas_auto_promotions_manager/meta.py +1 -1
  14. reconcile/saas_auto_promotions_manager/subscriber.py +52 -2
  15. reconcile/saas_auto_promotions_manager/utils/saas_files_inventory.py +4 -0
  16. reconcile/test/saas_auto_promotions_manager/conftest.py +63 -0
  17. reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/conftest.py +0 -37
  18. reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/test_desired_state.py +20 -14
  19. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/conftest.py +0 -43
  20. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_multiple_namespaces.py +4 -11
  21. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_single_namespace.py +12 -19
  22. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_single_target.py +6 -12
  23. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_json_path_selector.py +8 -15
  24. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/data_keys.py +0 -4
  25. reconcile/test/saas_auto_promotions_manager/subscriber/conftest.py +0 -89
  26. reconcile/test/saas_auto_promotions_manager/subscriber/data_keys.py +0 -11
  27. reconcile/test/saas_auto_promotions_manager/subscriber/test_content_hash.py +0 -130
  28. reconcile/test/saas_auto_promotions_manager/subscriber/test_diff.py +0 -161
  29. reconcile/test/saas_auto_promotions_manager/subscriber/test_multiple_channels_config_hash.py +0 -218
  30. reconcile/test/saas_auto_promotions_manager/subscriber/test_multiple_channels_moving_ref.py +0 -216
  31. reconcile/test/saas_auto_promotions_manager/subscriber/test_multiple_publishers_moving_ref.py +0 -129
  32. reconcile/test/saas_auto_promotions_manager/subscriber/test_single_channel_with_single_publisher.py +0 -330
  33. reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/__init__.py +0 -0
  34. reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_multiple_publishers_for_single_channel.py +0 -68
  35. reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_use_target_config_hash.py +0 -62
  36. reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_with_auto_promote.py +0 -73
  37. reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_without_auto_promote.py +0 -64
  38. {qontract_reconcile-0.10.1rc763.dist-info → qontract_reconcile-0.10.1rc765.dist-info}/WHEEL +0 -0
  39. {qontract_reconcile-0.10.1rc763.dist-info → qontract_reconcile-0.10.1rc765.dist-info}/entry_points.txt +0 -0
  40. {qontract_reconcile-0.10.1rc763.dist-info → qontract_reconcile-0.10.1rc765.dist-info}/top_level.txt +0 -0
  41. /reconcile/{test/saas_auto_promotions_manager/subscriber → external_resources}/__init__.py +0 -0
@@ -1,218 +0,0 @@
1
- from collections.abc import (
2
- Callable,
3
- Mapping,
4
- )
5
- from typing import Any
6
-
7
- from reconcile.saas_auto_promotions_manager.subscriber import (
8
- ConfigHash,
9
- Subscriber,
10
- )
11
-
12
- from .data_keys import (
13
- CHANNELS,
14
- CONFIG_HASH,
15
- CUR_CONFIG_HASHES,
16
- CUR_SUBSCRIBER_REF,
17
- REAL_WORLD_SHA,
18
- SUCCESSFUL_DEPLOYMENT,
19
- )
20
-
21
-
22
- def test_single_new_config_hash(
23
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
24
- ):
25
- subscriber = subscriber_builder({
26
- CUR_SUBSCRIBER_REF: "current_sha",
27
- CUR_CONFIG_HASHES: [
28
- ConfigHash(
29
- channel="channel-a",
30
- parent_saas="publisher_a",
31
- target_config_hash="pub_a_hash",
32
- ),
33
- ConfigHash(
34
- channel="channel-b",
35
- parent_saas="publisher_b",
36
- target_config_hash="pub_b_hash",
37
- ),
38
- ],
39
- CHANNELS: {
40
- "channel-a": {
41
- "publisher_a": {
42
- REAL_WORLD_SHA: "current_sha",
43
- CONFIG_HASH: "new_pub_a_hash",
44
- }
45
- },
46
- "channel-b": {
47
- "publisher_b": {
48
- REAL_WORLD_SHA: "current_sha",
49
- CONFIG_HASH: "pub_b_hash",
50
- }
51
- },
52
- },
53
- })
54
- subscriber.compute_desired_state()
55
- expected_config_hashes = [
56
- ConfigHash(
57
- channel="channel-a",
58
- parent_saas="publisher_a",
59
- target_config_hash="new_pub_a_hash",
60
- ),
61
- ConfigHash(
62
- channel="channel-b",
63
- parent_saas="publisher_b",
64
- target_config_hash="pub_b_hash",
65
- ),
66
- ]
67
- assert subscriber.desired_ref == "current_sha"
68
- assert subscriber.desired_hashes == expected_config_hashes
69
-
70
-
71
- def test_both_new_config_hashes(
72
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
73
- ):
74
- subscriber = subscriber_builder({
75
- CUR_SUBSCRIBER_REF: "current_sha",
76
- CUR_CONFIG_HASHES: [
77
- ConfigHash(
78
- channel="channel-a",
79
- parent_saas="publisher_a",
80
- target_config_hash="pub_a_hash",
81
- ),
82
- ConfigHash(
83
- channel="channel-b",
84
- parent_saas="publisher_b",
85
- target_config_hash="pub_b_hash",
86
- ),
87
- ],
88
- CHANNELS: {
89
- "channel-a": {
90
- "publisher_a": {
91
- REAL_WORLD_SHA: "current_sha",
92
- CONFIG_HASH: "new_pub_a_hash",
93
- }
94
- },
95
- "channel-b": {
96
- "publisher_b": {
97
- REAL_WORLD_SHA: "current_sha",
98
- CONFIG_HASH: "new_pub_b_hash",
99
- }
100
- },
101
- },
102
- })
103
- subscriber.compute_desired_state()
104
- expected_config_hashes = [
105
- ConfigHash(
106
- channel="channel-a",
107
- parent_saas="publisher_a",
108
- target_config_hash="new_pub_a_hash",
109
- ),
110
- ConfigHash(
111
- channel="channel-b",
112
- parent_saas="publisher_b",
113
- target_config_hash="new_pub_b_hash",
114
- ),
115
- ]
116
- assert subscriber.desired_ref == "current_sha"
117
- assert subscriber.desired_hashes == expected_config_hashes
118
-
119
-
120
- def test_both_new_config_hashes_one_bad_deployment(
121
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
122
- ):
123
- subscriber = subscriber_builder({
124
- CUR_SUBSCRIBER_REF: "current_sha",
125
- CUR_CONFIG_HASHES: [
126
- ConfigHash(
127
- channel="channel-a",
128
- parent_saas="publisher_a",
129
- target_config_hash="pub_a_hash",
130
- ),
131
- ConfigHash(
132
- channel="channel-b",
133
- parent_saas="publisher_b",
134
- target_config_hash="pub_b_hash",
135
- ),
136
- ],
137
- CHANNELS: {
138
- "channel-a": {
139
- "publisher_a": {
140
- REAL_WORLD_SHA: "current_sha",
141
- CONFIG_HASH: "new_pub_a_hash",
142
- SUCCESSFUL_DEPLOYMENT: False,
143
- }
144
- },
145
- "channel-b": {
146
- "publisher_b": {
147
- REAL_WORLD_SHA: "current_sha",
148
- CONFIG_HASH: "new_pub_b_hash",
149
- }
150
- },
151
- },
152
- })
153
- subscriber.compute_desired_state()
154
- expected_config_hashes = [
155
- ConfigHash(
156
- channel="channel-a",
157
- parent_saas="publisher_a",
158
- target_config_hash="pub_a_hash",
159
- ),
160
- ConfigHash(
161
- channel="channel-b",
162
- parent_saas="publisher_b",
163
- target_config_hash="new_pub_b_hash",
164
- ),
165
- ]
166
- assert subscriber.desired_ref == "current_sha"
167
- assert subscriber.desired_hashes == expected_config_hashes
168
-
169
-
170
- def test_both_new_config_hashes_all_bad_deployments(
171
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
172
- ):
173
- subscriber = subscriber_builder({
174
- CUR_SUBSCRIBER_REF: "current_sha",
175
- CUR_CONFIG_HASHES: [
176
- ConfigHash(
177
- channel="channel-a",
178
- parent_saas="publisher_a",
179
- target_config_hash="pub_a_hash",
180
- ),
181
- ConfigHash(
182
- channel="channel-b",
183
- parent_saas="publisher_b",
184
- target_config_hash="pub_b_hash",
185
- ),
186
- ],
187
- CHANNELS: {
188
- "channel-a": {
189
- "publisher_a": {
190
- REAL_WORLD_SHA: "current_sha",
191
- CONFIG_HASH: "new_pub_a_hash",
192
- SUCCESSFUL_DEPLOYMENT: False,
193
- }
194
- },
195
- "channel-b": {
196
- "publisher_b": {
197
- REAL_WORLD_SHA: "current_sha",
198
- CONFIG_HASH: "new_pub_b_hash",
199
- SUCCESSFUL_DEPLOYMENT: False,
200
- }
201
- },
202
- },
203
- })
204
- subscriber.compute_desired_state()
205
- expected_config_hashes = [
206
- ConfigHash(
207
- channel="channel-a",
208
- parent_saas="publisher_a",
209
- target_config_hash="pub_a_hash",
210
- ),
211
- ConfigHash(
212
- channel="channel-b",
213
- parent_saas="publisher_b",
214
- target_config_hash="pub_b_hash",
215
- ),
216
- ]
217
- assert subscriber.desired_ref == "current_sha"
218
- assert subscriber.desired_hashes == expected_config_hashes
@@ -1,216 +0,0 @@
1
- from collections.abc import (
2
- Callable,
3
- Mapping,
4
- )
5
- from typing import Any
6
-
7
- from reconcile.saas_auto_promotions_manager.subscriber import (
8
- ConfigHash,
9
- Subscriber,
10
- )
11
-
12
- from .data_keys import (
13
- CHANNELS,
14
- CONFIG_HASH,
15
- CUR_CONFIG_HASHES,
16
- CUR_SUBSCRIBER_REF,
17
- REAL_WORLD_SHA,
18
- SUCCESSFUL_DEPLOYMENT,
19
- )
20
-
21
-
22
- def test_no_change(
23
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
24
- ):
25
- subscriber = subscriber_builder({
26
- CUR_SUBSCRIBER_REF: "current_sha",
27
- CUR_CONFIG_HASHES: [
28
- ConfigHash(
29
- channel="channel-a",
30
- parent_saas="publisher_a",
31
- target_config_hash="pub_a_hash",
32
- ),
33
- ConfigHash(
34
- channel="channel-b",
35
- parent_saas="publisher_b",
36
- target_config_hash="pub_b_hash",
37
- ),
38
- ],
39
- CHANNELS: {
40
- "channel-a": {
41
- "publisher_a": {
42
- REAL_WORLD_SHA: "current_sha",
43
- CONFIG_HASH: "pub_a_hash",
44
- }
45
- },
46
- "channel-b": {
47
- "publisher_b": {
48
- REAL_WORLD_SHA: "current_sha",
49
- CONFIG_HASH: "pub_b_hash",
50
- }
51
- },
52
- },
53
- })
54
- subscriber.compute_desired_state()
55
- expected_config_hashes = [
56
- ConfigHash(
57
- channel="channel-a",
58
- parent_saas="publisher_a",
59
- target_config_hash="pub_a_hash",
60
- ),
61
- ConfigHash(
62
- channel="channel-b",
63
- parent_saas="publisher_b",
64
- target_config_hash="pub_b_hash",
65
- ),
66
- ]
67
- assert subscriber.desired_ref == "current_sha"
68
- assert subscriber.desired_hashes == expected_config_hashes
69
-
70
-
71
- def test_moving_ref(
72
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
73
- ):
74
- subscriber = subscriber_builder({
75
- CUR_SUBSCRIBER_REF: "current_sha",
76
- CUR_CONFIG_HASHES: [
77
- ConfigHash(
78
- channel="channel-a",
79
- parent_saas="publisher_a",
80
- target_config_hash="pub_a_hash",
81
- ),
82
- ConfigHash(
83
- channel="channel-b",
84
- parent_saas="publisher_b",
85
- target_config_hash="pub_b_hash",
86
- ),
87
- ],
88
- CHANNELS: {
89
- "channel-a": {
90
- "publisher_a": {
91
- REAL_WORLD_SHA: "new_sha",
92
- CONFIG_HASH: "pub_a_hash",
93
- }
94
- },
95
- "channel-b": {
96
- "publisher_b": {
97
- REAL_WORLD_SHA: "new_sha",
98
- CONFIG_HASH: "pub_b_hash",
99
- }
100
- },
101
- },
102
- })
103
- subscriber.compute_desired_state()
104
- expected_config_hashes = [
105
- ConfigHash(
106
- channel="channel-a",
107
- parent_saas="publisher_a",
108
- target_config_hash="pub_a_hash",
109
- ),
110
- ConfigHash(
111
- channel="channel-b",
112
- parent_saas="publisher_b",
113
- target_config_hash="pub_b_hash",
114
- ),
115
- ]
116
- assert subscriber.desired_ref == "new_sha"
117
- assert subscriber.desired_hashes == expected_config_hashes
118
-
119
-
120
- def test_moving_ref_mismatch(
121
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
122
- ):
123
- subscriber = subscriber_builder({
124
- CUR_SUBSCRIBER_REF: "current_sha",
125
- CUR_CONFIG_HASHES: [
126
- ConfigHash(
127
- channel="channel-a",
128
- parent_saas="publisher_a",
129
- target_config_hash="pub_a_hash",
130
- ),
131
- ConfigHash(
132
- channel="channel-b",
133
- parent_saas="publisher_b",
134
- target_config_hash="pub_b_hash",
135
- ),
136
- ],
137
- CHANNELS: {
138
- "channel-a": {
139
- "publisher_a": {
140
- REAL_WORLD_SHA: "new_sha",
141
- CONFIG_HASH: "pub_a_hash",
142
- }
143
- },
144
- "channel-b": {
145
- "publisher_b": {
146
- REAL_WORLD_SHA: "other_new_sha",
147
- CONFIG_HASH: "pub_b_hash",
148
- }
149
- },
150
- },
151
- })
152
- subscriber.compute_desired_state()
153
- expected_config_hashes = [
154
- ConfigHash(
155
- channel="channel-a",
156
- parent_saas="publisher_a",
157
- target_config_hash="pub_a_hash",
158
- ),
159
- ConfigHash(
160
- channel="channel-b",
161
- parent_saas="publisher_b",
162
- target_config_hash="pub_b_hash",
163
- ),
164
- ]
165
- assert subscriber.desired_ref == "current_sha"
166
- assert subscriber.desired_hashes == expected_config_hashes
167
-
168
-
169
- def test_moving_ref_bad_deployment(
170
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
171
- ):
172
- subscriber = subscriber_builder({
173
- CUR_SUBSCRIBER_REF: "current_sha",
174
- CUR_CONFIG_HASHES: [
175
- ConfigHash(
176
- channel="channel-a",
177
- parent_saas="publisher_a",
178
- target_config_hash="pub_a_hash",
179
- ),
180
- ConfigHash(
181
- channel="channel-b",
182
- parent_saas="publisher_b",
183
- target_config_hash="pub_b_hash",
184
- ),
185
- ],
186
- CHANNELS: {
187
- "channel-a": {
188
- "publisher_a": {
189
- REAL_WORLD_SHA: "new_sha",
190
- CONFIG_HASH: "pub_a_hash",
191
- SUCCESSFUL_DEPLOYMENT: False,
192
- }
193
- },
194
- "channel-b": {
195
- "publisher_b": {
196
- REAL_WORLD_SHA: "new_sha",
197
- CONFIG_HASH: "pub_b_hash",
198
- }
199
- },
200
- },
201
- })
202
- subscriber.compute_desired_state()
203
- expected_config_hashes = [
204
- ConfigHash(
205
- channel="channel-a",
206
- parent_saas="publisher_a",
207
- target_config_hash="pub_a_hash",
208
- ),
209
- ConfigHash(
210
- channel="channel-b",
211
- parent_saas="publisher_b",
212
- target_config_hash="pub_b_hash",
213
- ),
214
- ]
215
- assert subscriber.desired_ref == "current_sha"
216
- assert subscriber.desired_hashes == expected_config_hashes
@@ -1,129 +0,0 @@
1
- from collections.abc import (
2
- Callable,
3
- Mapping,
4
- )
5
- from typing import Any
6
-
7
- from reconcile.saas_auto_promotions_manager.subscriber import Subscriber
8
-
9
- from .data_keys import (
10
- CHANNELS,
11
- CUR_CONFIG_HASHES,
12
- CUR_SUBSCRIBER_REF,
13
- REAL_WORLD_SHA,
14
- SUCCESSFUL_DEPLOYMENT,
15
- USE_TARGET_CONFIG_HASH,
16
- )
17
-
18
-
19
- def test_no_change(
20
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
21
- ):
22
- subscriber = subscriber_builder({
23
- USE_TARGET_CONFIG_HASH: False,
24
- CUR_SUBSCRIBER_REF: "current_sha",
25
- CUR_CONFIG_HASHES: [],
26
- CHANNELS: {
27
- "channel-a": {
28
- "publisher_a": {
29
- REAL_WORLD_SHA: "current_sha",
30
- },
31
- "publisher_b": {
32
- REAL_WORLD_SHA: "current_sha",
33
- },
34
- },
35
- "channel-b": {
36
- "publisher_c": {
37
- REAL_WORLD_SHA: "current_sha",
38
- },
39
- },
40
- },
41
- })
42
- subscriber.compute_desired_state()
43
- assert subscriber.desired_ref == "current_sha"
44
- assert subscriber.desired_hashes == []
45
-
46
-
47
- def test_moving_ref(
48
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
49
- ):
50
- subscriber = subscriber_builder({
51
- USE_TARGET_CONFIG_HASH: False,
52
- CUR_SUBSCRIBER_REF: "current_sha",
53
- CUR_CONFIG_HASHES: [],
54
- CHANNELS: {
55
- "channel-a": {
56
- "publisher_a": {
57
- REAL_WORLD_SHA: "new_sha",
58
- },
59
- "publisher_b": {
60
- REAL_WORLD_SHA: "new_sha",
61
- },
62
- },
63
- "channel-b": {
64
- "publisher_c": {
65
- REAL_WORLD_SHA: "new_sha",
66
- }
67
- },
68
- },
69
- })
70
- subscriber.compute_desired_state()
71
- assert subscriber.desired_ref == "new_sha"
72
- assert subscriber.desired_hashes == []
73
-
74
-
75
- def test_moving_ref_mismatch(
76
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
77
- ):
78
- subscriber = subscriber_builder({
79
- USE_TARGET_CONFIG_HASH: False,
80
- CUR_SUBSCRIBER_REF: "current_sha",
81
- CUR_CONFIG_HASHES: [],
82
- CHANNELS: {
83
- "channel-a": {
84
- "publisher_a": {
85
- REAL_WORLD_SHA: "new_sha",
86
- },
87
- "publisher_b": {
88
- REAL_WORLD_SHA: "other_new_sha",
89
- },
90
- },
91
- "channel-b": {
92
- "publisher_c": {
93
- REAL_WORLD_SHA: "new_sha",
94
- }
95
- },
96
- },
97
- })
98
- subscriber.compute_desired_state()
99
- assert subscriber.desired_ref == "current_sha"
100
- assert subscriber.desired_hashes == []
101
-
102
-
103
- def test_moving_ref_bad_deployment(
104
- subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
105
- ):
106
- subscriber = subscriber_builder({
107
- USE_TARGET_CONFIG_HASH: False,
108
- CUR_SUBSCRIBER_REF: "current_sha",
109
- CUR_CONFIG_HASHES: [],
110
- CHANNELS: {
111
- "channel-a": {
112
- "publisher_a": {
113
- REAL_WORLD_SHA: "new_sha",
114
- },
115
- "publisher_b": {
116
- REAL_WORLD_SHA: "new_sha",
117
- SUCCESSFUL_DEPLOYMENT: False,
118
- },
119
- },
120
- "channel-b": {
121
- "publisher_c": {
122
- REAL_WORLD_SHA: "new_sha",
123
- }
124
- },
125
- },
126
- })
127
- subscriber.compute_desired_state()
128
- assert subscriber.desired_ref == "current_sha"
129
- assert subscriber.desired_hashes == []