-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "Data Fusion rule: Instance State8"
-- Branch commit log -- commit 66eb941bd2bf0c25d679911d50600541f78455ea Author: gcpdiag team <noreply@google.com> Date: 2024-07-04T10:23:40Z Data Fusion rule: Instance State8 Change-Id: I32d2a5f3cd001dc5258869f59f61f21d89e4e090 GitOrigin-RevId: 15ba546d3faf8bc7a508c5aabac479df69ff1188
- Loading branch information
gcpdiag team
authored and
Copybara-Service
committed
Jul 9, 2024
1 parent
dcbfe49
commit 5a918b8
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* datafusion/WARN/2024_002: Data Fusion instance is in a running state. | ||
- gcpdiag-datafusion1-aaaa/us-central1/my-instance [ OK ] | ||
|
50 changes: 50 additions & 0 deletions
50
gcpdiag/lint/datafusion/warn_2024_002_instance_state_running.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# Note that we don't have a general rule that checks this for all products, | ||
# because the grant is done lazily, as soon as it is needed. So check that the | ||
# grant is there only when resources of a certain product (like GKE clusters) | ||
# are present, and we know that the grant is necessary for the correct | ||
# operation of that product. Copy the rule for other products, as necessary. | ||
"""Data Fusion instance is in a running state. | ||
Data Fusion instance is not in a running state, The datafusion state is either | ||
Disabled or Failed, The reason for this disabled or Failed state could be due to | ||
configuration errors, KMS key disabled/denied access or key revoked etc... | ||
""" | ||
from gcpdiag import lint, models | ||
from gcpdiag.queries import datafusion | ||
|
||
instances_by_project = {} | ||
|
||
|
||
def prefetch_rule(context: models.Context): | ||
instances_by_project[context.project_id] = datafusion.get_instances(context) | ||
|
||
|
||
def run_rule(context: models.Context, report: lint.LintReportRuleInterface): | ||
instances = instances_by_project[context.project_id] | ||
if len(instances) == 0: | ||
report.add_skipped(None, 'no instances found') | ||
for instance in instances.values(): | ||
if instance.status not in ('FAILED', 'DISABLED'): | ||
report.add_ok(instance) | ||
else: | ||
if instance.status_details is not None: | ||
report.add_failed( | ||
instance, | ||
(f'Instance is in state {instance.status} ' | ||
f'with reason: `{instance.status_details}`'), | ||
) | ||
else: | ||
report.add_failed(instance, f'Instance is in state {instance.status} ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: "datafusion/WARN/2024_002" | ||
linkTitle: "WARN/2024_002" | ||
weight: 1 | ||
type: docs | ||
description: > | ||
Data Fusion instance is not in a running state, The datafusion state is either Disabled or Failed, The reason for this disabled or Failed state could be due to configuration errors, KMS key disabled/denied access or key revoked etc... | ||
--- | ||
|
||
**Product**: [Cloud Data Fusion](https://cloud.google.com/data-fusion)\ | ||
**Rule class**: WARN - Something that is possibly wrong | ||
|
||
### Description | ||
Data Fusion instance is not in a running state, The datafusion state is either Disabled or Failed, The reason for this disabled or Failed state could be due to configuration errors, KMS key disabled/denied access or key revoked etc... | ||
|
||
### Remediation | ||
There are many ways in which a Data Fusion instance might failed to be created. | ||
Review the [Cloud Logs](https://cloud.google.com/data-fusion/docs/how-to/audit-logging) to identify the cause. | ||
|
||
The reason for disabling the instance if the state is DISABLED. | ||
https://cloud.google.com/data-fusion/docs/reference/rest/v1/projects.locations.instances#disabledreason | ||
|
||
### Further information | ||
- [Instance states](https://cloud.google.com/data-fusion/docs/reference/rest/v1/projects.locations.instances#state) | ||
|
||
https://cloud.google.com/data-fusion/docs/how-to/customer-managed-encryption-keys |