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
global: | |
scrape_interval: 30s | |
scrape_timeout: 10s | |
evaluation_interval: 30s | |
external_labels: | |
prometheus: monitoring/k8s | |
prometheus_replica: prometheus-k8s-0 | |
alerting: | |
alert_relabel_configs: | |
- separator: ; |
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
# CA | |
# CN is "ca" | |
# Expiry in 10 years | |
openssl req \ | |
-x509 \ | |
-newkey rsa:4096 \ | |
-keyout ${PWD}/certs/ca.key \ | |
-out ${PWD}/certs/ca.crt \ | |
-nodes \ | |
-days 3650 \ |
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
ctx := context.Background() | |
containerService, _ := container.NewService(ctx) | |
name := fmt.Sprintf("projects/%s/locations/%s/clusters/%s", clusterProject, clusterLocation, clusterName) | |
rqst := containerService.Projects.Locations.Clusters.Get(name) | |
resp, _ := rqst.Do() | |
cert, _ := base64.StdEncoding.DecodeString(resp.MasterAuth.ClusterCaCertificate) | |
// Create Config for Cluster |
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
def generate_token(): | |
scopes = "https://www.googleapis.com/auth/cloud-platform" | |
url = f"http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token?scopes={scopes}" | |
headers = {'Metadata-Flavor': 'Google'} | |
resp = requests.get(url, headers=headers) | |
j = resp.json() | |
token = j['access_token'] | |
return token |
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
{ | |
"annotations": { | |
"list": [ | |
{ | |
"builtIn": 1, | |
"datasource": "-- Grafana --", | |
"enable": true, | |
"hide": true, | |
"iconColor": "rgba(0, 211, 255, 1)", | |
"name": "Annotations & Alerts", |
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
module github.com/my-account/this-repo | |
go 1.16 | |
require ( | |
github.com/my-account/another-repo v0.0.1 | |
github.com/onsi/ginkgo v1.16.4 | |
github.com/onsi/gomega v1.13.0 | |
github.com/prometheus/client_golang v1.11.0 | |
google.golang.org/api v0.54.0 |
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
fields = ["campaign.id", "segments.device"] | |
query = """ | |
SELECT {fields} | |
FROM campaign | |
WHERE segments.date = '{date}' | |
LIMIT 10 | |
""".format( | |
fields=",".join([str(f) for f in fields]), | |
date="210611", |
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
{ | |
"[go]": { | |
"editor.formatOnSave": true, | |
"editor.codeActionsOnSave": { | |
"source.organizeImports": true | |
} | |
}, | |
"[markdown]": { | |
"editor.wordWrap": "off", | |
"editor.wordWrapColumn": 100, |
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
kubectl get node --output=yaml | |
apiVersion: v1 | |
items: | |
- apiVersion: v1 | |
kind: Node | |
metadata: | |
annotations: | |
node.alpha.kubernetes.io/ttl: "0" | |
volumes.kubernetes.io/controller-managed-attach-detach: "true" | |
creationTimestamp: "2020-10-26T17:03:29Z" |
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
// DNS (!) permitted name parts | |
// It's permitted to use hyphens but these must occur at most once (!) between alphanumeric | |
name = { ASCII_ALPHANUMERIC ~ ( ( ASCII_ALPHANUMERIC ~ HYPHEN ~ ASCII_ALPHANUMERIC ) | ASCII_ALPHANUMERIC )* } | |
full_name = { "name=\"" ~ name ~ "\"" } | |
domain = { ASCII_ALPHA_LOWER+ } | |
full_domain = { "domain=\"" ~ domain ~ "\"" } | |
// It may be redundant to define these as constants!? | |
tcp = { "tcp" } |
NewerOlder