Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
ROS-Kubernetes
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Larkin Heintzman
ROS-Kubernetes
Commits
040f522b
Commit
040f522b
authored
Feb 02, 2022
by
Larkin Heintzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
image pipeline updates
parent
59a8d1bd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
35 deletions
+117
-35
Dockerfile
docker/base/Dockerfile
+19
-8
ros_entrypoint.sh
docker/base/ros_entrypoint.sh
+4
-0
Dockerfile
docker/drone/Dockerfile
+31
-3
bashCheckRoscore.sh
docker/drone/bashCheckRoscore.sh
+4
-0
ros_entrypoint.sh
docker/drone/ros_entrypoint.sh
+7
-0
base-deployment.yaml
kubernetes/base-deployment.yaml
+20
-8
drone-deployment.yaml
kubernetes/drone-deployment.yaml
+32
-16
No files found.
docker/base/Dockerfile
View file @
040f522b
...
...
@@ -2,9 +2,11 @@ ARG from=ros:noetic
FROM
${from}
RUN
apt-get update
&&
apt-get
install
-y
python3-pip git ca-certificates
RUN
apt-get update
&&
apt-get
install
-y
libsdl2-dev libusb-1.0-0-dev build-essential cmake
&&
apt-get
install
-y
openssh-server iputils-ping net-tools
sudo
RUN
apt-get update
&&
apt-get
install
-y
libsdl2-dev libusb-1.0-0-dev build-essential cmake
&&
apt-get
install
-y
openssh-server iputils-ping net-tools
sudo
nano ros-noetic-cv-bridge
RUN
echo
"el freshen up"
RUN
pip3
install
git+https://github.com/catkin/catkin_tools.git
RUN
pip
install
opencv-python
# clone ros package repo
ENV
ROS_WS /opt/ros_ws
...
...
@@ -12,6 +14,10 @@ RUN mkdir -p $ROS_WS/src
WORKDIR
$ROS_WS
RUN
git
-C
src clone https://git.caslab.ece.vt.edu/hlarkin3/base-station-ros/
WORKDIR
$ROS_WS/src/base-station-ros
RUN
git submodule init
&&
git submodule update
WORKDIR
$ROS_WS
# install ros package dependencies
RUN
apt-get update
&&
\
rosdep update
&&
\
...
...
@@ -25,18 +31,23 @@ RUN catkin config \
COPY
ros_entrypoint.sh /usr/local/bin/ros_entrypoint.sh
RUN
useradd
-m
-s
/bin/bash
-p
$(
openssl passwd
-1
password
)
webssh
RUN
useradd
-m
-s
/bin/bash
-p
$(
openssl passwd
-1
password
)
ssher
RUN
usermod
-aG
sudo
ssher
RUN
chmod
755 /usr/local/bin/ros_entrypoint.sh
# make ssh-ing easier
RUN
echo
"source /opt/ros/noetic/setup.bash"
>>
/home/webssh/.bashrc
RUN
echo
"source /opt/ros_ws/devel/setup.bash"
>>
/home/webssh/.bashrc
RUN
echo
"source /opt/ros/noetic/setup.bash"
>>
/home/ssher/.bashrc
RUN
echo
"source /opt/ros_ws/devel/setup.bash"
>>
/home/ssher/.bashrc
RUN
echo
"ssh-keyscan -H service-master >> /home/ssher/.ssh/known_hosts"
>>
/home/ssher/.bashrc
RUN
echo
"ssh-keyscan -H service-drone >> /home/ssher/.ssh/known_hosts"
>>
/home/ssher/.bashrc
# just doing this with hosts file now
# put rsa key in image
RUN
mkdir
-p
/home/
webssh
/.ssh
# COPY selfkey.pub /home/
webssh
/.ssh/authorized_keys
RUN
chown
-R
webssh:webssh /home/webssh
/.ssh
# RUN chmod 600 /home/
webssh
/.ssh/authorized_keys
RUN
mkdir
-p
/home/
ssher
/.ssh
# COPY selfkey.pub /home/
ssher
/.ssh/authorized_keys
RUN
chown
-R
ssher:ssher /home/ssher
/.ssh
# RUN chmod 600 /home/
ssher
/.ssh/authorized_keys
RUN
service ssh start
EXPOSE
22
...
...
docker/base/ros_entrypoint.sh
View file @
040f522b
...
...
@@ -7,6 +7,10 @@ source "/opt/ros/$ROS_DISTRO/setup.bash"
# might need to source the devel space as well
source
"
$ROS_WS
/devel/setup.bash"
# put some stuff in the hosts file
# echo "service-master.default.svc.cluster.local base-0" >> /etc/hosts
service ssh start
echo
"==> Container ready"
exec
"
$@
"
docker/drone/Dockerfile
View file @
040f522b
...
...
@@ -5,10 +5,13 @@ FROM ${from}
# python-catkin-tools \
# && rm -rf /var/lib/apt/lists/*
RUN
apt-get update
&&
apt-get
install
-y
python3-pip git ca-certificates
RUN
apt-get update
&&
apt-get
install
-y
libsdl2-dev libusb-1.0-0-dev build-essential cmake ffmpeg python3-opencv libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev iputils-ping net-tools openssh-server
sudo
RUN
apt-get update
&&
apt-get
install
-y
libsdl2-dev libusb-1.0-0-dev build-essential cmake ffmpeg python3-opencv libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavresample-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev iputils-ping net-tools openssh-server
sudo
nano ros-noetic-cv-bridge
RUN
apt-get update
&&
apt-get
install
-y
ros-noetic-tf
# RUN echo "blah"
RUN
pip3
install
git+https://github.com/catkin/catkin_tools.git
RUN
pip
install
opencv-python
RUN
pip
install
pyproj
# set up udev and usb stuff
WORKDIR
/opt
...
...
@@ -42,6 +45,12 @@ RUN mkdir -p $ROS_WS/src
WORKDIR
$ROS_WS
RUN
git
-C
src clone http://git.caslab.ece.vt.edu/hlarkin3/drone-ros-packages.git
-b
replicants
WORKDIR
$ROS_WS/src/drone-ros-packages
RUN
git submodule init
&&
git submodule update
WORKDIR
$ROS_WS
ENV
ROS_IP service-drone
# install ros package dependencies
RUN
apt-get update
&&
\
rosdep update
&&
\
...
...
@@ -59,21 +68,40 @@ COPY bashCheckRoscore.sh /usr/local/bin/bashCheckRoscore.sh
COPY
ros_entrypoint.sh /usr/local/bin/ros_entrypoint.sh
RUN
useradd
-m
-s
/bin/bash
-p
$(
openssl passwd
-1
password
)
ssher
RUN
usermod
-aG
sudo
ssher
RUN
chmod
755 /usr/local/bin/bashCheckRoscore.sh
&&
chmod
755 /usr/local/bin/ros_entrypoint.sh
# make ssh-ing easier
RUN
echo
"source /opt/ros/noetic/setup.bash"
>>
/home/ssher/.bashrc
RUN
echo
"source /opt/ros_ws/devel/setup.bash"
>>
/home/ssher/.bashrc
# also need to put env variables in here
RUN
echo
"ssh-keyscan -H service-master >> /home/ssher/.ssh/known_hosts"
>>
/home/ssher/.bashrc
RUN
echo
"ssh-keyscan -H service-drone >> /home/ssher/.ssh/known_hosts"
>>
/home/ssher/.bashrc
# these will be run with env loader but also nice to have from an ssh
RUN
echo
"export ROS_MASTER_URI=http://service-master:11311"
>>
/home/ssher/.bashrc
RUN
echo
"export ROS_HOSTNAME=service-drone"
>>
/home/ssher/.bashrc
# put rsa key in image
# put environment file in ros folder, to be referenced by base station machines.launch file
RUN
touch
/opt/ros/noetic/kube_setup.sh
\
&&
echo
"#!/bin/bash"
>
/opt/ros/noetic/kube_setup.sh
\
&&
echo
"export ROS_WS=/opt/ros_ws"
>>
/opt/ros/noetic/kube_setup.sh
\
&&
echo
"source /opt/ros_ws/devel/setup.bash"
>>
/opt/ros/noetic/kube_setup.sh
\
&&
echo
"export PATH=/opt/ros/noetic/share/ros/bin:/opt/ros/noetic/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
>>
/opt/ros/noetic/kube_setup.sh
\
&&
echo
"export ROS_PACKAGE_PATH=/opt/ros_ws/src/drone-ros-packages/audio_common/audio_common:/opt/ros_ws/src/drone-ros-packages/audio_common/audio_common_msgs:/opt/ros_ws/src/drone-ros-packages/audio_common/audio_capture:/opt/ros_ws/src/drone-ros-packages/audio_common/audio_play:/opt/ros_ws/src/drone-ros-packages/Onboard-SDK-ROS:/opt/ros_ws/src/drone-ros-packages/position_sync:/opt/ros_ws/src/drone-ros-packages/puredata:/opt/ros_ws/src/drone-ros-packages/audio_common/sound_play:/opt/ros/noetic/share:/opt/ros_ws"
>>
/opt/ros/noetic/kube_setup.sh
\
&&
echo
"export ROS_MASTER_URI=http://service-master:11311"
>>
/opt/ros/noetic/kube_setup.sh
\
&&
echo
"export ROS_HOSTNAME=service-drone"
>>
/opt/ros/noetic/kube_setup.sh
\
&&
echo
'exec "$@"'
>>
/opt/ros/noetic/kube_setup.sh
# also need to own and execute said setup file
RUN
chown
ssher /opt/ros/noetic/kube_setup.sh
\
&&
chmod
+x /opt/ros/noetic/kube_setup.sh
# set up ssh stuff
RUN
mkdir
-p
/home/ssher/.ssh
# COPY selfkey.pub /home/ssher/.ssh/authorized_keys
RUN
chown
-R
ssher:ssher /home/ssher/.ssh
# RUN chmod 600 /home/ssher/.ssh/authorized_keys
RUN
s
udo
s
ervice ssh start
RUN
service ssh start
EXPOSE
22
ENTRYPOINT
["/usr/local/bin/ros_entrypoint.sh"]
...
...
docker/drone/bashCheckRoscore.sh
View file @
040f522b
#!/bin/bash
# set -e
# make sure to source ros work space so we can use the rostopic command
# source stuff
source
/home/ssher/.bashrc
FILE
=
"./resp.txt"
OUT
=
"confirm"
until
[[
$OUT
!=
"confirm"
]]
...
...
docker/drone/ros_entrypoint.sh
View file @
040f522b
...
...
@@ -7,5 +7,12 @@ source "/opt/ros/$ROS_DISTRO/setup.bash"
# might need to source the devel space as well
source
"
$ROS_WS
/devel/setup.bash"
# put some stuff in the hosts file
# echo "service-drone.default.svc.cluster.local drone-0" >> /etc/hosts
# echo "service-master.default.svc.cluster.local base-0" >> /etc/hosts
# add service-base to known hosts
# ssh-keyscan -H service-drone
echo
"==> Container ready"
exec
"
$@
"
kubernetes/base-deployment.yaml
View file @
040f522b
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
base
-deployment
name
:
base
labels
:
app
:
llh
cluster
app
:
cluster
node
:
base
spec
:
# serviceName: service-master # must match metadata-name on headless service below
# statefulset.kubernetes.io/pod-name: service-master
replicas
:
1
# The deployment handles all matching templated pods
selector
:
matchLabels
:
node
:
base
# Template for a replica.
# The deployment makes sure that a POD containing the containers
# defined below is always running.
app
:
cluster
template
:
metadata
:
labels
:
app
:
cluster
# gotta match spec-template-metadata-labels
node
:
base
spec
:
hostname
:
service-master
containers
:
-
name
:
base
image
:
llh/basestation:v0
args
:
-
roscore
command
:
[
"
/bin/bash"
]
args
:
[
"
-c"
,
"
source
/opt/ros_ws/devel/setup.bash
&&
/usr/local/bin/ros_entrypoint.sh
&&
roscore"
]
ports
:
-
containerPort
:
11311
name
:
baseport
# env:
# - name: ROS_IP
# value: service-master
nodeSelector
:
name
:
base
...
...
@@ -37,11 +42,18 @@ kind: Service
metadata
:
name
:
service-master
labels
:
app
:
llh
cluster
app
:
cluster
node
:
base
spec
:
# type: LoadBalancer
# externalTrafficPolicy: Local
selector
:
# statefulset.kubernetes.io/pod-name: service-master
node
:
base
clusterIP
:
None
ports
:
-
port
:
11311
name
:
base
selector
:
node
:
base
app
:
cluster
kubernetes/drone-deployment.yaml
View file @
040f522b
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
drone
-deployment
name
:
drone
labels
:
app
:
llh
cluster
app
:
cluster
node
:
drone
spec
:
# serviceName: "service-drone"
# statefulset.kubernetes.io/pod-name: service-drone
replicas
:
1
# The deployment handles all matching templated pods
selector
:
matchLabels
:
node
:
drone
# Template for a replica.
# The deployment makes sure that a POD containing the containers
# defined below is always running.
app
:
cluster
template
:
metadata
:
labels
:
app
:
cluster
node
:
drone
spec
:
hostname
:
service-drone
containers
:
-
name
:
drone
securityContext
:
...
...
@@ -28,20 +30,26 @@ spec:
name
:
ttyacm
-
mountPath
:
/dev/dji_usb
name
:
ttydji
-
mountPath
:
/dev/video0
name
:
devvideo0
-
mountPath
:
/dev/video1
name
:
devvideo1
image
:
llh/drone:v0
command
:
[
"
/bin/bash"
]
args
:
[
"
-c"
,
"
source
/opt/ros_ws/devel/setup.bash
&&
/usr/local/bin/ros_entrypoint.sh
&&
sudo
service
ssh
restart
&&
/usr/local/bin/bashCheckRoscore.sh
&&
rostopic
pub
-r
1
armReady
std_msgs/String
'ready'"
]
# args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/bashCheckRoscore.sh"]
command
:
[
"
/bin/bash"
]
# You need to run some task inside a
args
:
[
"
-c"
,
"
source
/opt/ros_ws/devel/setup.bash
&&
sudo
service
ssh
restart
&&
/usr/local/bin/ros_entrypoint.sh
&&
while
true;
do
sleep
10;
done;"
]
# Our simple program just sleeps inside
# args: ["-c", "source /opt/ros_ws/devel/setup.bash && /usr/local/bin/ros_entrypoint.sh"]
# command: ["/bin/bash"]
# not running && /usr/local/bin/bashCheckRoscore.sh AND && sudo service ssh restart
ports
:
-
containerPort
:
11311
name
:
droneport
env
:
-
name
:
ROS_MASTER_URI
value
:
http://service-master:11311
value
:
service-master
-
name
:
ROS_HOSTNAME
value
:
service-drone
nodeSelector
:
name
:
base
name
:
base
# temp for testing purposes
volumes
:
-
name
:
ttyacm
hostPath
:
...
...
@@ -49,6 +57,12 @@ spec:
-
name
:
ttydji
hostPath
:
path
:
/dev/dji_usb
-
name
:
devvideo0
hostPath
:
path
:
/dev/video0
-
name
:
devvideo1
hostPath
:
path
:
/dev/video1
---
...
...
@@ -57,14 +71,16 @@ kind: Service
metadata
:
name
:
service-drone
labels
:
app
:
llh
cluster
app
:
cluster
node
:
drone
spec
:
# Start a headless service
# https://kubernetes.io/docs/concepts/services-networking/service/#headless-services
# type: LoadBalancer
# externalTrafficPolicy: Local
selector
:
app
:
cluster
# statefulset.kubernetes.io/pod-name: service-drone
node
:
drone
clusterIP
:
None
ports
:
# Dummy port
-
port
:
11311
selector
:
node
:
drone
name
:
drone
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment