Skip to content

Commit 25d2f9a

Browse files
committed
add Create a Beamline Repository
1 parent e1601f9 commit 25d2f9a

13 files changed

+198
-30
lines changed

README.rst

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,35 @@ Organization https://github.com/epics-containers
2929
Overview
3030
========
3131

32-
.. include:: overview.rst
32+
Kubernetes for EPICS IOCs applies modern industry standards to the
33+
management of IOCs.
3334

34-
This diagram shows how the assets combine to create a running IOC on a
35+
- Containers package generic IOC code and dependencies.
36+
- Kubernetes orchestrates the **Containers**.
37+
- Helm deploys IOCs to **Kubernetes**.
38+
- Repositories hold **container** images and **helm** charts
39+
- CI / CD generates the images, charts from source and delivers them
40+
to **Repositories**
41+
42+
Below we show how these assets combine to create a running IOC on a
3543
Kubernetes worker node.
3644

3745
.. image:: images/example.png
3846
:width: 1500px
3947
:align: center
4048

41-
- The Helm Chart defines an IOC instance: IMAGE + STARTUP SCRIPT + K8S DEPLOYMENT​
42-
- The entire definition of the P45 beamline is held in https://github.com/orgs/epics-containers/packages
49+
- The Helm Chart defines an IOC instance as:
50+
51+
- An image reference for generic IOC binaries
52+
- A startup Script for the unique IOC instance
53+
- K8S resource YAML to describe resources to the Kubernetes cluster
54+
55+
- The entire definition of the the example P45 beamline is held in this
56+
github organization:
57+
58+
- Helm Charts: https://github.com/orgs/epics-containers/packages
59+
- IOC Images: https://github.com/orgs/epics-containers/packages
60+
- BL45P IOC sources: https://github.com/epics-containers/bl45p
4361

4462
..
4563
Anything below this line is used when viewing README.rst and will be replaced

docs/explanations/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Essential Concepts
44
Overview
55
--------
66

7-
.. include:: overview.rst
7+
.. include:: ../overview.rst
88

99
See below for more detail on each of these.
1010

docs/explanations/overview.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ About the documentation
4545
:maxdepth: 1
4646

4747
tutorials/setup_k8s
48+
tutorials/useful_k8s
4849
tutorials/create_beamline
4950
tutorials/add_ioc
5051
tutorials/manage_iocs

docs/overview.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/overview.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Kubernetes for EPICS IOCs applies modern industry standards to the management
2+
of IOCs.
3+
4+
There are 5 themes to this strategy:
5+
6+
:Containers​:
7+
Package IOC software and execute it in a lightweight virtual environment​.
8+
9+
:Kubernetes​:
10+
Centrally orchestrate all IOCs at a facility.
11+
12+
:Helm Charts​:
13+
Deploy IOCs into Kubernetes with version management​.
14+
15+
:Repositories​:
16+
Source, container and helm repositories manage all of the above assets.
17+
No shared file systems required.​
18+
19+
:Continuous Integration / Delivery:
20+
Source repositories automatically build containers, helm charts and
21+
deliver them to repositories.

docs/tutorials/create_beamline.rst

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,89 @@
11
Create a beamline repository
22
============================
3-
Todo - will have a template repo for this
3+
4+
In this tutorial we will create a new beamline source repository on github.
5+
6+
This is where the definitions of IOCs for a beamline will be held. Continuous
7+
integration will generate helm charts for each IOC and push them to
8+
your account's package repository.
9+
10+
The beamline will come with an example IOC and further steps in the
11+
tutorial will teach you how to add your own.
12+
13+
14+
To Start
15+
--------
16+
17+
For this exercise you will require a github user account or organization in
18+
which to place the new repo. If you do not have one then follow GitHub's
19+
`instructions`_.
20+
21+
Log in to your account by going here https://github.com/login.
22+
23+
.. _instructions: https://docs.github.com/en/get-started/signing-up-for-github/signing-up-for-a-new-github-account
24+
25+
Create a repository
26+
-------------------
27+
28+
Navigate to the beamline template repo here https://github.com/epics-containers/blxx-template
29+
30+
Click on 'Use This Template'. Choose a name and description for your repo.
31+
Click 'Create Repository From Template'.
32+
33+
.. image:: ../images/create_repo.png
34+
:align: center
35+
36+
This will create your new repository and take you to its Code panel.
37+
38+
Now Click on 'Code' and copy the SSH or HTTPS link presented. This depends on
39+
how you will authenticate to github. HTTPS will ask you for your user name
40+
and password for all transactions. To setup SSH authentication see `about ssh`_
41+
42+
.. _about ssh: https://docs.github.com/en/[email protected]/github/authenticating-to-github/connecting-to-github-with-ssh/about-ssh
43+
44+
45+
Clone and Tag the Repository
46+
----------------------------
47+
48+
For the remainder of the tutorial the examples will use the ssh URL for
49+
the account gilesknap and the repository name bl00i. Please substitute in
50+
your own details.
51+
52+
In a terminal use git to clone the repository by pasting in the URL you copied
53+
in the previous step::
54+
55+
56+
[giles@gklinux2 tmp]$ git clone [email protected]:gilesknap/bl00i.git
57+
Cloning into 'bl00i'...
58+
remote: Enumerating objects: 22, done.
59+
remote: Counting objects: 100% (22/22), done.
60+
remote: Compressing objects: 100% (18/18), done.
61+
remote: Total 22 (delta 0), reused 21 (delta 0), pack-reused 0
62+
Receiving objects: 100% (22/22), 15.28 KiB | 15.28 MiB/s, done.
63+
[giles@gklinux2 tmp]$
64+
65+
Now test that CI is working by tagging the repo and pushing it back to github::
66+
67+
68+
[giles@gklinux2 tmp]$ cd bl00i
69+
(main) [giles@gklinux2 bl00i]$ git tag 0.1
70+
(main) [giles@gklinux2 bl00i]$ git push origin 0.1
71+
Total 0 (delta 0), reused 0 (delta 0)
72+
To github.com:gilesknap/bl00i.git
73+
* [new tag] 0.1 -> 0.1
74+
75+
This will cause github CI to generate a helm chart for the example IOC and
76+
deliver it to the account packages repository.
77+
78+
To watch the progress go to the Actions Panel for your project.
79+
80+
.. image:: ../images/github_actions.png
81+
:align: center
82+
83+
Once the CI completes you should have a helm chart delivered in your packages.
84+
Go to the code pane and click on the example Package circled below to see it.
85+
86+
87+
.. image:: ../images/github_package.png
88+
:align: center
89+

docs/tutorials/setup_k8s.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ Execute this on the workstation::
6565
Completed
6666
~~~~~~~~~
6767
That's it. You now have installed the necessary software to start experimenting
68-
with IOCs on Kubernetes.
68+
with IOCs on Kubernetes.
69+

docs/tutorials/useful_k8s.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
Useful Kubernetes Additions
3+
===========================
4+
5+
Install the Kubernetes Dashboard
6+
--------------------------------
7+
8+
The dashboard gives you a nice GUI for exploring and controlling your cluster.
9+
It is very useful for new users to get an understanding of what Kubernetes
10+
has to offer.
11+
12+
Execute this on your workstation:
13+
14+
.. code-block:: bash
15+
16+
GITHUB_URL=https://github.com/kubernetes/dashboard/releases
17+
VERSION_KUBE_DASHBOARD=$(curl -w '%{url_effective}' -I -L -s -S ${GITHUB_URL}/latest -o /dev/null | sed -e 's|.*/||')
18+
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/${VERSION_KUBE_DASHBOARD}/aio/deploy/recommended.yaml
19+
20+
Then create the admin user and role by creating dashboard-admin.yaml containing:
21+
22+
.. code-block:: yaml
23+
24+
apiVersion: v1
25+
kind: ServiceAccount
26+
metadata:
27+
name: admin-user
28+
namespace: kubernetes-dashboard
29+
---
30+
apiVersion: rbac.authorization.k8s.io/v1
31+
kind: ClusterRoleBinding
32+
metadata:
33+
name: admin-user
34+
roleRef:
35+
apiGroup: rbac.authorization.k8s.io
36+
kind: ClusterRole
37+
name: cluster-admin
38+
subjects:
39+
- kind: ServiceAccount
40+
name: admin-user
41+
namespace: kubernetes-dashboard
42+
43+
get a token for the user::
44+
45+
kubectl create -f dashboard-admin.yaml
46+
kubectl -n kubernetes-dashboard describe secret admin-user-token | grep '^token'
47+
48+
Finally, start a proxy and goto the Dashboard URL, use the above token to log in::
49+
50+
kubectl proxy &
51+
browse to http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy
52+
53+
54+
Add a Raspberry Pi to the cluster
55+
---------------------------------
56+
57+
For a Raspberry Pi you need a couple of extra settings to get K3S running.
58+
59+
You need the following changes before installing::
60+
61+
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
62+
# edit /boot/cmdline and make sure the single line contains:
63+
# cgroup_memory=1 cgroup_enable=memory
64+
sudo reboot

images/clone_repo.png

103 KB
Loading

0 commit comments

Comments
 (0)