Skip to content

Commit

Permalink
Move pod template from supplier app back to example
Browse files Browse the repository at this point in the history
Signed-off-by: Danil Uzlov <DanilUzlov@yandex.ru>
  • Loading branch information
d-uzlov committed May 27, 2021
1 parent 5df8c4b commit b69eafc
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
5 changes: 0 additions & 5 deletions apps/nse-supplier-k8s/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,3 @@ kind: Kustomization
resources:
- supplier.yaml
- role.yaml

configMapGenerator:
- name: supplier-pod-template-configmap
files:
- pod-template.yaml
8 changes: 0 additions & 8 deletions apps/nse-supplier-k8s/supplier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,13 @@ spec:
fieldPath: metadata.name
- name: NSE_CONNECT_TO
value: unix:///var/lib/networkservicemesh/nsm.io.sock
- name: NSE_POD_DESCRIPTION_FILE
value: /run/supplier/pod-template.yaml
volumeMounts:
- name: spire-agent-socket
mountPath: /run/spire/sockets
readOnly: true
- name: nsm-socket
mountPath: /var/lib/networkservicemesh
readOnly: true
- name: pod-file
mountPath: /run/supplier
readOnly: true
resources:
limits:
memory: 40Mi
Expand All @@ -52,6 +47,3 @@ spec:
hostPath:
path: /var/lib/networkservicemesh
type: DirectoryOrCreate
- name: pod-file
configMap:
name: supplier-pod-template-configmap
17 changes: 16 additions & 1 deletion examples/features/scale-from-zero/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ kubectl exec -n spire spire-server-0 -- \
NODES=($(kubectl get nodes -o go-template='{{range .items}}{{ if not .spec.taints }}{{ .metadata.name }} {{end}}{{end}}'))
NSC_NODE=${NODES[0]}
SUPPLIER_NODE=${NODES[1]}
if [ "$SUPPLIER_NODE" == "" ]; then SUPPLIER_NODE=$NSC_NODE; fi
if [ "$SUPPLIER_NODE" == "" ]; then SUPPLIER_NODE=$NSC_NODE; echo "Only 1 node found, testing that pod is created on the same node is useless"; fi
```

4. Create patch for NSC:
Expand Down Expand Up @@ -87,6 +87,16 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NSE_POD_DESCRIPTION_FILE
value: /run/supplier/pod-template.yaml
volumeMounts:
- name: pod-file
mountPath: /run/supplier
readOnly: true
volumes:
- name: pod-file
configMap:
name: supplier-pod-template-configmap
EOF
```

Expand All @@ -106,6 +116,11 @@ bases:
patchesStrategicMerge:
- patch-nsc.yaml
- patch-supplier.yaml
configMapGenerator:
- name: supplier-pod-template-configmap
files:
- pod-template.yaml
EOF
```

Expand Down
20 changes: 20 additions & 0 deletions examples/features/scale-from-zero/patch-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: apps/v1
kind: Pod
metadata:
name: nse-icmp-responder
labels:
app: nse-icmp-responder
spec:
restartPolicy: Never
containers:
- name: nse-icmp-responder
env:
- name: NSE_CIDR_PREFIX
value: 169.254.0.0/16
- name: NSE_SERVICE_NAME
value: autoscale-icmp-responder
- name: NSE_LABELS
value: app:nse-icmp-responder
- name: NSE_IDLE_TIMEOUT
value: 15s
File renamed without changes.

0 comments on commit b69eafc

Please sign in to comment.