qontract-reconcile 0.10.1rc855__py3-none-any.whl → 0.10.1rc857__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.
- {qontract_reconcile-0.10.1rc855.dist-info → qontract_reconcile-0.10.1rc857.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc855.dist-info → qontract_reconcile-0.10.1rc857.dist-info}/RECORD +8 -8
- reconcile/aws_saml_idp/integration.py +54 -8
- reconcile/aws_saml_roles/integration.py +54 -8
- reconcile/cli.py +18 -0
- {qontract_reconcile-0.10.1rc855.dist-info → qontract_reconcile-0.10.1rc857.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc855.dist-info → qontract_reconcile-0.10.1rc857.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc855.dist-info → qontract_reconcile-0.10.1rc857.dist-info}/top_level.txt +0 -0
{qontract_reconcile-0.10.1rc855.dist-info → qontract_reconcile-0.10.1rc857.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.
|
3
|
+
Version: 0.10.1rc857
|
4
4
|
Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
|
5
5
|
Home-page: https://github.com/app-sre/qontract-reconcile
|
6
6
|
Author: Red Hat App-SRE Team
|
{qontract_reconcile-0.10.1rc855.dist-info → qontract_reconcile-0.10.1rc857.dist-info}/RECORD
RENAMED
@@ -10,7 +10,7 @@ reconcile/aws_iam_password_reset.py,sha256=NwErtrqgBiXr7eGCAHdtGGOx0S7-4JnSc29Ie
|
|
10
10
|
reconcile/aws_support_cases_sos.py,sha256=Jk6_XjDeJSYxgRGqcEAOcynt9qJF2r5HPIPcSKmoBv8,2974
|
11
11
|
reconcile/blackbox_exporter_endpoint_monitoring.py,sha256=W_VJagnsJR1v5oqjlI3RJJE0_nhtJ0m81RS8zWA5u5c,3538
|
12
12
|
reconcile/checkpoint.py,sha256=R2WFXUXLTB4sWMi4GeA4eegsuf_1-Q4vH8M0Toh3Ij4,5036
|
13
|
-
reconcile/cli.py,sha256=
|
13
|
+
reconcile/cli.py,sha256=F5s-i-OlL6RhqiYkEhXMaNLegiPazbS0ahEtRrO2LeE,104075
|
14
14
|
reconcile/closedbox_endpoint_monitoring_base.py,sha256=SMhkcQqprWvThrIJa3U_3uh5w1h-alleW1QnCJFY4Qw,4909
|
15
15
|
reconcile/cluster_deployment_mapper.py,sha256=2Ah-nu-Mdig0pjuiZl_XLrmVAjYzFjORR3dMlCgkmw0,2352
|
16
16
|
reconcile/dashdotdb_base.py,sha256=R2JuwiXAEYAFiCtnztM_IIr1rtVzPpaWAmgxuDa2FgY,4813
|
@@ -147,9 +147,9 @@ reconcile/aws_ami_cleanup/integration.py,sha256=IW95cpMj2P5ffs-AxsR_TDQCJnYFBhLI
|
|
147
147
|
reconcile/aws_cloudwatch_log_retention/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
148
148
|
reconcile/aws_cloudwatch_log_retention/integration.py,sha256=0UcSZIrGvnGY4m9fj87oejIolIP_qTxtJInpmW9jrQ0,7772
|
149
149
|
reconcile/aws_saml_idp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
150
|
-
reconcile/aws_saml_idp/integration.py,sha256=
|
150
|
+
reconcile/aws_saml_idp/integration.py,sha256=0Q8dNMDzEF7qXW6M9cqIU5MeVCUmr7vmX9GnoJCvFMY,6536
|
151
151
|
reconcile/aws_saml_roles/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
152
|
-
reconcile/aws_saml_roles/integration.py,sha256=
|
152
|
+
reconcile/aws_saml_roles/integration.py,sha256=d_mBdQTF0Uj2h4NYR1xF0KDuciW1H39CohCDz40HgYA,11259
|
153
153
|
reconcile/aws_version_sync/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
154
154
|
reconcile/aws_version_sync/integration.py,sha256=uI6k0nNS_jRrVaIcgm30Hj_M6GIJmexU2X-6Dxe0CZo,17271
|
155
155
|
reconcile/aws_version_sync/utils.py,sha256=sVv-48PKi2VITlqqvmpbjnFDOPeGqfKzgkpIszlmjL0,1708
|
@@ -834,8 +834,8 @@ tools/test/test_app_interface_metrics_exporter.py,sha256=SX7qL3D1SIRKFo95FoQztvf
|
|
834
834
|
tools/test/test_qontract_cli.py,sha256=_D61RFGAN5x44CY1tYbouhlGXXABwYfxKSWSQx3Jrss,4941
|
835
835
|
tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
|
836
836
|
tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
|
837
|
-
qontract_reconcile-0.10.
|
838
|
-
qontract_reconcile-0.10.
|
839
|
-
qontract_reconcile-0.10.
|
840
|
-
qontract_reconcile-0.10.
|
841
|
-
qontract_reconcile-0.10.
|
837
|
+
qontract_reconcile-0.10.1rc857.dist-info/METADATA,sha256=y5SBuYTlPDgO4AIat2E18IJErGFgADPtsZaWmhGNUqI,2273
|
838
|
+
qontract_reconcile-0.10.1rc857.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
839
|
+
qontract_reconcile-0.10.1rc857.dist-info/entry_points.txt,sha256=GKQqCl2j2X1BJQ69een6rHcR26PmnxnONLNOQB-nRjY,491
|
840
|
+
qontract_reconcile-0.10.1rc857.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
|
841
|
+
qontract_reconcile-0.10.1rc857.dist-info/RECORD,,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import logging
|
1
2
|
import sys
|
2
3
|
from collections.abc import (
|
3
4
|
Callable,
|
@@ -5,6 +6,7 @@ from collections.abc import (
|
|
5
6
|
)
|
6
7
|
from typing import (
|
7
8
|
Any,
|
9
|
+
TypedDict,
|
8
10
|
)
|
9
11
|
|
10
12
|
import requests
|
@@ -21,6 +23,10 @@ from reconcile.utils import gql
|
|
21
23
|
from reconcile.utils.aws_api import AWSApi
|
22
24
|
from reconcile.utils.defer import defer
|
23
25
|
from reconcile.utils.disabled_integrations import integration_is_enabled
|
26
|
+
from reconcile.utils.extended_early_exit import (
|
27
|
+
ExtendedEarlyExitRunnerResult,
|
28
|
+
extended_early_exit_run,
|
29
|
+
)
|
24
30
|
from reconcile.utils.runtime.integration import (
|
25
31
|
PydanticRunParams,
|
26
32
|
QontractReconcileIntegration,
|
@@ -28,6 +34,7 @@ from reconcile.utils.runtime.integration import (
|
|
28
34
|
from reconcile.utils.semver_helper import make_semver
|
29
35
|
from reconcile.utils.terraform_client import TerraformClient
|
30
36
|
from reconcile.utils.terrascript_aws_client import TerrascriptClient
|
37
|
+
from reconcile.utils.unleash.client import get_feature_toggle_state
|
31
38
|
|
32
39
|
QONTRACT_INTEGRATION = "aws-saml-idp"
|
33
40
|
QONTRACT_INTEGRATION_VERSION = make_semver(1, 0, 0)
|
@@ -41,6 +48,10 @@ class AwsSamlIdpIntegrationParams(PydanticRunParams):
|
|
41
48
|
saml_idp_name: str
|
42
49
|
saml_metadata_url: HttpUrl
|
43
50
|
account_name: str | None = None
|
51
|
+
# extended early exit parameters
|
52
|
+
enable_extended_early_exit: bool = False
|
53
|
+
extended_early_exit_cache_ttl_seconds: int = 3600
|
54
|
+
log_cached_log_output: bool = False
|
44
55
|
|
45
56
|
|
46
57
|
class SamlIdpConfig(BaseModel):
|
@@ -49,6 +60,12 @@ class SamlIdpConfig(BaseModel):
|
|
49
60
|
metadata: str
|
50
61
|
|
51
62
|
|
63
|
+
class RunnerParams(TypedDict):
|
64
|
+
tf: TerraformClient
|
65
|
+
dry_run: bool
|
66
|
+
enable_deletion: bool
|
67
|
+
|
68
|
+
|
52
69
|
class AwsSamlIdpIntegration(QontractReconcileIntegration[AwsSamlIdpIntegrationParams]):
|
53
70
|
"""Manage the SAML IDP config for all AWS accounts."""
|
54
71
|
|
@@ -146,13 +163,42 @@ class AwsSamlIdpIntegration(QontractReconcileIntegration[AwsSamlIdpIntegrationPa
|
|
146
163
|
if defer:
|
147
164
|
defer(tf.cleanup)
|
148
165
|
|
149
|
-
|
150
|
-
|
151
|
-
|
166
|
+
runner_params: RunnerParams = dict(
|
167
|
+
tf=tf,
|
168
|
+
dry_run=dry_run,
|
169
|
+
enable_deletion=self.params.enable_deletion,
|
170
|
+
)
|
171
|
+
|
172
|
+
if self.params.enable_extended_early_exit and get_feature_toggle_state(
|
173
|
+
f"{QONTRACT_INTEGRATION}-extended-early-exit", default=True
|
174
|
+
):
|
175
|
+
extended_early_exit_run(
|
176
|
+
integration=QONTRACT_INTEGRATION,
|
177
|
+
integration_version=QONTRACT_INTEGRATION_VERSION,
|
178
|
+
dry_run=dry_run,
|
179
|
+
cache_source=ts.terraform_configurations(),
|
180
|
+
shard=self.params.account_name if self.params.account_name else "",
|
181
|
+
ttl_seconds=self.params.extended_early_exit_cache_ttl_seconds,
|
182
|
+
logger=logging.getLogger(),
|
183
|
+
runner=runner,
|
184
|
+
runner_params=runner_params,
|
185
|
+
log_cached_log_output=self.params.log_cached_log_output,
|
186
|
+
)
|
187
|
+
else:
|
188
|
+
runner(**runner_params)
|
189
|
+
|
190
|
+
|
191
|
+
def runner(
|
192
|
+
dry_run: bool, tf: TerraformClient, enable_deletion: bool
|
193
|
+
) -> ExtendedEarlyExitRunnerResult:
|
194
|
+
_, err = tf.plan(enable_deletion)
|
195
|
+
if err:
|
196
|
+
raise RuntimeError("Terraform plan has errors")
|
197
|
+
|
198
|
+
if dry_run:
|
199
|
+
return ExtendedEarlyExitRunnerResult(payload={}, applied_count=0)
|
152
200
|
|
153
|
-
|
154
|
-
|
201
|
+
if err := tf.apply():
|
202
|
+
raise RuntimeError("Terraform apply has errors")
|
155
203
|
|
156
|
-
|
157
|
-
if err:
|
158
|
-
sys.exit(ExitCodes.ERROR)
|
204
|
+
return ExtendedEarlyExitRunnerResult(payload={}, applied_count=tf.apply_count)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import json
|
2
|
+
import logging
|
2
3
|
import sys
|
3
4
|
from collections.abc import (
|
4
5
|
Callable,
|
@@ -6,6 +7,7 @@ from collections.abc import (
|
|
6
7
|
)
|
7
8
|
from typing import (
|
8
9
|
Any,
|
10
|
+
TypedDict,
|
9
11
|
)
|
10
12
|
|
11
13
|
from pydantic import BaseModel, root_validator, validator
|
@@ -25,6 +27,10 @@ from reconcile.utils.aws_api import AWSApi
|
|
25
27
|
from reconcile.utils.aws_helper import unique_sso_aws_accounts
|
26
28
|
from reconcile.utils.defer import defer
|
27
29
|
from reconcile.utils.disabled_integrations import integration_is_enabled
|
30
|
+
from reconcile.utils.extended_early_exit import (
|
31
|
+
ExtendedEarlyExitRunnerResult,
|
32
|
+
extended_early_exit_run,
|
33
|
+
)
|
28
34
|
from reconcile.utils.runtime.integration import (
|
29
35
|
PydanticRunParams,
|
30
36
|
QontractReconcileIntegration,
|
@@ -32,6 +38,7 @@ from reconcile.utils.runtime.integration import (
|
|
32
38
|
from reconcile.utils.semver_helper import make_semver
|
33
39
|
from reconcile.utils.terraform_client import TerraformClient
|
34
40
|
from reconcile.utils.terrascript_aws_client import TerrascriptClient
|
41
|
+
from reconcile.utils.unleash.client import get_feature_toggle_state
|
35
42
|
|
36
43
|
QONTRACT_INTEGRATION = "aws-saml-roles"
|
37
44
|
QONTRACT_INTEGRATION_VERSION = make_semver(1, 0, 0)
|
@@ -45,6 +52,10 @@ class AwsSamlRolesIntegrationParams(PydanticRunParams):
|
|
45
52
|
saml_idp_name: str
|
46
53
|
max_session_duration_hours: int = 1
|
47
54
|
account_name: str | None = None
|
55
|
+
# extended early exit parameters
|
56
|
+
enable_extended_early_exit: bool = False
|
57
|
+
extended_early_exit_cache_ttl_seconds: int = 3600
|
58
|
+
log_cached_log_output: bool = False
|
48
59
|
|
49
60
|
@validator("max_session_duration_hours")
|
50
61
|
def max_session_duration_range(cls, v: str | int) -> int:
|
@@ -129,6 +140,12 @@ class AwsRole(BaseModel):
|
|
129
140
|
return values
|
130
141
|
|
131
142
|
|
143
|
+
class RunnerParams(TypedDict):
|
144
|
+
tf: TerraformClient
|
145
|
+
dry_run: bool
|
146
|
+
enable_deletion: bool
|
147
|
+
|
148
|
+
|
132
149
|
class AwsSamlRolesIntegration(
|
133
150
|
QontractReconcileIntegration[AwsSamlRolesIntegrationParams]
|
134
151
|
):
|
@@ -264,13 +281,42 @@ class AwsSamlRolesIntegration(
|
|
264
281
|
if defer:
|
265
282
|
defer(tf.cleanup)
|
266
283
|
|
267
|
-
|
268
|
-
|
269
|
-
|
284
|
+
runner_params: RunnerParams = dict(
|
285
|
+
tf=tf,
|
286
|
+
dry_run=dry_run,
|
287
|
+
enable_deletion=self.params.enable_deletion,
|
288
|
+
)
|
289
|
+
|
290
|
+
if self.params.enable_extended_early_exit and get_feature_toggle_state(
|
291
|
+
f"{QONTRACT_INTEGRATION}-extended-early-exit", default=True
|
292
|
+
):
|
293
|
+
extended_early_exit_run(
|
294
|
+
integration=QONTRACT_INTEGRATION,
|
295
|
+
integration_version=QONTRACT_INTEGRATION_VERSION,
|
296
|
+
dry_run=dry_run,
|
297
|
+
cache_source=ts.terraform_configurations(),
|
298
|
+
shard=self.params.account_name if self.params.account_name else "",
|
299
|
+
ttl_seconds=self.params.extended_early_exit_cache_ttl_seconds,
|
300
|
+
logger=logging.getLogger(),
|
301
|
+
runner=runner,
|
302
|
+
runner_params=runner_params,
|
303
|
+
log_cached_log_output=self.params.log_cached_log_output,
|
304
|
+
)
|
305
|
+
else:
|
306
|
+
runner(**runner_params)
|
307
|
+
|
308
|
+
|
309
|
+
def runner(
|
310
|
+
dry_run: bool, tf: TerraformClient, enable_deletion: bool
|
311
|
+
) -> ExtendedEarlyExitRunnerResult:
|
312
|
+
_, err = tf.plan(enable_deletion)
|
313
|
+
if err:
|
314
|
+
raise RuntimeError("Terraform plan has errors")
|
315
|
+
|
316
|
+
if dry_run:
|
317
|
+
return ExtendedEarlyExitRunnerResult(payload={}, applied_count=0)
|
270
318
|
|
271
|
-
|
272
|
-
|
319
|
+
if err := tf.apply():
|
320
|
+
raise RuntimeError("Terraform apply has errors")
|
273
321
|
|
274
|
-
|
275
|
-
if err:
|
276
|
-
sys.exit(ExitCodes.ERROR)
|
322
|
+
return ExtendedEarlyExitRunnerResult(payload={}, applied_count=tf.apply_count)
|
reconcile/cli.py
CHANGED
@@ -737,6 +737,9 @@ def terraform_aws_route53(
|
|
737
737
|
required=True,
|
738
738
|
default="https://auth.redhat.com/auth/realms/EmployeeIDP/protocol/saml/descriptor",
|
739
739
|
)
|
740
|
+
@enable_extended_early_exit
|
741
|
+
@extended_early_exit_cache_ttl_seconds
|
742
|
+
@log_cached_log_output
|
740
743
|
@click.pass_context
|
741
744
|
def aws_saml_idp(
|
742
745
|
ctx,
|
@@ -746,6 +749,9 @@ def aws_saml_idp(
|
|
746
749
|
account_name,
|
747
750
|
saml_idp_name,
|
748
751
|
saml_metadata_url,
|
752
|
+
enable_extended_early_exit,
|
753
|
+
extended_early_exit_cache_ttl_seconds,
|
754
|
+
log_cached_log_output,
|
749
755
|
):
|
750
756
|
from reconcile.aws_saml_idp.integration import (
|
751
757
|
AwsSamlIdpIntegration,
|
@@ -761,6 +767,9 @@ def aws_saml_idp(
|
|
761
767
|
saml_idp_name=saml_idp_name,
|
762
768
|
saml_metadata_url=saml_metadata_url,
|
763
769
|
account_name=account_name,
|
770
|
+
enable_extended_early_exit=enable_extended_early_exit,
|
771
|
+
extended_early_exit_cache_ttl_seconds=extended_early_exit_cache_ttl_seconds,
|
772
|
+
log_cached_log_output=log_cached_log_output,
|
764
773
|
)
|
765
774
|
),
|
766
775
|
ctx=ctx.obj,
|
@@ -924,6 +933,9 @@ def openshift_serviceaccount_tokens(
|
|
924
933
|
required=True,
|
925
934
|
default=6,
|
926
935
|
)
|
936
|
+
@enable_extended_early_exit
|
937
|
+
@extended_early_exit_cache_ttl_seconds
|
938
|
+
@log_cached_log_output
|
927
939
|
@click.pass_context
|
928
940
|
def aws_saml_roles(
|
929
941
|
ctx,
|
@@ -933,6 +945,9 @@ def aws_saml_roles(
|
|
933
945
|
account_name,
|
934
946
|
saml_idp_name,
|
935
947
|
max_session_duration_hours,
|
948
|
+
enable_extended_early_exit,
|
949
|
+
extended_early_exit_cache_ttl_seconds,
|
950
|
+
log_cached_log_output,
|
936
951
|
):
|
937
952
|
from reconcile.aws_saml_roles.integration import (
|
938
953
|
AwsSamlRolesIntegration,
|
@@ -948,6 +963,9 @@ def aws_saml_roles(
|
|
948
963
|
saml_idp_name=saml_idp_name,
|
949
964
|
max_session_duration_hours=max_session_duration_hours,
|
950
965
|
account_name=account_name,
|
966
|
+
enable_extended_early_exit=enable_extended_early_exit,
|
967
|
+
extended_early_exit_cache_ttl_seconds=extended_early_exit_cache_ttl_seconds,
|
968
|
+
log_cached_log_output=log_cached_log_output,
|
951
969
|
)
|
952
970
|
),
|
953
971
|
ctx=ctx.obj,
|
File without changes
|
File without changes
|
{qontract_reconcile-0.10.1rc855.dist-info → qontract_reconcile-0.10.1rc857.dist-info}/top_level.txt
RENAMED
File without changes
|