-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New indexer codebundles and tweaks (#293)
* initial gcp index test * scale back test templates * remove commented items from template (unsupported) * test with gcp compute instances * test path based option * play with qualifiers * keep debugging path * try just simple path * gcp test * test quotes * back to status * try node preempt * clean up gcp rule * add additional slx context * test context update * update gcp test rule * update desc * debug templates * attempt runbook debug * update command * add slo back in * update meta * add az lb health codebundle back * initial cloud function cb test * minor format fixes * add log fetching * fix trailing url . * add template data * add templates back * modify filter to negate ACTIVE state * fix http latency issue * update reproduce hint * deployment log fix. cloud function gen1/2 support and log issue refactor * fix message processing and add gen 1 status check in sli * minor deployment log adjustment * change additional filter to uppercase OR
- Loading branch information
1 parent
0c29f88
commit 05f37ac
Showing
25 changed files
with
698 additions
and
297 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
28 changes: 28 additions & 0 deletions
28
codebundles/azure-loadbalancer-triage/.runwhen/generation-rules/az-lb-health.yaml
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,28 @@ | ||
apiVersion: runwhen.com/v1 | ||
kind: GenerationRules | ||
spec: | ||
platform: azure | ||
generationRules: | ||
- resourceTypes: | ||
- azure_network_load_balancers | ||
matchRules: | ||
- type: and | ||
matches: | ||
- type: pattern | ||
pattern: ".+" | ||
properties: [name] | ||
mode: substring | ||
- resourceType: variables | ||
type: pattern | ||
pattern: ".+" | ||
properties: [custom/azure_credentials_secret_name] | ||
mode: exact | ||
slxs: | ||
- baseName: az-lb-health | ||
levelOfDetail: basic | ||
qualifiers: [resource, resource_group] | ||
baseTemplateName: az-lb-health | ||
outputItems: | ||
- type: slx | ||
- type: runbook | ||
templateName: az-lb-health-taskset.yaml |
22 changes: 22 additions & 0 deletions
22
codebundles/azure-loadbalancer-triage/.runwhen/templates/az-lb-health-slx.yaml
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,22 @@ | ||
apiVersion: runwhen.com/v1 | ||
kind: ServiceLevelX | ||
metadata: | ||
name: {{slx_name}} | ||
labels: | ||
{% include "common-labels.yaml" %} | ||
annotations: | ||
{% include "common-annotations.yaml" %} | ||
spec: | ||
imageURL: https://storage.googleapis.com/runwhen-nonprod-shared-images/icons/azure/networking/10062-icon-service-Load-Balancers.svg | ||
alias: {{match_resource.name}} Azure Load Balancer Health | ||
asMeasuredBy: "Querying the Azure Load Balancer health for incidents or critical events." | ||
configProvided: | ||
- name: OBJECT_NAME | ||
value: {{match_resource.name}} | ||
owners: | ||
- {{workspace.owner_email}} | ||
statement: Ensure Azure Network Load Balancers are healthy. | ||
additionalContext: | ||
tags: "{{match_resource.tags}}" | ||
qualified_name: "{{ match_resource.qualified_name }}" | ||
resource_group: "{{ match_resource.resource_group.name }}" |
34 changes: 34 additions & 0 deletions
34
codebundles/azure-loadbalancer-triage/.runwhen/templates/az-lb-health-taskset.yaml
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,34 @@ | ||
## Needs tuning as soon as we can match on application resource | ||
apiVersion: runwhen.com/v1 | ||
kind: Runbook | ||
metadata: | ||
name: {{slx_name}} | ||
labels: | ||
{% include "common-labels.yaml" %} | ||
annotations: | ||
{% include "common-annotations.yaml" %} | ||
spec: | ||
location: {{default_location}} | ||
codeBundle: | ||
{% if repo_url %} | ||
repoUrl: {{repo_url}} | ||
{% else %} | ||
repoUrl: https://github.com/runwhen-contrib/rw-cli-codecollection.git | ||
{% endif %} | ||
{% if ref %} | ||
ref: {{ref}} | ||
{% else %} | ||
ref: main | ||
{% endif %} | ||
pathToRobot: codebundles/azure-loadbalancer-triage/runbook.robot | ||
configProvided: | ||
- name: AZ_HISTORY_RANGE | ||
value: '24' | ||
- name: AZ_LB_NAME | ||
value: {{match_resource.name}} | ||
- name: AZ_LB_ID | ||
value: {{match_resource.id}} | ||
secretsProvided: | ||
- name: azure_credentials | ||
workspaceKey: {{custom.azure_credentials_secret_name}} | ||
servicesProvided: [] |
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
25 changes: 8 additions & 17 deletions
25
codebundles/gcloud-node-preempt/.runwhen/generation-rules/gcloud-node-preempt.yaml
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
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
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 |
---|---|---|
@@ -1,43 +1,24 @@ | ||
commands: | ||
- command: gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS | ||
&& gcloud compute operations list --filter="operationType:( compute.instances.preempted | ||
) AND NOT status:( DONE )" --format=json --project=${GCP_PROJECT_ID} | jq '[.[] | ||
| {startTime,targetLink, statusMessage, progress, zone, selfLink}]' | ||
&& gcloud compute operations list --filter="operationType:(compute.instances.preempted) | ||
AND progress<100" --format=json --project=${GCP_PROJECT_ID} | jq '[.[] | {startTime,targetLink, | ||
statusMessage, progress, zone, selfLink}]' | ||
doc_links: ' | ||
- [Service accounts on GCP](https://cloud.google.com/iam/docs/service-accounts){:target="_blank"} | ||
- [Google Cloud service accounts](https://cloud.google.com/iam/docs/creating-managing-service-accounts){:target="_blank"} | ||
- [Preemptible VM instances on GCP](https://cloud.google.com/compute/docs/instances/preemptible){:target="_blank"}' | ||
explanation: This command activates a service account for authentication and then | ||
lists all preempted compute instances that are not yet completed in a Google Cloud | ||
Platform project, displaying specific information about each instance in JSON | ||
format. The jq filter is used to select and format the specific fields of interest. | ||
multi_line_details: "# Activate the service account using the key file from the\ | ||
\ Google Application Credentials\ngcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS\ | ||
\ && \n\n# List all compute operations with specific filters and output in JSON\ | ||
\ format\ngcloud compute operations list --filter=\"operationType:( compute.instances.preempted\ | ||
\ ) AND NOT status:( DONE )\" --format=json --project=${GCP_PROJECT_ID} |\n\n\ | ||
# Use jq to filter and customize the output to display only certain fields\njq\ | ||
\ '[.[] | {startTime,targetLink, statusMessage, progress, zone, selfLink}]'" | ||
name: list_all_nodes_in_an_active_prempt_operation | ||
- command: gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS | ||
&& gcloud compute operations list --filter="operationType:( compute.instances.preempted | ||
) AND NOT status:( DONE )" --format=json --project=${GCP_PROJECT_ID} | jq '[.[] | ||
| {startTime,targetLink, statusMessage, progress, zone, selfLink}]' | ||
doc_links: ' | ||
- [Service accounts on GCP](https://cloud.google.com/iam/docs/service-accounts){:target="_blank"} | ||
- [Preemptible VM instances in Google Cloud](https://cloud.google.com/preemptible-vms){:target="_blank"} | ||
- [Preemptible VM instances on GCP](https://cloud.google.com/compute/docs/instances/preemptible){:target="_blank"}' | ||
explanation: This command activates a service account for authentication and then | ||
lists all preempted compute instances that are not yet completed in a Google Cloud | ||
Platform project, displaying specific information about each instance in JSON | ||
format. The jq filter is used to select and format the specific fields of interest. | ||
multi_line_details: "# Activate the service account using the key file from the\ | ||
\ Google Application Credentials\ngcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS\ | ||
\ && \n\n# List all compute operations with specific filters and output in JSON\ | ||
\ format\ngcloud compute operations list --filter=\"operationType:( compute.instances.preempted\ | ||
\ ) AND NOT status:( DONE )\" --format=json --project=${GCP_PROJECT_ID} |\n\n\ | ||
# Use jq to filter and customize the output to display only certain fields\njq\ | ||
\ '[.[] | {startTime,targetLink, statusMessage, progress, zone, selfLink}]'" | ||
name: list_all_nodes_in_an_active_prempt_operation | ||
- [jq documentation](https://stedolan.github.io/jq/manual/){:target="_blank"}' | ||
explanation: This command activates a service account for Google Cloud and then | ||
lists all preempted compute instances in a specific project, outputting the results | ||
in JSON format with specific attributes using jq. | ||
multi_line_details: "\n# Authenticate using a service account key\ngcloud auth activate-service-account\ | ||
\ --key-file=$GOOGLE_APPLICATION_CREDENTIALS \n\n# List compute operations for\ | ||
\ preempted instances with less than 100% progress in JSON format\n# Filter by\ | ||
\ operationType and progress, and specify the project\ngcloud compute operations\ | ||
\ list --filter=\"operationType:(compute.instances.preempted) AND progress<100\"\ | ||
\ --format=json --project=${GCP_PROJECT_ID} \n\n# Pipe the output to 'jq' to format\ | ||
\ the JSON response with specific fields\n| jq '[.[] | {startTime,targetLink,\ | ||
\ statusMessage, progress, zone, selfLink}]'\n" | ||
name: list_all_nodes_in_an_active_prempt_operation_for_gcp_project_gcp_project_id |
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
23 changes: 23 additions & 0 deletions
23
...undles/gcp-cloud-function-health/.runwhen/generation-rules/gcp-cloud-function-health.yaml
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,23 @@ | ||
apiVersion: runwhen.com/v1 | ||
kind: GenerationRules | ||
spec: | ||
platform: gcp | ||
generationRules: | ||
- resourceTypes: | ||
- gcp_functions_functions | ||
matchRules: | ||
- type: pattern | ||
pattern: ".+" | ||
properties: [name] | ||
mode: substring | ||
slxs: | ||
- baseName: gcp-function-health | ||
qualifiers: ["project"] | ||
baseTemplateName: gcp-cloud-function-health | ||
levelOfDetail: basic | ||
outputItems: | ||
- type: slx | ||
- type: sli | ||
- type: slo | ||
- type: runbook | ||
templateName: gcp-cloud-function-health-taskset.yaml |
34 changes: 34 additions & 0 deletions
34
codebundles/gcp-cloud-function-health/.runwhen/templates/gcp-cloud-function-health-sli.yaml
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,34 @@ | ||
apiVersion: runwhen.com/v1 | ||
kind: ServiceLevelIndicator | ||
metadata: | ||
name: {{slx_name}} | ||
labels: | ||
{% include "common-labels.yaml" %} | ||
annotations: | ||
{% include "common-annotations.yaml" %} | ||
spec: | ||
displayUnitsLong: Number | ||
displayUnitsShort: '#' | ||
locations: | ||
- {{default_location}} | ||
description: Measures ____ | ||
codeBundle: | ||
{% if repo_url %} | ||
repoUrl: {{repo_url}} | ||
{% else %} | ||
repoUrl: https://github.com/runwhen-contrib/rw-cli-codecollection.git | ||
{% endif %} | ||
{% if ref %} | ||
ref: {{ref}} | ||
{% else %} | ||
ref: main | ||
{% endif %} | ||
pathToRobot: codebundles/gcp-cloud-function-health/sli.robot | ||
intervalStrategy: intermezzo | ||
intervalSeconds: 300 | ||
configProvided: | ||
- name: GCP_PROJECT_ID | ||
value: {{match_resource.resource.project_id}} | ||
secretsProvided: | ||
- name: gcp_credentials_json | ||
workspaceKey: {{custom.gcp_ops_suite_sa}} |
Oops, something went wrong.