Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
biplamal committed Jul 5, 2024
1 parent 5449ce4 commit 88a6f2c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ logs/
/deployments/k8s/mod.yaml
/etc
/deployments/.ixia-c-config.yaml
/deployments/k8s/manifests/.ixia-c-b2b-eth0.yaml
12 changes: 6 additions & 6 deletions deployments/k8s/manifests/ixia-c-b2b-eth0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ items:
- args:
- --accept-eula
- --debug
image: ghcr.io/open-traffic-generator/keng-controller:local
image: $(configq .images[0].path):$(configq .images[0].tag)
imagePullPolicy: IfNotPresent
name: keng-controller
volumeMounts:
Expand All @@ -45,7 +45,7 @@ items:
- -http-server
- https://localhost:8443
- --debug
image: ghcr.io/open-traffic-generator/otg-gnmi-server:local
image: $(configq .images[1].path):$(configq .images[1].tag)
imagePullPolicy: IfNotPresent
name: otg-gnmi-server
ports:
Expand Down Expand Up @@ -77,15 +77,15 @@ items:
value: "5555"
- name: ARG_CORE_LIST
value: 1 1 1
image: ghcr.io/open-traffic-generator/ixia-c-traffic-engine:local
image: $(configq .images[2].path):$(configq .images[2].tag)
imagePullPolicy: IfNotPresent
name: otg-port-eth1-traffic-engine
securityContext:
privileged: true
- env:
- name: INTF_LIST
value: eth0
image: ghcr.io/open-traffic-generator/ixia-c-protocol-engine:local
image: $(configq .images[3].path):$(configq .images[3].tag)
imagePullPolicy: IfNotPresent
name: otg-port-eth1-protocol-engine
securityContext:
Expand All @@ -110,15 +110,15 @@ items:
value: "5555"
- name: ARG_CORE_LIST
value: 1 1 1
image: ghcr.io/open-traffic-generator/ixia-c-traffic-engine:local
image: $(configq .images[2].path):$(configq .images[2].tag)
imagePullPolicy: IfNotPresent
name: otg-port-eth2-traffic-engine
securityContext:
privileged: true
- env:
- name: INTF_LIST
value: eth0
image: ghcr.io/open-traffic-generator/ixia-c-protocol-engine:local
image: $(configq .images[3].path):$(configq .images[3].tag)
imagePullPolicy: IfNotPresent
name: otg-port-eth2-protocol-engine
securityContext:
Expand Down
35 changes: 33 additions & 2 deletions do.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1136,10 +1136,41 @@ k8s_namespace() {
grep namespace deployments/k8s/manifests/${1}.yaml -m 1 | cut -d \: -f2 | cut -d \ -f 2
}
eval_config_manifest() {
file={1}
new_file=".{1}"
get_yq \
&& rm -rf ${new_file}
# avoid splitting based on whitespace
IFS=''
# mix of cat and echo is used to ensure the input file has
# at least one newline before EOF, otherwise read will not
# provide last line
{ cat ${file}; echo; } | while read line; do
# replace all double-quotes with single quotes
line=$(echo "${line}" | sed s#\"#\'#g)
# and revert them back to double-quotes post eval;
# this will result in converting all single-quotes
# to double-quotes regardless of whether they were
# originally double-quotes, but hopefully this won't
# be an issue
# this workaround was put in place because eval gets
# rid of double-quotes
eval echo \"$line\" | sed s#\'#\"#g >> ${new_file}
done
# restore default IFS
unset IFS
cat ${new_file}
}
create_ixia_c_k8s() {
echo "Creating K8S ${1} topology ..."
ns=$(k8s_namespace ${1})
kubectl apply -f deployments/k8s/manifests/${1}.yaml \
cd deployments/k8s/manifests \
&& eval_config_manifest {1}.yaml \
&& kubectl apply -f .${1}.yaml \
&& cd ../../.. \
&& wait_for_pods ${ns} \
&& kubectl get pods -A \
&& kubectl get services -A \
Expand All @@ -1150,7 +1181,7 @@ create_ixia_c_k8s() {
rm_ixia_c_k8s() {
echo "Removing K8S ${1} topology ..."
ns=$(k8s_namespace ${1})
kubectl delete -f deployments/k8s/manifests/${1}.yaml \
kubectl delete -f deployments/k8s/manifests/.${1}.yaml \
&& wait_for_no_namespace ${ns}
}
Expand Down

0 comments on commit 88a6f2c

Please sign in to comment.