-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: franz-net <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: franz-net <[email protected]>
- Loading branch information
1 parent
465b120
commit 383ce4f
Showing
5 changed files
with
146 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 @@ | ||
```release-note:new-datasource | ||
`google_monitoring_istio_canonical_service` | ||
``` |
54 changes: 54 additions & 0 deletions
54
google-beta/data_source_monitoring_istio_canonical_service.go
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,54 @@ | ||
package google | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
// No tests are added in this PR as currently there is no TF-supported method that can be used to | ||
// enable either services (Cluster Istio, Mesh Istio and Istio Canonical Service) in GKE | ||
func dataSourceMonitoringIstioCanonicalService() *schema.Resource { | ||
csSchema := map[string]*schema.Schema{ | ||
"mesh_uid": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
Description: `Identifier for the Istio mesh in which this canonical service is defined. | ||
Corresponds to the meshUid metric label in Istio metrics.`, | ||
}, | ||
"canonical_service_namespace": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
Description: `The namespace of the canonical service underlying this service. | ||
Corresponds to the destination_service_namespace metric label in Istio metrics.`, | ||
}, | ||
"canonical_service": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
Description: `The name of the canonical service underlying this service.. | ||
Corresponds to the destination_service_name metric label in Istio metrics.`, | ||
}, | ||
} | ||
t := `istio_canonical_service.mesh_uid="{{mesh_uid}}" AND | ||
istio_canonical_service.canonical_service="{{canonical_service}}" AND | ||
istio_canonical_service.canonical_service_namespace="{{canonical_service_namespace}}"` | ||
return dataSourceMonitoringServiceType(csSchema, t, dataSourceMonitoringIstioCanonicalServiceRead) | ||
} | ||
|
||
func dataSourceMonitoringIstioCanonicalServiceRead(res map[string]interface{}, d *schema.ResourceData, meta interface{}) error { | ||
var istioCanonicalService map[string]interface{} | ||
if v, ok := res["istio_canonical_service"]; ok { | ||
istioCanonicalService = v.(map[string]interface{}) | ||
} | ||
if len(istioCanonicalService) == 0 { | ||
return nil | ||
} | ||
if err := d.Set("canonical_service", istioCanonicalService["canonical_service"]); err != nil { | ||
return err | ||
} | ||
if err := d.Set("canonical_service_namespace", istioCanonicalService["canonical_service_namespace"]); err != nil { | ||
return err | ||
} | ||
if err := d.Set("mesh_name", istioCanonicalService["mesh_name"]); err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
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
84 changes: 84 additions & 0 deletions
84
website/docs/d/monitoring_istio_canonical_service.html.markdown
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,84 @@ | ||
--- | ||
subcategory: "Cloud (Stackdriver) Monitoring" | ||
layout: "google" | ||
page_title: "Google: google_monitoring_istio_canonical_service" | ||
sidebar_current: "docs-google-datasource-monitoring-istio-canonical-service" | ||
description: |- | ||
An Monitoring Service resource created automatically by GCP to monitor an | ||
Istio Canonical service. | ||
--- | ||
|
||
# google\_monitoring\_istio\_canonical\_service | ||
|
||
A Monitoring Service is the root resource under which operational aspects of a | ||
generic service are accessible. A service is some discrete, autonomous, and | ||
network-accessible unit, designed to solve an individual concern | ||
|
||
A monitoring Istio Canonical Service is automatically created by GCP to monitor | ||
Istio Canonical Services. | ||
|
||
|
||
To get more information about Service, see: | ||
|
||
* [API documentation](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/services) | ||
* How-to Guides | ||
* [Service Monitoring](https://cloud.google.com/monitoring/service-monitoring) | ||
* [Monitoring API Documentation](https://cloud.google.com/monitoring/api/v3/) | ||
|
||
## Example Usage - Monitoring Istio Canonical Service | ||
|
||
|
||
```hcl | ||
# Monitors the default MeshIstio service | ||
data "google_monitoring_istio_canonical_service" "default" { | ||
mesh_uid = "proj-573164786102" | ||
canonical_service_namespace = "istio-system" | ||
canonical_service = "prometheus" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The arguments of this data source act as filters for identifying a given -created service. | ||
|
||
The given filters must match exactly one service whose data will be exported as attributes. The following arguments are supported: | ||
|
||
The following fields must be specified: | ||
|
||
* `mesh_uid` - (Required) Identifier for the mesh in which this Istio service is defined. | ||
Corresponds to the meshUid metric label in Istio metrics. | ||
|
||
* `canonical_service_namespace` - (Required) The namespace of the canonical service underlying this service. | ||
Corresponds to the destination_canonical_service_namespace metric label in Istio metrics. | ||
|
||
* `canonical_service` - (Required) The name of the canonical service underlying this service. | ||
Corresponds to the destination_canonical_service_name metric label in label in Istio metrics. | ||
|
||
- - - | ||
|
||
Other optional fields include: | ||
|
||
* `project` - (Optional) The ID of the project in which the resource belongs. | ||
If it is not provided, the provider project is used. | ||
|
||
## Attributes Reference | ||
|
||
In addition to the arguments listed above, the following computed attributes are exported: | ||
|
||
* `name` - | ||
The full REST resource name for this channel. The syntax is: | ||
`projects/[PROJECT_ID]/services/[SERVICE_ID]`. | ||
|
||
* `display_name` - | ||
Name used for UI elements listing this (Monitoring) Service. | ||
|
||
* `telemetry` - | ||
Configuration for how to query telemetry on the Service. Structure is documented below. | ||
|
||
The `telemetry` block includes: | ||
|
||
* `resource_name` - | ||
(Optional) | ||
The full name of the resource that defines this service. | ||
Formatted as described in | ||
https://cloud.google.com/apis/design/resource_names. |
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