Olaf Bohlen
2023-02-27 586b0804a6b881fed73ee1d7be571728cfef5de0
commit | author | age
a812b5 1 #+TODO: TODO(t) NEXT(n) WAITING(w) SOMEDAY(s) DELEGATED(g) PROJ(p) PLANNED(l) | DONE(d) FORWARDED(f) CANCELLED(c)
OB 2 #+PRIORITIES: A D D
3 #+OPTIONS: H:1 author:nil toc:nil date:nil t:nil <:t e:t p:t num:nil
4 #+TITLE: OpenShift Diagrams by Olaf Bohlen
5 #+LaTeX_CLASS: article
6 #+LaTeX_HEADER: \usepackage[ttscale=.875]{libertine}
7 #+LaTeX_HEADER: \usepackage{sectsty}
8 #+LaTeX_HEADER: \sectionfont{\normalfont\scshape}
9 #+LaTeX_HEADER: \subsectionfont{\normalfont\itshape}
10 #+LATEX_HEADER: \renewcommand\maketitle{}
11
586b08 12 * Deployment on OpenShift with images using Kubernetes Deployments
a812b5 13
OB 14 #+BEGIN_SRC ditaa :file ocp-dep-image1.png :cmdline -r
586b08 15 oc new-app sample.registry.org/user/image:tag
OB 16    |
17    |                             
18    | (1)  +-------------+   points to    +------------------------------------+
19    +--->  | ImageStream |  ----------->  | external Registry cRED {s}         |
20    |      | (IS)        |                | sample.registry.org/user/image:tag |
21    |      +-------------+                +------------------------------------+
22    |             ^
23    |             | points to
24    | (2)  +------------------+  (5) creates                       +-----------------------+
25    +--->  | Deployment       | -------------------------------->  | ReplicaSet            |                
26    |      |                  |  (4)                               |                       |
27    |      |                  | -------------------+               +-----------------------+
28    |      +------------------+  creates           |                       |
29    |                                              |                       |scales &
30    |                                              v                       |monitors
31    | (3)  +---------+   load balances   +----------------+                |
32    +--->  | Service |  -------------->  | ApplicationPod |  <-------------+
33           | (SVC)   |                   |                |
34           +---------+                   +----------------+
35 #+END_SRC
36
37 * Deployment on OpenShift with images using OpenShift DeploymentConfigs (dc)
38
39 #+BEGIN_SRC ditaa :file ocp-dep-image2.png :cmdline -r
a812b5 40 oc new-app sample.registry.org/user/image:tag
OB 41    |
42    |                             
43    | (1)  +-------------+   points to    +------------------------------------+
44    +--->  | ImageStream |  ----------->  | external Registry cRED {s}         |
45    |      | (IS)        |                | sample.registry.org/user/image:tag |
46    |      +-------------+                +------------------------------------+
47    |             ^
48    |             | points to
49    | (2)  +------------------+  (5) creates                       +-----------------------+
50    +--->  | DeploymentConfig | -------------------------------->  | ReplicationController |                
51    |      | (DC)             |  (4)         +-----------+         | (RC)                  |
52    |      |                  | --------->   | DeployPod |         +-----------------------+
53    |      +------------------+  creates     +-----------+                 |
54    |                                              | (6) creates           |scales &
55    |                                              v                       |monitors
56    | (3)  +---------+   load balances   +----------------+                |
57    +--->  | Service |  -------------->  | ApplicationPod |  <-------------+
58           | (SVC)   |                   |                |
59           +---------+                   +----------------+
60 #+END_SRC
61
62 #+results:
63 [[file:ocp-dep-image1.png]]
64
586b08 65 * Deployment on OpenShift with Source-to-Image (S2I) using Kubernetes Deployments
a812b5 66
OB 67 #+BEGIN_SRC ditaa :file ocp-dep-s2i1.png :cmdline -rE
68 oc new-app http://git.repo-server.org/sampleapp
69        |
70        |                             
71        | (1)  +-------------+   points to    +----------------------------+    +------------------------------------+
72        +--->  | ImageStream |  ----------->  | internal Registry cBLU {s} |    | external Registry cRED {s}         |
73        |      | (IS)        |<+              | sampleapp:latest           |    | sample.registry.org/ose/s2ibuilder |
74        |      +-------------+ |              +----------------------------+    +------------------------------------+
75        |                      |                  ^                                      ^
76        |                      |                  | (9) docker commits                   | points to
77        |                      |                  |                                      |
78        | (2)  +-------------+ |(5) creates   +--------------+  (6) docker run      +-----------------+
79        +--->  | BuildConfig | |----------->  | BuilderPod   | ------------------>  | S2I ImageStream |
80        |      | (BC)        | |              | (8) assemble |                      | (IS)            |
81        |      +-------------+ |              +--------------+                      +-----------------+
82        |             |        |                  | (7) git clone                        ^
83        |             +--=-----|----=-------------|---=----------------------------------+
84        |       ImageChange    |                  |                                                                   
85        |       Trigger watches|                  v                                                                    
86        |       S2I IS         |              +--------------------------------------+                                
87        |                      |              | git Repository {s}                   |                                
88 build  |                      |              | http://git.repo-server.org/sampleapp |                                
89 step   |                      :              +--------------------------------------+                                
90 -=-----|-=--------------------|--=-------------------------------------------------------------------------------------
91 deploy |                      |ImageChange
92 step   |                      |Trigger
93        |                      |watches IS 
94        | (3)  +------------------+  (11) creates                      +-----------------------+
586b08 95        +--->  | Deployment       | -------------------------------->  | ReplicaSet            |                
OB 96        |      |                  |  (10)                              |                       |
97        |      |                  | -------------------+               +-----------------------+
98        |      +------------------+  creates           |                       |
99        |                                              |                       |scales &
100        |                                              v                       |monitors
101        | (4)  +---------+   load balances   +----------------+                |
102        +--->  | Service |  -------------->  | ApplicationPod |  <-------------+
103               | (SVC)   |                   |                |
104               +---------+                   +----------------+
105 #+END_SRC
106
107
108 * Deployment on OpenShift with Source-to-Image (S2I) using DeploymentConfigs (dc)
109
110 #+BEGIN_SRC ditaa :file ocp-dep-s2i2.png :cmdline -rE
111 oc new-app http://git.repo-server.org/sampleapp
112        |
113        |                             
114        | (1)  +-------------+   points to    +----------------------------+    +------------------------------------+
115        +--->  | ImageStream |  ----------->  | internal Registry cBLU {s} |    | external Registry cRED {s}         |
116        |      | (IS)        |<+              | sampleapp:latest           |    | sample.registry.org/ose/s2ibuilder |
117        |      +-------------+ |              +----------------------------+    +------------------------------------+
118        |                      |                  ^                                      ^
119        |                      |                  | (9) docker commits                   | points to
120        |                      |                  |                                      |
121        | (2)  +-------------+ |(5) creates   +--------------+  (6) docker run      +-----------------+
122        +--->  | BuildConfig | |----------->  | BuilderPod   | ------------------>  | S2I ImageStream |
123        |      | (BC)        | |              | (8) assemble |                      | (IS)            |
124        |      +-------------+ |              +--------------+                      +-----------------+
125        |             |        |                  | (7) git clone                        ^
126        |             +--=-----|----=-------------|---=----------------------------------+
127        |       ImageChange    |                  |                                                                   
128        |       Trigger watches|                  v                                                                    
129        |       S2I IS         |              +--------------------------------------+                                
130        |                      |              | git Repository {s}                   |                                
131 build  |                      |              | http://git.repo-server.org/sampleapp |                                
132 step   |                      :              +--------------------------------------+                                
133 -=-----|-=--------------------|--=-------------------------------------------------------------------------------------
134 deploy |                      |ImageChange
135 step   |                      |Trigger
136        |                      |watches IS 
137        | (3)  +------------------+  (11) creates                      +-----------------------+
a812b5 138        +--->  | DeploymentConfig | -------------------------------->  | ReplicationController |                
OB 139        |      | (DC)             |  (10)        +-----------+         | (RC)                  |
140        |      |                  | --------->   | DeployPod |         +-----------------------+
141        |      +------------------+  creates     +-----------+                 |
142        |                                              | (12) creates          |scales &
143        |                                              v                       |monitors
144        | (4)  +---------+   load balances   +----------------+                |
145        +--->  | Service |  -------------->  | ApplicationPod |  <-------------+
146               | (SVC)   |                   |                |
147               +---------+                   +----------------+
148 #+END_SRC
149
150 #+results:
151 [[file:ocp-dep-s2i1.png]]
152
153 * Input Detection OpenShift 
154 #+begin_src plantuml :file openshift-input-detection.png
155 !pragma useVerticalIf on
156 :oc new-app <input spec>;
157 if (docker pull) then (yes)
158   -> yes
159   --docker-image= forces this;
160   :docker run;
161   note: --docker-image= forces this
162   stop
163 else (no)
164   :try for an SCM code repo;
165   note: --code forces this
166 if (git clone) then (no)
167   :abort with error;
168   stop
169 elseif (Dockerfile found?) then (yes)
170   :docker build;
171   note: --strategy=docker forces this
172   :docker run;
173   stop
174 else (no)
175   :continue with S2I;
176   note right: --strategy=source forces this
177 if (pom.xml found?) then (yes)
178   :search for JEE S2I builder;
179   note: use -i to suggest an S2I image stream (tag);
180   :continue with S2I process;
181   stop
182 elseif (index.php found?) then (yes)
183   :search for PHP S2I builder;
184   note 
185     prefix the git url with builderis~ (tilda!) 
186     to turn off language detection and force this builder
187   end note
188   :continue with S2I process;
189   stop
190 else
191   :abort with error;
192   stop
193 endif
194 #+end_src
195
196 #+results:
197 [[file:openshift-input-detection.png]]