Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: extract code samples to shortcodes #2633

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: <library>
kind: <kind>
metadata:
name: <name>
spec:
...
9 changes: 1 addition & 8 deletions docs-new/docs/contribute/docs/yaml-crd-ref-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ Copy this template to create a new CRD reference page.

## Synopsis

```yaml
apiVersion: <library>
kind: <kind>
metadata:
name: <name>
spec:
...
```
{% include "./assets/yaml-crd-ref-template.md_1.yaml" %}

## Fields

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: lifecycle.keptn.sh/v1alpha3
kind: KeptnTaskDefinition
metadata:
name: send-event
namespace: keptndemo
spec:
retries: 0
timeout: 5s
container:
name: curlcontainer
image: curlimages/curl:latest
args: [
'-X',
'POST',
'http://webhook.webhook.svc.cluster.local:8084/YOUR-UUID-HERE',
'-H',
'Content-Type: application/json',
'-d',
'{ "from": "keptn send-event" }'
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: lifecycle.keptn.sh/v1alpha3
kind: KeptnTask
metadata:
name: runsendevent1
namespace: keptndemo
spec:
taskDefinition: send-event
context:
appName: "my-test-app"
appVersion: "1.0.0"
objectType: ""
taskType: ""
workloadName: "my-test-workload"
workloadVersion: "1.0.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
...
labels:
app.kubernetes.io/part-of: keptndemoapp
app.kubernetes.io/name: nginx
app.kubernetes.io/version: 0.0.2
keptn.sh/post-deployment-tasks: "send-event"
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: keptndemo
labels:
app.kubernetes.io/name: nginx
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nginx
template:
metadata:
labels:
app.kubernetes.io/part-of: keptndemoapp
app.kubernetes.io/name: nginx
app.kubernetes.io/version: 0.0.2
keptn.sh/post-deployment-tasks: "send-event"
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
21 changes: 21 additions & 0 deletions docs-new/docs/getting-started/assets/metrics.md_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: metrics.keptn.sh/v1beta1
kind: Keptnmetric
metadata:
name: available-cpus
namespace: simplenode-dev
spec:
provider:
name: dev-prometheus
query: "sum(kube_node_status_capacity{resources`cpu`})"
fetchIntervalSeconds: 10
---
apiVersion: metrics.keptn.sh/v1beta1
kind: Keptnmetric
metadata:
name: availability-slo
namespace: simplenode-dev
spec:
provider:
name: dev-dynatrace
query: "func:slo.availability_simplenodeservice"
fetchIntervalSeconds: 10
1 change: 1 addition & 0 deletions docs-new/docs/getting-started/assets/metrics.md_2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta2/namespaces/<namespace>/keptnmetrics.metrics.sh/<metric-name>/<metric-name>"
23 changes: 23 additions & 0 deletions docs-new/docs/getting-started/assets/metrics.md_3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$ kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta2/namespaces/simplenode-dev/keptnmetrics.metrics.sh/available-cpus/available-cpus"

{
"kind": "MetricValueList",
"apiVersion": "custom.metrics.k8s.io/v1beta2",
"metadata": {},
"items": [
{
"describedObject": {
"kind": "KeptnMetric",
"namespace": "simplenode-dev",
"name": "available-cpus",
"apiVersion": "metrics.keptn.sh/v1beta1"
},
"metric": {
"name": "available-cpus",
"selector": {}
},
"timestamp": "2023-05-11T08:05:36Z",
"value": "6"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: options.keptn.sh/v1alpha1
kind: KeptnConfig
metadata:
name: keptnconfig-sample
namespace: keptn-system
spec:
OTelCollectorUrl: 'jaeger-collector.keptn-system.svc.cluster.local:4317'
keptnAppCreationRequestTimeoutSeconds: 30
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: keptndemo
annotations:
keptn.sh/lifecycle-toolkit: enabled
39 changes: 39 additions & 0 deletions docs-new/docs/getting-started/assets/observability.md_3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: keptndemo
labels:
app.kubernetes.io/name: nginx
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: nginx
template:
metadata:
labels:
app.kubernetes.io/part-of: keptndemoapp
app.kubernetes.io/name: nginx
app.kubernetes.io/version: 0.0.1
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
---
apiVersion: apps/v1
kind: Service
apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: keptndemo
spec:
selector:
app.kubernetes.io/name: nginx
ports:
- protocol: TCP
port: 8080
targetPort: 80
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
name: jaeger
spec:
strategy: allInOne
39 changes: 39 additions & 0 deletions docs-new/docs/getting-started/assets/observability.md_5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: v1
kind: Secret
type: Opaque
metadata:
labels:
grafana_datasource: "1"
name: grafana-datasources
namespace: monitoring
stringData:
datasources.yaml: |-
{
"apiVersion": 1,
"datasources": [
{
"access": "proxy",
"editable": false,
"name": "prometheus",
"orgId": 1,
"type": "prometheus",
"url": "http://observability-stack-kube-p-prometheus.monitoring.svc:9090",
"version": 1
},
{
"orgId":1,
"name":"Jaeger",
"type":"jaeger",
"typeName":"Jaeger",
"typeLogoUrl":"public/app/plugins/datasource/jaeger/img/jaeger_logo.svg",
"access":"proxy",
"url":"http://jaeger-query.keptn-system.svc.cluster.local:16686",
"user":"",
"database":"",
"basicAuth":false,
"isDefault":false,
"jsonData":{"spanBar":{"type":"None"}},
"readOnly":false
}
]
}
10 changes: 10 additions & 0 deletions docs-new/docs/getting-started/assets/observability.md_6.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
grafana:
adminPassword: admin
sidecar.datasources.defaultDatasourceEnabled: false
prometheus:
prometheusSpec:
additionalScrapeConfigs:
- job_name: "scrape_klt"
scrape_interval: 5s
static_configs:
- targets: ['lifecycle-operator-metrics-service.keptn-system.svc.cluster.local:2222']
21 changes: 21 additions & 0 deletions docs-new/docs/getting-started/assets/observability.md_7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: lifecycle.keptn.sh/v1alpha3
kind: KeptnApp
metadata:
name: <app-name>
namespace: <app-namespace>
spec:
version: "x.y"
revision: x
workloads:
- name: <workload1-name>
version: <version-string>
- name: <workload2-name>
version: <version-string>
preDeploymentTasks:
- <list of tasks>
postDeploymentTasks:
- <list of tasks>
preDeploymentEvaluations:
- <list of evaluations>
postDeploymentEvaluations:
- <list of evaluations>
16 changes: 16 additions & 0 deletions docs-new/docs/getting-started/assets/observability.md_8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: lifecycle.keptn.sh/v1alpha3
kind: KeptnApp
metadata:
name: podtato-head
namespace: podtato-kubectl
spec:
version: "latest"
workloads:
- name: podtato-head-left-arm
version: "my_vers12.5"
- name: podtato-head-left-leg
version: "my_v24"
postDeploymentTasks:
- post-deployment-hello
preDeploymentEvaluations:
- my-prometheus-definition
Loading
Loading