qontract-reconcile 0.10.2.dev105__py3-none-any.whl → 0.10.2.dev107__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qontract-reconcile
3
- Version: 0.10.2.dev105
3
+ Version: 0.10.2.dev107
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
6
6
  Project-URL: repository, https://github.com/app-sre/qontract-reconcile
@@ -208,10 +208,10 @@ reconcile/external_resources/secrets_sync.py,sha256=ZDxzGZ6wC4zxLhA7-L39xDRH6rzU
208
208
  reconcile/external_resources/state.py,sha256=gF3ACdl7YiUlbQ4uEGrD6i_Txxqr6mT9f8IFlTQ-8dY,13176
209
209
  reconcile/fleet_labeler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
210
210
  reconcile/fleet_labeler/dependencies.py,sha256=MFiSfT25Ks0X3iQxwayNvFX_l6bQi97f3IiaNR1wtHc,3173
211
- reconcile/fleet_labeler/integration.py,sha256=ckmVga18DgidA2u50mFnp87oDAa2pKpnuORW-PMCKVY,14157
211
+ reconcile/fleet_labeler/integration.py,sha256=HGlUJe5BCfAgk7YCxxsIteB8LH1pL8led-KfaIVh214,14614
212
212
  reconcile/fleet_labeler/merge_request.py,sha256=SfGxXInxeJzVnsTtO0ZC9-PesUJMdpKxKY9eCB6ms-g,1538
213
213
  reconcile/fleet_labeler/meta.py,sha256=lWnpH2U0PHCPXu9Ok_CPmO494qQJQ5pOuqo28s0jzIQ,146
214
- reconcile/fleet_labeler/metrics.py,sha256=zhcp06woGaZywTqWZf3znh6C2S2u7OHBLXalXYKuTzQ,1934
214
+ reconcile/fleet_labeler/metrics.py,sha256=n2GkaEEIgIrwMy85Ztm_x34YrrKXKLIPlerxVXExzdE,3255
215
215
  reconcile/fleet_labeler/ocm.py,sha256=qcg1_p7nKlZG7-MQeOZos3rz6YSPAPh-HKxE3OVJwe0,4165
216
216
  reconcile/fleet_labeler/validate.py,sha256=Ch4fe7jXQZKl4pnvl5IxWS-dKSIuuiwdH2B7mivZoco,1654
217
217
  reconcile/fleet_labeler/vcs.py,sha256=6UHUQ08AGAHXF7629I6X-T_E1pvx96LxjS66EeOzve4,1108
@@ -224,7 +224,7 @@ reconcile/glitchtip_project_alerts/integration.py,sha256=BgMx-NyV9mTuv7Sotb2OioC
224
224
  reconcile/glitchtip_project_dsn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
225
225
  reconcile/glitchtip_project_dsn/integration.py,sha256=2iugub-kHYkHNK33n0v9_TeWonuxCPah_VkoTPvaajE,8077
226
226
  reconcile/gql_definitions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
227
- reconcile/gql_definitions/introspection.json,sha256=kY3f6I33Qo8h3ie2YiUWIXCNnlAe6_Ct-MVDuewmegQ,2246801
227
+ reconcile/gql_definitions/introspection.json,sha256=rgLJjGZJ-r-f_d74-1HNqf2X1EwNUjtB8gwbuMSfZEI,2249822
228
228
  reconcile/gql_definitions/acs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
229
229
  reconcile/gql_definitions/acs/acs_instances.py,sha256=L91WW9LbhJbBSrECqShQpFtjoBOsmNIYLRpMbx1io5o,2181
230
230
  reconcile/gql_definitions/acs/acs_policies.py,sha256=bN5i4mks10Z23KJSj7jqp966Osq2dps4d-sPH9gjxEA,7008
@@ -421,7 +421,7 @@ reconcile/gql_definitions/terraform_repo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
421
421
  reconcile/gql_definitions/terraform_repo/terraform_repo.py,sha256=9cDKdP9ziBh9J_mw2Gi6GUOP4mFxMABY_D62qSeMtJI,3881
422
422
  reconcile/gql_definitions/terraform_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
423
423
  reconcile/gql_definitions/terraform_resources/database_access_manager.py,sha256=yv0_YC-LmhaKD_gyGG3le1w5BtypBjlsO894-Zgdg4U,4813
424
- reconcile/gql_definitions/terraform_resources/terraform_resources_namespaces.py,sha256=-r5EIHrwEeI-ZGxZwnfmXwJxjjqyX5rGseqToLqycH4,43019
424
+ reconcile/gql_definitions/terraform_resources/terraform_resources_namespaces.py,sha256=mBIs4VaMhEhy7DyTDWMpTlWkSWBEbHci5fb-FweN0e4,43692
425
425
  reconcile/gql_definitions/terraform_tgw_attachments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
426
426
  reconcile/gql_definitions/terraform_tgw_attachments/aws_accounts.py,sha256=FPyPEikpkZ_kvHfXqnkzSUDNmxMMTiUwhI-eLQtuIHM,2616
427
427
  reconcile/gql_definitions/unleash_feature_toggles/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -646,7 +646,7 @@ reconcile/utils/state.py,sha256=az4tBmZ0EdbFcAGiBVUxs3cr2-BVWsuDQiNTvjjQq8s,1637
646
646
  reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
647
647
  reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
648
648
  reconcile/utils/terraform_client.py,sha256=H8frsS370y8xfivKLNBD1dwlBLHvfuR6JSN_syBL5Qc,36033
649
- reconcile/utils/terrascript_aws_client.py,sha256=Xn5STCd0Ge8oSa-ugl3e0A5VYpGziTAdIuPscRaOJxs,286415
649
+ reconcile/utils/terrascript_aws_client.py,sha256=4NNr1zYd2NNrR7q8W-YDkZOg5DvX-pStYEBRD12sebM,287496
650
650
  reconcile/utils/three_way_diff_strategy.py,sha256=oQcHXd9LVhirJfoaOBoHUYuZVGfyL2voKr6KVI34zZE,4833
651
651
  reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
652
652
  reconcile/utils/vault.py,sha256=aSA8l9cJlPUHpChFGl27nSY-Mpq9FMjBo7Dcgb1BVfM,15036
@@ -786,7 +786,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
786
786
  tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
787
787
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
788
788
  tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
789
- qontract_reconcile-0.10.2.dev105.dist-info/METADATA,sha256=WiFbmcDIrpf5D2W8Q6_gQUyGCiSkpczVt3sNKLc4h9s,24566
790
- qontract_reconcile-0.10.2.dev105.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
791
- qontract_reconcile-0.10.2.dev105.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
792
- qontract_reconcile-0.10.2.dev105.dist-info/RECORD,,
789
+ qontract_reconcile-0.10.2.dev107.dist-info/METADATA,sha256=zlPO_qqbxZz6EPbq-n6ZBvOA1maNiVOPZooo6UHt7vQ,24566
790
+ qontract_reconcile-0.10.2.dev107.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
791
+ qontract_reconcile-0.10.2.dev107.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
792
+ qontract_reconcile-0.10.2.dev107.dist-info/RECORD,,
@@ -66,11 +66,11 @@ class FleetLabelerIntegration(QontractReconcileIntegration[NoParams]):
66
66
  secret_reader=self.secret_reader,
67
67
  dry_run=dry_run,
68
68
  )
69
- self._metrics = dependencies.metrics
70
69
  self.reconcile(dependencies=dependencies)
71
70
 
72
71
  def reconcile(self, dependencies: Dependencies) -> None:
73
72
  validate_label_specs(specs=dependencies.label_specs_by_name)
73
+ all_cluster_ids: set[str] = set()
74
74
  for spec_name, ocm in dependencies.ocm_clients_by_label_spec_name.items():
75
75
  spec = dependencies.label_specs_by_name[spec_name]
76
76
  discovered_clusters = self._discover_desired_clusters(
@@ -99,6 +99,16 @@ class FleetLabelerIntegration(QontractReconcileIntegration[NoParams]):
99
99
  ocm=ocm,
100
100
  dry_run=synch_labels,
101
101
  )
102
+ num_labels = 0
103
+ for cluster in spec.clusters:
104
+ all_cluster_ids.add(cluster.cluster_id)
105
+ num_labels += len(cluster.subscription_labels)
106
+ dependencies.metrics.set_managed_labels_gauge(
107
+ ocm_name=spec.ocm_env.name,
108
+ spec_name=spec_name,
109
+ value=num_labels,
110
+ )
111
+ dependencies.metrics.set_managed_clusters_gauge(value=len(all_cluster_ids))
102
112
 
103
113
  def _discover_desired_clusters(
104
114
  self, spec: FleetLabelsSpecV1, ocm: OCMClient
@@ -36,14 +36,34 @@ class FleetLabelerMetrics:
36
36
  value,
37
37
  )
38
38
 
39
+ def set_managed_labels_gauge(
40
+ self, ocm_name: str, spec_name: str, value: int
41
+ ) -> None:
42
+ metrics.set_gauge(
43
+ FleetLabelerManagedLabelsGauge(
44
+ ocm_name=ocm_name,
45
+ spec=spec_name,
46
+ ),
47
+ value,
48
+ )
49
+
50
+ def set_managed_clusters_gauge(self, value: int) -> None:
51
+ metrics.set_gauge(
52
+ FleetLabelerManagedClustersGauge(),
53
+ value,
54
+ )
55
+
39
56
 
40
57
  class FleetLabelerBaseMetric(BaseModel):
41
58
  integration: str = QONTRACT_INTEGRATION
59
+
60
+
61
+ class FleetLabelerSpecBaseMetric(FleetLabelerBaseMetric):
42
62
  ocm_name: str
43
63
  spec: str
44
64
 
45
65
 
46
- class FleetLabelerDuplicateClusterMatchesGauge(FleetLabelerBaseMetric, GaugeMetric):
66
+ class FleetLabelerDuplicateClusterMatchesGauge(FleetLabelerSpecBaseMetric, GaugeMetric):
47
67
  """
48
68
  Gauge for the number of clusters that have duplicate matches. Clusters with
49
69
  duplicate matches are being ignored by fleet labeler, as it cannot clearly
@@ -56,7 +76,7 @@ class FleetLabelerDuplicateClusterMatchesGauge(FleetLabelerBaseMetric, GaugeMetr
56
76
  return "fleet_labeler_duplicate_cluster_matches"
57
77
 
58
78
 
59
- class FleetLabelerLabelRenderingErrorGauge(FleetLabelerBaseMetric, GaugeMetric):
79
+ class FleetLabelerLabelRenderingErrorGauge(FleetLabelerSpecBaseMetric, GaugeMetric):
60
80
  """
61
81
  Gauge for the number of clusters that have label render errors. This
62
82
  happens when the fleet labeler is unable to render the subscription labels
@@ -66,3 +86,28 @@ class FleetLabelerLabelRenderingErrorGauge(FleetLabelerBaseMetric, GaugeMetric):
66
86
  @classmethod
67
87
  def name(cls) -> str:
68
88
  return "fleet_labeler_label_rendering_error"
89
+
90
+
91
+ class FleetLabelerManagedLabelsGauge(FleetLabelerSpecBaseMetric, GaugeMetric):
92
+ """
93
+ Gauge for the current number of labels under management.
94
+ Note, that label<->cluster combination must be unique across all
95
+ specs, hence we can give the spec as a label here.
96
+ """
97
+
98
+ @classmethod
99
+ def name(cls) -> str:
100
+ return "fleet_labeler_managed_labels"
101
+
102
+
103
+ class FleetLabelerManagedClustersGauge(FleetLabelerBaseMetric, GaugeMetric):
104
+ """
105
+ Gauge for the current number of clusters under management.
106
+ Note, that a cluster can be part of multiple spec inventories.
107
+ This metric only cares about the total number of unique clusters,
108
+ thus the spec is not a label here.
109
+ """
110
+
111
+ @classmethod
112
+ def name(cls) -> str:
113
+ return "fleet_labeler_managed_clusters"
@@ -46575,6 +46575,77 @@
46575
46575
  },
46576
46576
  "isDeprecated": false,
46577
46577
  "deprecationReason": null
46578
+ },
46579
+ {
46580
+ "name": "health_check",
46581
+ "description": null,
46582
+ "args": [],
46583
+ "type": {
46584
+ "kind": "OBJECT",
46585
+ "name": "NamespaceTerraformResourceALBTargetHealthcheck_v1",
46586
+ "ofType": null
46587
+ },
46588
+ "isDeprecated": false,
46589
+ "deprecationReason": null
46590
+ }
46591
+ ],
46592
+ "inputFields": null,
46593
+ "interfaces": [],
46594
+ "enumValues": null,
46595
+ "possibleTypes": null
46596
+ },
46597
+ {
46598
+ "kind": "OBJECT",
46599
+ "name": "NamespaceTerraformResourceALBTargetHealthcheck_v1",
46600
+ "description": null,
46601
+ "fields": [
46602
+ {
46603
+ "name": "unhealthy_threshold",
46604
+ "description": null,
46605
+ "args": [],
46606
+ "type": {
46607
+ "kind": "SCALAR",
46608
+ "name": "Int",
46609
+ "ofType": null
46610
+ },
46611
+ "isDeprecated": false,
46612
+ "deprecationReason": null
46613
+ },
46614
+ {
46615
+ "name": "timeout",
46616
+ "description": null,
46617
+ "args": [],
46618
+ "type": {
46619
+ "kind": "SCALAR",
46620
+ "name": "Int",
46621
+ "ofType": null
46622
+ },
46623
+ "isDeprecated": false,
46624
+ "deprecationReason": null
46625
+ },
46626
+ {
46627
+ "name": "interval",
46628
+ "description": null,
46629
+ "args": [],
46630
+ "type": {
46631
+ "kind": "SCALAR",
46632
+ "name": "Int",
46633
+ "ofType": null
46634
+ },
46635
+ "isDeprecated": false,
46636
+ "deprecationReason": null
46637
+ },
46638
+ {
46639
+ "name": "healthy_threshold",
46640
+ "description": null,
46641
+ "args": [],
46642
+ "type": {
46643
+ "kind": "SCALAR",
46644
+ "name": "Int",
46645
+ "ofType": null
46646
+ },
46647
+ "isDeprecated": false,
46648
+ "deprecationReason": null
46578
46649
  }
46579
46650
  ],
46580
46651
  "inputFields": null,
@@ -319,6 +319,12 @@ query TerraformResourcesNamespaces {
319
319
  openshift_service
320
320
  protocol
321
321
  protocol_version
322
+ health_check {
323
+ unhealthy_threshold
324
+ timeout
325
+ interval
326
+ healthy_threshold
327
+ }
322
328
  }
323
329
  rules {
324
330
  condition {
@@ -799,6 +805,13 @@ class NamespaceTerraformResourceS3CloudFrontPublicKeyV1(NamespaceTerraformResour
799
805
  annotations: Optional[str] = Field(..., alias="annotations")
800
806
 
801
807
 
808
+ class NamespaceTerraformResourceALBTargetHealthcheckV1(ConfiguredBaseModel):
809
+ unhealthy_threshold: Optional[int] = Field(..., alias="unhealthy_threshold")
810
+ timeout: Optional[int] = Field(..., alias="timeout")
811
+ interval: Optional[int] = Field(..., alias="interval")
812
+ healthy_threshold: Optional[int] = Field(..., alias="healthy_threshold")
813
+
814
+
802
815
  class NamespaceTerraformResourceALBTargetsV1(ConfiguredBaseModel):
803
816
  name: str = Field(..., alias="name")
804
817
  default: bool = Field(..., alias="default")
@@ -806,6 +819,7 @@ class NamespaceTerraformResourceALBTargetsV1(ConfiguredBaseModel):
806
819
  openshift_service: Optional[str] = Field(..., alias="openshift_service")
807
820
  protocol: Optional[str] = Field(..., alias="protocol")
808
821
  protocol_version: Optional[str] = Field(..., alias="protocol_version")
822
+ health_check: Optional[NamespaceTerraformResourceALBTargetHealthcheckV1] = Field(..., alias="health_check")
809
823
 
810
824
 
811
825
  class NamespaceTerraformResourceALBConditionV1(ConfiguredBaseModel):
@@ -5376,6 +5376,25 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
5376
5376
  f"{identifier}-{target_name}", **lbt_random_id_values
5377
5377
  )
5378
5378
  tf_resources.append(lbt_random_id)
5379
+ health_check_interval = 10
5380
+ health_check_timeout = 5
5381
+ health_check_unhealthy_threshold = 3
5382
+ health_check_healthy_threshold = 3
5383
+ if health_check := t.get("health_check"):
5384
+ health_check_interval = (
5385
+ health_check.get("interval") or health_check_interval
5386
+ )
5387
+ health_check_timeout = (
5388
+ health_check.get("timeout") or health_check_timeout
5389
+ )
5390
+ health_check_unhealthy_threshold = (
5391
+ health_check.get("unhealthy_threshold")
5392
+ or health_check_unhealthy_threshold
5393
+ )
5394
+ health_check_healthy_threshold = (
5395
+ health_check.get("healthy_threshold")
5396
+ or health_check_healthy_threshold
5397
+ )
5379
5398
 
5380
5399
  # https://www.terraform.io/docs/providers/aws/r/
5381
5400
  # lb_target_group.html
@@ -5388,7 +5407,10 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
5388
5407
  "target_type": "ip",
5389
5408
  "vpc_id": vpc_id,
5390
5409
  "health_check": {
5391
- "interval": 10,
5410
+ "interval": health_check_interval,
5411
+ "timeout": health_check_timeout,
5412
+ "unhealthy_threshold": health_check_unhealthy_threshold,
5413
+ "healthy_threshold": health_check_healthy_threshold,
5392
5414
  "path": "/",
5393
5415
  "protocol": "HTTPS",
5394
5416
  "port": 443,