Skip to content

Commit

Permalink
fix: kubernetes playbooks with agents
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Dec 1, 2024
1 parent 4a70a60 commit da7c9dc
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 2 deletions.
2 changes: 2 additions & 0 deletions charts/playbooks-kubernetes/templates/create-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ spec:
- agent: all
types:
- Kubernetes::Namespace
runsOn:
- {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}}
actions:
- name: Create Deployment
exec:
Expand Down
3 changes: 3 additions & 0 deletions charts/playbooks-kubernetes/templates/delete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ spec:
icon: trash
category: Kubernetes
description: Deletes the resource
runsOn:
- {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}}

configs:
- agent: all
types:
Expand Down
8 changes: 6 additions & 2 deletions charts/playbooks-kubernetes/templates/deploy-helm-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ spec:
type: code

configs:
- types:
- agent: all
types:
- Kubernetes::Namespace
runsOn:
- {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}}

actions:
- name: Create Deployment
exec:
script: |
# gotemplate: left-delim=$[[ right-delim=]]
helm repo add $[[.params.chart]] $[[.params.repo]]
helm repo update
helm install $[[.params.chart]] -n $[[.config.name]]
helm install $[[.params.chart]] $[[.params.repo]]/$[[.params.chart]] -n $[[.config.name]]
{{- end}}
3 changes: 3 additions & 0 deletions charts/playbooks-kubernetes/templates/ignore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ kind: Playbook
metadata:
name: kubernetes-ignore-changes
spec:
runsOn:
- {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}}

actions:
- exec:
script: |
Expand Down
3 changes: 3 additions & 0 deletions charts/playbooks-kubernetes/templates/pod-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ spec:
- agent: all
types:
- Kubernetes::Pod
runsOn:
- {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}}

actions:
- name: Take snapshot
exec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ spec:
- agent: all
types:
- Kubernetes::Namespace
runsOn:
- {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}}

actions:
- name: Create RoleBinding
exec:
Expand Down
3 changes: 3 additions & 0 deletions charts/playbooks-kubernetes/templates/restart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ spec:
- Kubernetes::Statefulset
- Kubernetes::DaemonSet

runsOn:
- {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}}

actions:
- name: Restart
exec:
Expand Down
3 changes: 3 additions & 0 deletions charts/playbooks-kubernetes/templates/scale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ spec:
label: Replicas
type: text
default: "$(.config.config.spec.replicas)"
runsOn:
- {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}}

actions:
- name: Scale resource
exec:
Expand Down
3 changes: 3 additions & 0 deletions charts/playbooks-kubernetes/templates/update-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ spec:
label: Image
type: text
default: '$( .config.config | jq ".spec.template.spec.containers[0].image" )'
runsOn:
- {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}}

actions:
- name: Update image
exec:
Expand Down
2 changes: 2 additions & 0 deletions charts/playbooks-kubernetes/templates/update-resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ spec:
type: bytes
default: '$( .config.config | jq ".spec.template.spec.containers[0].resources.limits.memory" | default "")'

runsOn:
- {{` "{{- if .agent }}{{.agent.id}}{{ else }}local{{ end }}" `}}

actions:
- name: Update Resource Requests and Limits
Expand Down

0 comments on commit da7c9dc

Please sign in to comment.