Skip to content

Commit

Permalink
feat: added files in example
Browse files Browse the repository at this point in the history
Signed-off-by: RealAnna <[email protected]>
  • Loading branch information
RealAnna committed Oct 18, 2022
1 parent ca6db8f commit 001afc5
Show file tree
Hide file tree
Showing 8 changed files with 415 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/slack-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Create Secret for Slack here

```
kubectl create secret generic slack-notification --from-literal=SECURE_DATA='{"slack_hook":"<WebHook>","text":"Deployed PodTatoHead Application"}' -n podtato-kubectl -oyaml --dry-run > slack-secret.yaml
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: lifecycle.keptn.sh/v1alpha1
kind: KeptnApp
metadata:
name: podtato-head
namespace: podtato-kubectl
spec:
version: "1.3"
workloads:
- name: podtato-head-left-arm
version: 0.1.0
- name: podtato-head-left-leg
version: 0.1.0
- name: podtato-head-entry
version: 0.1.0
- name: podtato-head-right-arm
version: 0.1.0
- name: podtato-head-left-arm
version: 0.1.0
- name: podtato-head-hat
version: 0.1.0
postDeploymentTasks:
- post-deployment-hello
preDeploymentEvaluations: #Comment out this two lines if you do not have a prometheus installation
- my-prometheus-definition
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: lifecycle.keptn.sh/v1alpha1
kind: KeptnTaskDefinition
metadata:
name: check-entry-service
namespace: podtato-kubectl
spec:
function:
httpRef:
url: https://raw.githubusercontent.com/keptn-sandbox/lifecycle-controller/main/functions-runtime/samples/ts/http.ts
parameters:
map:
url: http://podtato-head-entry.podtato-kubectl.svc.cluster.local:9000
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: lifecycle.keptn.sh/v1alpha1
kind: KeptnEvaluationDefinition
metadata:
name: my-prometheus-definition
namespace: podtato-kubectl
spec:
source: prometheus
objectives:
- name: query-1
query: "sum(prometheus_engine_query_duration_seconds_count)"
evaluationTarget: ">10" #string: can only be starting with < or >
- name: query-2
query: "sum(kube_pod_container_resource_limits{resource='mem'}) - sum(kube_node_status_capacity{resource='mem'})"
evaluationTarget: "<100000000000000000" #string: can only be starting with < or >

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: lifecycle.keptn.sh/v1alpha1
kind: KeptnEvaluationProvider
metadata:
name: prometheus
namespace: podtato-kubectl
spec:
targetServer: "http://prometheus-k8s.monitoring.svc.cluster.local:9090" #string
secretName: prometheusLoginCredentials #secret name, optional
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
apiVersion: v1
kind: Namespace
metadata:
name: podtato-kubectl
annotations:
keptn.sh/lifecycle-controller: "enabled"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-entry
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
matchLabels:
component: podtato-head-entry
template:
metadata:
labels:
component: podtato-head-entry
annotations:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-entry
keptn.sh/version: 0.1.0
keptn.sh/post-deployment-tasks: post-deployment-hello
spec:
terminationGracePeriodSeconds: 5
initContainers:
- name: init-myservice
image: busybox:1.28
command: ['sh', '-c', 'sleep 30']
containers:
- name: server
image: ghcr.io/podtato-head/entry:latest
imagePullPolicy: Always
ports:
- containerPort: 9000
env:
- name: PODTATO_PORT
value: "9000"
---
apiVersion: v1
kind: Service
metadata:
name: podtato-head-entry
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
component: podtato-head-entry
ports:
- name: http
port: 9000
protocol: TCP
targetPort: 9000
type: LoadBalancer
# change to NodePort if no LoadBalancer controller is available
# type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-hat
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
matchLabels:
component: podtato-head-hat
template:
metadata:
labels:
component: podtato-head-hat
keptn.sh/pre-deployment-tasks: check-entry-service
annotations:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-hat
keptn.sh/version: 0.1.0
spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: ghcr.io/podtato-head/hat:latest
imagePullPolicy: Always
ports:
- containerPort: 9000
env:
- name: PODTATO_PORT
value: "9000"
---
apiVersion: v1
kind: Service
metadata:
name: podtato-head-hat
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
component: podtato-head-hat
ports:
- name: http
port: 9001
protocol: TCP
targetPort: 9000
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-left-leg
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
matchLabels:
component: podtato-head-left-leg
template:
metadata:
labels:
component: podtato-head-left-leg
annotations:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-left-leg
keptn.sh/version: 0.1.0
keptn.sh/pre-deployment-tasks: check-entry-service
spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: ghcr.io/podtato-head/left-leg:latest
imagePullPolicy: Always
ports:
- containerPort: 9000
env:
- name: PODTATO_PORT
value: "9000"
---
apiVersion: v1
kind: Service
metadata:
name: podtato-head-left-leg
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
component: podtato-head-left-leg
ports:
- name: http
port: 9002
protocol: TCP
targetPort: 9000
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-left-arm
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
matchLabels:
component: podtato-head-left-arm
template:
metadata:
labels:
component: podtato-head-left-arm
annotations:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-left-arm
keptn.sh/version: 0.1.0
keptn.sh/pre-deployment-tasks: check-entry-service
spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: ghcr.io/podtato-head/left-arm:latest
imagePullPolicy: Always
ports:
- containerPort: 9000
env:
- name: PODTATO_PORT
value: "9000"
---
apiVersion: v1
kind: Service
metadata:
name: podtato-head-left-arm
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
component: podtato-head-left-arm
ports:
- name: http
port: 9003
protocol: TCP
targetPort: 9000
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-right-leg
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
matchLabels:
component: podtato-head-right-leg
template:
metadata:
labels:
component: podtato-head-right-leg
annotations:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-right-leg
keptn.sh/version: 0.1.0
keptn.sh/pre-deployment-tasks: check-entry-service
spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: ghcr.io/podtato-head/right-leg:latest
imagePullPolicy: Always
ports:
- containerPort: 9000
env:
- name: PODTATO_PORT
value: "9000"
---
apiVersion: v1
kind: Service
metadata:
name: podtato-head-right-leg
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
component: podtato-head-right-leg
ports:
- name: http
port: 9004
protocol: TCP
targetPort: 9000
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: podtato-head-right-arm
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
matchLabels:
component: podtato-head-right-arm
template:
metadata:
labels:
component: podtato-head-right-arm
annotations:
keptn.sh/app: podtato-head
keptn.sh/workload: podtato-head-right-arm
keptn.sh/version: 0.1.0
keptn.sh/pre-deployment-tasks: check-entry-service
spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: ghcr.io/podtato-head/right-arm:latest
imagePullPolicy: Always
ports:
- containerPort: 9000
env:
- name: PODTATO_PORT
value: "9000"
---
apiVersion: v1
kind: Service
metadata:
name: podtato-head-right-arm
namespace: podtato-kubectl
labels:
app: podtato-head
spec:
selector:
component: podtato-head-right-arm
ports:
- name: http
port: 9005
protocol: TCP
targetPort: 9000
type: ClusterIP
Loading

0 comments on commit 001afc5

Please sign in to comment.