Olaf Bohlen
2021-05-20 bfc6c8505ead9a337e3ccfbd09fb7baaa6f4fb44
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
12 * Deployment on OpenShift with images
13
14 #+BEGIN_SRC ditaa :file ocp-dep-image1.png :cmdline -r
15 oc new-app sample.registry.org/user/image:tag
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    +--->  | DeploymentConfig | -------------------------------->  | ReplicationController |                
26    |      | (DC)             |  (4)         +-----------+         | (RC)                  |
27    |      |                  | --------->   | DeployPod |         +-----------------------+
28    |      +------------------+  creates     +-----------+                 |
29    |                                              | (6) creates           |scales &
30    |                                              v                       |monitors
31    | (3)  +---------+   load balances   +----------------+                |
32    +--->  | Service |  -------------->  | ApplicationPod |  <-------------+
33           | (SVC)   |                   |                |
34           +---------+                   +----------------+
35 #+END_SRC
36
37 #+results:
38 [[file:ocp-dep-image1.png]]
39
40 * Deployment on OpenShift with Source-to-Image (S2I)
41
42 #+BEGIN_SRC ditaa :file ocp-dep-s2i1.png :cmdline -rE
43 oc new-app http://git.repo-server.org/sampleapp
44        |
45        |                             
46        | (1)  +-------------+   points to    +----------------------------+    +------------------------------------+
47        +--->  | ImageStream |  ----------->  | internal Registry cBLU {s} |    | external Registry cRED {s}         |
48        |      | (IS)        |<+              | sampleapp:latest           |    | sample.registry.org/ose/s2ibuilder |
49        |      +-------------+ |              +----------------------------+    +------------------------------------+
50        |                      |                  ^                                      ^
51        |                      |                  | (9) docker commits                   | points to
52        |                      |                  |                                      |
53        | (2)  +-------------+ |(5) creates   +--------------+  (6) docker run      +-----------------+
54        +--->  | BuildConfig | |----------->  | BuilderPod   | ------------------>  | S2I ImageStream |
55        |      | (BC)        | |              | (8) assemble |                      | (IS)            |
56        |      +-------------+ |              +--------------+                      +-----------------+
57        |             |        |                  | (7) git clone                        ^
58        |             +--=-----|----=-------------|---=----------------------------------+
59        |       ImageChange    |                  |                                                                   
60        |       Trigger watches|                  v                                                                    
61        |       S2I IS         |              +--------------------------------------+                                
62        |                      |              | git Repository {s}                   |                                
63 build  |                      |              | http://git.repo-server.org/sampleapp |                                
64 step   |                      :              +--------------------------------------+                                
65 -=-----|-=--------------------|--=-------------------------------------------------------------------------------------
66 deploy |                      |ImageChange
67 step   |                      |Trigger
68        |                      |watches IS 
69        | (3)  +------------------+  (11) creates                      +-----------------------+
70        +--->  | DeploymentConfig | -------------------------------->  | ReplicationController |                
71        |      | (DC)             |  (10)        +-----------+         | (RC)                  |
72        |      |                  | --------->   | DeployPod |         +-----------------------+
73        |      +------------------+  creates     +-----------+                 |
74        |                                              | (12) creates          |scales &
75        |                                              v                       |monitors
76        | (4)  +---------+   load balances   +----------------+                |
77        +--->  | Service |  -------------->  | ApplicationPod |  <-------------+
78               | (SVC)   |                   |                |
79               +---------+                   +----------------+
80 #+END_SRC
81
82 #+results:
83 [[file:ocp-dep-s2i1.png]]
84
85 * Input Detection OpenShift 
86 #+begin_src plantuml :file openshift-input-detection.png
87 !pragma useVerticalIf on
88 :oc new-app <input spec>;
89 if (docker pull) then (yes)
90   -> yes
91   --docker-image= forces this;
92   :docker run;
93   note: --docker-image= forces this
94   stop
95 else (no)
96   :try for an SCM code repo;
97   note: --code forces this
98 if (git clone) then (no)
99   :abort with error;
100   stop
101 elseif (Dockerfile found?) then (yes)
102   :docker build;
103   note: --strategy=docker forces this
104   :docker run;
105   stop
106 else (no)
107   :continue with S2I;
108   note right: --strategy=source forces this
109 if (pom.xml found?) then (yes)
110   :search for JEE S2I builder;
111   note: use -i to suggest an S2I image stream (tag);
112   :continue with S2I process;
113   stop
114 elseif (index.php found?) then (yes)
115   :search for PHP S2I builder;
116   note 
117     prefix the git url with builderis~ (tilda!) 
118     to turn off language detection and force this builder
119   end note
120   :continue with S2I process;
121   stop
122 else
123   :abort with error;
124   stop
125 endif
126 #+end_src
127
128 #+results:
129 [[file:openshift-input-detection.png]]