Skip to content

Commit

Permalink
Add daemonset sample
Browse files Browse the repository at this point in the history
This is mostly like busybox deployment using a daemonset instead of
deployment.

Signed-off-by: Nir Soffer <[email protected]>
  • Loading branch information
nirs committed Nov 14, 2023
1 parent 326d39d commit f40c24f
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 0 deletions.
47 changes: 47 additions & 0 deletions busybox-daemonset/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: busybox
spec:
selector:
matchLabels:
appname: busybox
template:
metadata:
labels:
appname: busybox
spec:
containers:
- name: logger
image: quay.io/nirsof/busybox:stable
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
emit() {
echo "$(date) $1" | tee -a /var/log/ramen.log
sync
}
trap "emit STOP; exit" TERM
emit START
while true; do
sleep 10 & wait
emit UPDATE
done
volumeMounts:
- name: varlog
mountPath: /var/log
volumes:
- name: varlog
persistentVolumeClaim:
claimName: busybox-pvc
tolerations:
# Run also on control-plane and master nodes.
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
6 changes: 6 additions & 0 deletions busybox-daemonset/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
resources:
- pvc.yaml
- daemonset.yaml
commonLabels:
appname: busybox
12 changes: 12 additions & 0 deletions busybox-daemonset/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: busybox-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: rook-ceph-block
resources:
requests:
storage: 1Gi
6 changes: 6 additions & 0 deletions dr-daemonset/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
resources:
- ../dr
namespace: busybox-sample-daemonset
commonLabels:
app: busybox-sample-daemonset
14 changes: 14 additions & 0 deletions subscription-daemonset/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
resources:
- ../subscription
namespace: busybox-sample-daemonset
commonLabels:
app: busybox-sample-daemonset
patches:
- target:
kind: Subscription
name: busybox-sub
patch: |-
- op: replace
path: /metadata/annotations/apps.open-cluster-management.io~1github-path
value: busybox-daemonset

0 comments on commit f40c24f

Please sign in to comment.