{"id":86902,"date":"2020-07-01T07:42:28","date_gmt":"2020-07-01T05:42:28","guid":{"rendered":"https:\/\/prohoster.info\/blog\/administrirovanie\/udalyaem-ustarevshuyu-feature-branch-v-kubernetes-klastere"},"modified":"2020-07-01T07:42:28","modified_gmt":"2020-07-01T05:42:28","slug":"udalyaem-ustarevshuyu-feature-branch-v-kubernetes-klastere","status":"publish","type":"post","link":"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/udalyaem-ustarevshuyu-feature-branch-v-kubernetes-klastere","title":{"rendered":"Elavult feature branch elt\u00e1vol\u00edt\u00e1sa a Kubernetes klaszterben","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"Elavult feature branch elt\u00e1vol\u00edt\u00e1sa a Kubernetes klaszterben\" src=\"\/wp-content\/uploads\/2020\/07\/d97c0cce385c587e16f26f6d19b9d108.png\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p>Hell\u00f3! <b>Jellemz\u0151 \u00e1g<\/b> (aka deploy preview, review app) \u2014 ez az, amikor nemcsak a master \u00e1gat, hanem minden pull requestet egyedi URL-en telep\u00edtenek. Ellen\u0151rizheti, m\u0171k\u00f6dik-e a k\u00f3d a production k\u00f6rnyezetben, \u00e9s megmutathatja a funkci\u00f3t m\u00e1s programoz\u00f3knak vagy term\u00e9kfejleszt\u0151knek. Am\u00edg a pull request-en dolgozik, minden \u00faj commit az aktu\u00e1lis telep\u00edt\u00e9st az r\u00e9gi k\u00f3dhoz t\u00f6rli, \u00e9s \u00faj telep\u00edt\u00e9st ind\u00edt az \u00faj k\u00f3dhoz. K\u00e9rd\u00e9sek mer\u00fclhetnek fel, amikor a pull requestet a master \u00e1gba olvasztja. A feature branch m\u00e1r nem sz\u00fcks\u00e9ges, de a Kubernetes er\u0151forr\u00e1sok m\u00e9g mindig a klaszterben tal\u00e1lhat\u00f3k.<\/p>\n<p><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>Tov\u00e1bbi inform\u00e1ci\u00f3 a feature branch-r\u0151l<\/h2>\n<p><\/p>\n<p>Az egyik m\u00f3dszer arra, hogyan k\u00e9sz\u00edts\u00fcnk feature branch-eket a Kubernetes-ben, ha namespace-ket haszn\u00e1lunk. R\u00f6viden, a production konfigur\u00e1ci\u00f3 \u00edgy n\u00e9z ki:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">kind: Namespace\napiVersion: v1\nmetadata:\n  name: habr-back-end\n...\n\nkind: Deployment\napiVersion: apps\/v1\nmetadata:\n  namespace: habr-back-end\nspec:\n  replicas: 3\n...<\/code><\/pre>\n<p><\/p>\n<p>A feature branch sz\u00e1m\u00e1ra namespace-t hozunk l\u00e9tre az azonos\u00edt\u00f3j\u00e1val (p\u00e9ld\u00e1ul a pull request sz\u00e1ma) \u00e9s valamilyen el\u0151taggal\/ut\u00f3taggal (p\u00e9ld\u00e1ul, <b>-pr-<\/b>):<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">kind: Namespace\napiVersion: v1\nmetadata:\n  name: habr-back-end-pr-17\n...\n\nkind: Deployment\napiVersion: apps\/v1\nmetadata:\n  namespace: habr-back-end-pr-17\nspec:\n  replicas: 1\n...<\/code><\/pre>\n<p><\/p>\n<p>\u00d6sszess\u00e9g\u00e9ben \u00edrtam <b>Kubernetes Operator<\/b> (alkalmaz\u00e1s, amely hozz\u00e1f\u00e9r a klaszter er\u0151forr\u00e1saihoz), <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/dmytrostriletskyi\/stale-feature-branch-operator\">link a projekthez a Github-on<\/a><\/noindex>. Ez t\u00f6rli azokat a namespace-ket, amelyek r\u00e9gi feature branch-ekhez kapcsol\u00f3dnak. A Kubernetes-ben, ha egy namespace-t t\u00f6r\u00f6lnek, az abban tal\u00e1lhat\u00f3 egy\u00e9b er\u0151forr\u00e1sok is automatikusan t\u00f6rl\u0151dnek.<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl get pods --all-namespaces | grep -e \"-pr-\"\nNAMESPACE            ... \u00c9LET\nhabr-back-end-pr-264 ... 4d8h\nhabr-back-end-pr-265 ... 5d7h<\/code><\/pre>\n<p><\/p>\n<p>Arr\u00f3l, hogyan lehet integr\u00e1lni a feature branch-eket a klaszterbe, itt olvashat. <noindex><a rel=\"nofollow\" href=\"https:\/\/itnext.io\/feature-deployments-in-kubernetes-c74bdcff0d8e\">itt<\/a><\/noindex> \u00e9s <noindex><a rel=\"nofollow\" href=\"https:\/\/codefresh.io\/kubernetes-tutorial\/dynamically-creating-k8s-namespaces-every-branch-pull-request-2\">itt<\/a><\/noindex>.<\/p>\n<p><\/p>\n<h2>Motiv\u00e1ci\u00f3<\/h2>\n<p><\/p>\n<p>N\u00e9zz\u00fck meg a pull request tipikus \u00e9letciklus\u00e1t folyamatos integr\u00e1ci\u00f3val (<code>continuous integration<\/code>):<\/p>\n<p><\/p>\n<ol>\n<li>\u00daj commitot toltunk az \u00e1gba.<\/li>\n<li>A build sor\u00e1n linters \u00e9s\/vagy tesztek futnak.<\/li>\n<li>Automatikusan gener\u00e1l\u00f3dnak a Kubernetes pull request konfigur\u00e1ci\u00f3k (p\u00e9ld\u00e1ul a megfelel\u0151 sablonba beillesztik a sz\u00e1m\u00e1t).<\/li>\n<li>A kubectl apply seg\u00edts\u00e9g\u00e9vel a konfigur\u00e1ci\u00f3k a klaszterbe ker\u00fclnek (telep\u00edtve).<\/li>\n<li>A pull request \u00f6sszevon\u00e1sa a master \u00e1ggal.<\/li>\n<\/ol>\n<p><\/p>\n<p>Am\u00edg a pull request-en dolgozik, minden \u00faj commit az aktu\u00e1lis telep\u00edt\u00e9st az r\u00e9gi k\u00f3dhoz t\u00f6rli, \u00e9s \u00faj telep\u00edt\u00e9st ind\u00edt az \u00faj k\u00f3dhoz. De amikor a pull request \u00f6sszeolvad a master \u00e1ggal, csak a master \u00e1g \u00e9p\u00fcl. Ennek eredm\u00e9nyek\u00e9nt a pull request-re m\u00e1r elfeledkez\u00fcnk, m\u00edg a Kubernetes er\u0151forr\u00e1sai m\u00e9g mindig a klaszterben tal\u00e1lhat\u00f3k.<\/p>\n<p><\/p>\n<h2>Hogyan haszn\u00e1ljuk<\/h2>\n<p><\/p>\n<p>Telep\u00edtsd a projektet az al\u00e1bbi parancs seg\u00edts\u00e9g\u00e9vel:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl apply -f https:\/\/raw.githubusercontent.com\/dmytrostriletskyi\/stale-feature-branch-operator\/master\/configs\/production.yml<\/code><\/pre>\n<p><\/p>\n<p>Hozz l\u00e9tre egy f\u00e1jlt a k\u00f6vetkez\u0151 tartalommal, \u00e9s telep\u00edtsd a k\u00f6vetkez\u0151k seg\u00edts\u00e9g\u00e9vel: <code>kubectl apply -f<\/code>:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">apiVersion: feature-branch.dmytrostriletskyi.com\/v1\nkind: StaleFeatureBranch\nmetadata:\n  name: stale-feature-branch\nspec:\n  namespaceSubstring: -pr-\n  afterDaysWithoutDeploy: 3<\/code><\/pre>\n<p><\/p>\n<p>A parameter <b>namespaceSubstring<\/b> sz\u00fcks\u00e9ges a namespace-ek sz\u0171r\u00e9s\u00e9re a pull request-ek \u00e9s m\u00e1s namespace-ek k\u00f6z\u00f6tt. P\u00e9ld\u00e1ul, ha a klaszterben a k\u00f6vetkez\u0151 namespace-ek tal\u00e1lhat\u00f3k: <code>habr-back-end<\/code>, <code>habr-front-end<\/code>, <code>habr-back-end-pr-17<\/code>, <code>habr-back-end-pr-33<\/code>, akkor a t\u00f6rl\u00e9sre jel\u00f6ltek <code>habr-back-end-pr-17<\/code>, <code>habr-back-end-pr-33<\/code>.<\/p>\n<p><\/p>\n<p>A parameter <b>afterDaysWithoutDeploy<\/b> sz\u00fcks\u00e9ges a r\u00e9gi namespace-ek t\u00f6rl\u00e9s\u00e9re. P\u00e9ld\u00e1ul, ha a namespace l\u00e9tre lett hozva <code>3 nappal 1 \u00f3r\u00e1val<\/code> ezel\u0151tt, \u00e9s a param\u00e9ter azt mondja <code>3 nap<\/code>, ez a namespace t\u00f6r\u00f6lve lesz. Ford\u00edtott esetben is m\u0171k\u00f6dik, ha a namespace l\u00e9trehozva <code>2 nappal 23 \u00f3r\u00e1val<\/code> ezel\u0151tt, \u00e9s a param\u00e9ter azt mondja <code>3 nap<\/code>, ez a namespace nem lesz t\u00f6r\u00f6lve.<\/p>\n<p><\/p>\n<p>Van m\u00e9g egy param\u00e9ter, amely arra szolg\u00e1l, hogy milyen gyakran szkennelj\u00fck a namespace-eket \u00e9s ellen\u0151rizz\u00fck az id\u0151t an\u00e9lk\u00fcl, hogy telep\u00edt\u00e9s t\u00f6rt\u00e9nt volna \u2014 <b>checkEveryMinutes<\/b>. Alap\u00e9rtelmez\u00e9s szerint ez <code>30 perc<\/code>.<\/p>\n<p><\/p>\n<h2>Hogyan m\u0171k\u00f6dik ez<\/h2>\n<p><\/p>\n<p>Gyakorlatban sz\u00fcks\u00e9ges:<\/p>\n<p><\/p>\n<ol>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/docs.docker.com\/get-docker\">Docker<\/a><\/noindex> izol\u00e1lt k\u00f6rnyezetben val\u00f3 m\u0171k\u00f6d\u00e9shez.<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/tasks\/tools\/install-minikube\">Minikube<\/a><\/noindex> lok\u00e1lisan emeli fel a Kubernetes klasztert.<\/li>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/tasks\/tools\/install-kubectl\">kubectl<\/a><\/noindex> \u2014 parancssori fel\u00fclet a klaszter kezel\u00e9s\u00e9re.<\/li>\n<\/ol>\n<p><\/p>\n<p>Lok\u00e1lisan emelj\u00fck fel a Kubernetes klasztert:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ minikube start --vm-driver=docker\nminikube v1.11.0 Darwin 10.15.5 rendszeren\nA docker drivert haszn\u00e1lja a megl\u00e9v\u0151 profil alapj\u00e1n.\nKezdj\u00fck a vez\u00e9rl\u0151 s\u00edk csom\u00f3pontot a minikube klaszterben.<\/code><\/pre>\n<p><\/p>\n<p>Megadjuk <code>kubectl<\/code> alap\u00e9rtelmez\u00e9s szerint a helyi klasztert haszn\u00e1lja:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl config use-context minikube\n\u00c1tv\u00e1ltva a \"minikube\" kontextusra.<\/code><\/pre>\n<p><\/p>\n<p>Let\u00f6ltj\u00fck a konfigur\u00e1ci\u00f3kat a production k\u00f6rnyezethez:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ curl https:\/\/raw.githubusercontent.com\/dmytrostriletskyi\/stale-feature-branch-operator\/master\/configs\/production.yml &gt; stale-feature-branch-production-configs.yml<\/code><\/pre>\n<p><\/p>\n<p>Mivel a production konfigur\u00e1ci\u00f3k be vannak \u00e1ll\u00edtva a r\u00e9gi namespace-ek ellen\u0151rz\u00e9s\u00e9re, \u00e9s az \u00fajonnan l\u00e9trehozott klaszter\u00fcnkben nincs, helyettes\u00edtj\u00fck a k\u00f6rnyezeti v\u00e1ltoz\u00f3t <code>IS_DEBUG<\/code> Gyorsan eml\u00e9kezz\u00fcnk vissza, hogyan m\u0171k\u00f6dik a modul\u00e1ris aritmetika. Az \u00f3ra m\u00e1r egy ismert koncepci\u00f3. Az \u00f3r\u00e1k haszn\u00e1lata <code>igaz<\/code>. Ezzel az \u00e9rt\u00e9kkel a param\u00e9ter <code>afterDaysWithoutDeploy<\/code> nem sz\u00e1m\u00edt, \u00e9s a namespace-eket nem ellen\u0151rzik az id\u0151kkel an\u00e9lk\u00fcl, hogy telep\u00edt\u00e9s t\u00f6rt\u00e9nt volna, csak a substring jelenl\u00e9t\u00e9re (<code>-pr-<\/code>).<\/p>\n<p><\/p>\n<p>Ha \u00d6n a <code>Linux<\/code>:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ sed -i 's|false|true|g' stale-feature-branch-production-configs.yml<\/code><\/pre>\n<p><\/p>\n<p>Ha \u00d6n a <code>macOS<\/code>:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ sed -i \"\" 's|false|true|g' stale-feature-branch-production-configs.yml<\/code><\/pre>\n<p><\/p>\n<p>Telep\u00edtj\u00fck a projektet:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl apply -f stale-feature-branch-production-configs.yml<\/code><\/pre>\n<p><\/p>\n<p>Ellen\u0151rizz\u00fck, hogy a klaszterben megjelent az er\u0151forr\u00e1s <code>StaleFeatureBranch<\/code>:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl api-resources | grep stalefeaturebranches\nNAME                 ... APIGROUP                             ... KIND\nstalefeaturebranches ... feature-branch.dmytrostriletskyi.com ... StaleFeatureBranch<\/code><\/pre>\n<p><\/p>\n<p>Ellen\u0151rizz\u00fck, hogy a klaszterben megjelent az oper\u00e1tor:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl get pods --namespace stale-feature-branch-operator\nNAME                                           ... STATUS  ... AGE\nstale-feature-branch-operator-6bfbfd4df8-m7sch ... Running ... 38s<\/code><\/pre>\n<p><\/p>\n<p>Ha belen\u00e9z\u00fcnk a napl\u00f3j\u00e1ba, k\u00e9szen \u00e1ll az er\u0151forr\u00e1sok feldolgoz\u00e1s\u00e1ra <code>StaleFeatureBranch<\/code>:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl logs stale-feature-branch-operator-6bfbfd4df8-m7sch -n stale-feature-branch-operator\n... \"msg\":\"Operator Version: 0.0.1\"}\n...\n... \"msg\":\"Starting EventSource\", ... , \"source\":\"kind source: \/, Kind=\"}\n... \"msg\":\"Starting Controller\", ...}\n... \"msg\":\"Starting workers\", ..., \"worker count\":1}<\/code><\/pre>\n<p><\/p>\n<p>Telep\u00edtj\u00fck a k\u00e9sz <code>fixtures<\/code> (k\u00e9sz konfigur\u00e1ci\u00f3k a klaszter er\u0151forr\u00e1sainak modellez\u00e9s\u00e9hez) az er\u0151forr\u00e1shoz <code>StaleFeatureBranch<\/code>:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl apply -f https:\/\/raw.githubusercontent.com\/dmytrostriletskyi\/stale-feature-branch-operator\/master\/fixtures\/stale-feature-branch.yml<\/code><\/pre>\n<p><\/p>\n<p>A konfigur\u00e1ci\u00f3kban meg van adva, hogy keressen a namespace-eken egy adott r\u00e9szsz\u00f3t. <code>-pr-<\/code> minden <code>1 percben<\/code>.:<\/p>\n<p><\/p>\n<pre><code class=\"plaintext\">apiVersion: feature-branch.dmytrostriletskyi.com\/v1\nkind: StaleFeatureBranch\nmetadata:\n  name: stale-feature-branch\nspec:\n  namespaceSubstring: -pr-\n  afterDaysWithoutDeploy: 1 \n  checkEveryMinutes: 1<\/code><\/pre>\n<p><\/p>\n<p>Az oper\u00e1tor reag\u00e1lt \u00e9s k\u00e9szen \u00e1ll a namespace-ek ellen\u0151rz\u00e9s\u00e9re:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl logs stale-feature-branch-operator-6bfbfd4df8-m7sch -n stale-feature-branch-operator\n... \"msg\":\"A r\u00e9gi funkci\u00f3s \u00e1g feldolgoz\u00e1s alatt \u00e1ll.\",\"namespaceSubstring\":\"-pr-\",\"afterDaysWithoutDeploy\":1,\"checkEveryMinutes\":1,\"isDebug\":\"true\"}<\/code><\/pre>\n<p><\/p>\n<p>Telep\u00edt\u00fcnk <code>fixtures<\/code>, tartalmazva k\u00e9t namespace-et (<code>project-pr-1<\/code>, <code>project-pr-2<\/code>) \u00e9s azok <code>telep\u00edt\u00e9sek<\/code>, <code>szolg\u00e1ltat\u00e1sai<\/code>, <code>ingress<\/code>, stb.:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl apply -f https:\/\/raw.githubusercontent.com\/dmytrostriletskyi\/stale-feature-branch-operator\/master\/fixtures\/first-feature-branch.yml -f https:\/\/raw.githubusercontent.com\/dmytrostriletskyi\/stale-feature-branch-operator\/master\/fixtures\/second-feature-branch.yml\n...\nnamespace\/project-pr-1 created\ndeployment.apps\/project-pr-1 created\nservice\/project-pr-1 created\nhorizontalpodautoscaler.autoscaling\/project-pr-1 created\nsecret\/project-pr-1 created\nconfigmap\/project-pr-1 created\ningress.extensions\/project-pr-1 created\nnamespace\/project-pr-2 created\ndeployment.apps\/project-pr-2 created\nservice\/project-pr-2 created\nhorizontalpodautoscaler.autoscaling\/project-pr-2 created\nsecret\/project-pr-2 created\nconfigmap\/project-pr-2 created\ningress.extensions\/project-pr-2 created<\/code><\/pre>\n<p><\/p>\n<p>Ellen\u0151rizz\u00fck, hogy az \u00f6sszes fent eml\u00edtett er\u0151forr\u00e1s sikeresen l\u00e9trej\u00f6tt:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl get namespace,pods,deployment,service,horizontalpodautoscaler,configmap,ingress -n project-pr-1 &amp;&amp; kubectl get namespace,pods,deployment,service,horizontalpodautoscaler,configmap,ingress -n project-pr-2\n...\nNAME                              ... READY ... STATUS  ... AGE\npod\/project-pr-1-848d5fdff6-rpmzw ... 1\/1   ... Running ... 67s\n\nNAME                         ... READY ... AVAILABLE ... AGE\ndeployment.apps\/project-pr-1 ... 1\/1   ... 1         ... 67s\n...<\/code><\/pre>\n<p><\/p>\n<p>Mivel aktiv\u00e1ltuk <code>debug<\/code>, namespace-ek <code>project-pr-1<\/code> \u00e9s <code>project-pr-2<\/code>, ez\u00e9rt az \u00f6sszes t\u00f6bbi er\u0151forr\u00e1snak is azonnal el kell t\u0171nnie, figyelmen k\u00edv\u00fcl hagyva a param\u00e9tert <code>afterDaysWithoutDeploy<\/code>. Ez az oper\u00e1tor napl\u00f3iban l\u00e1that\u00f3:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl logs stale-feature-branch-operator-6bfbfd4df8-m7sch -n stale-feature-branch-operator\n... \"msg\":\"A namespace-t t\u00f6r\u00f6lni kell, mert a debug m\u00f3d enged\u00e9lyezve van.\",\"namespaceName\":\"project-pr-1\"}\n... \"msg\":\"A namespace feldolgoz\u00e1s alatt \u00e1ll.\",\"namespaceName\":\"project-pr-1\",\"namespaceCreationTimestamp\":\"2020-06-16 18:43:58 +0300 EEST\"}\n... \"msg\":\"A namespace t\u00f6r\u00f6lve lett.\",\"namespaceName\":\"project-pr-1\"}\n... \"msg\":\"A namespace-t t\u00f6r\u00f6lni kell, mert a debug m\u00f3d enged\u00e9lyezve van.\",\"namespaceName\":\"project-pr-2\"}\n... \"msg\":\"A namespace feldolgoz\u00e1s alatt \u00e1ll.\",\"namespaceName\":\"project-pr-2\",\"namespaceCreationTimestamp\":\"2020-06-16 18:43:58 +0300 EEST\"}\n... \"msg\":\"A namespace t\u00f6r\u00f6lve lett.\",\"namespaceName\":\"project-pr-2\"}<\/code><\/pre>\n<p><\/p>\n<p>Ha ellen\u0151rizz\u00fck az er\u0151forr\u00e1sok megl\u00e9t\u00e9t, akkor azok <code>Terminating<\/code> (t\u00f6rl\u00e9si folyamat) \u00e1llapotban lesznek, vagy m\u00e1r t\u00f6r\u00f6lve vannak (a parancs kimenete \u00fcres).<\/p>\n<p><\/p>\n<pre><code class=\"bash\">$ kubectl get namespace,pods,deployment,service,horizontalpodautoscaler,configmap,ingress -n project-pr-1 &amp;&amp; kubectl get namespace,pods,deployment,service,horizontalpodautoscaler,configmap,ingress -n project-pr-2\n...<\/code><\/pre>\n<p><\/p>\n<p>Ism\u00e9telheti a l\u00e9trehoz\u00e1si folyamatot <code>fixtures<\/code> t\u00f6bbsz\u00f6r is, \u00e9s megvizsg\u00e1lhatja, hogy a t\u00f6rl\u00e9s egy percen bel\u00fcl megt\u00f6rt\u00e9nik.<\/p>\n<p><\/p>\n<h2>Alternat\u00edv\u00e1k<\/h2>\n<p><\/p>\n<p>Mit lehet tenni a clusterben m\u0171k\u00f6d\u0151 oper\u00e1tor helyett? Sz\u00e1mos megk\u00f6zel\u00edt\u00e9s l\u00e9tezik, mindegyik nem t\u00f6k\u00e9letes (\u00e9s azok h\u00e1tr\u00e1nyai szubjekt\u00edvak), \u00e9s mindenki maga d\u00f6nti el, mi a legjobb a konkr\u00e9t projekthez:<\/p>\n<p><\/p>\n<ol>\n<li>\n<p>A feature branch t\u00f6rl\u00e9se a master branch folyamatos integr\u00e1ci\u00f3s buildje alatt.<\/p>\n<p><\/p>\n<ul>\n<li>Ehhez tudni kell, hogy melyik pull request tartozik a commit-hoz, amelyet \u00e9p\u00edtenek. Mivel a feature branch namespace tartalmazza a pull request azonos\u00edt\u00f3j\u00e1t \u2014 a sz\u00e1m\u00e1t vagy az \u00e1gn\u00e9v\u00e9t, az azonos\u00edt\u00f3t mindig meg kell adni a commit-ban.<\/li>\n<li>A master \u00e1gi \u00e9p\u00edt\u00e9sek megbuknak. P\u00e9ld\u00e1ul az al\u00e1bbi l\u00e9p\u00e9seket hajtja v\u00e9gre: projekt let\u00f6lt\u00e9se, tesztek futtat\u00e1sa, projekt \u00f6ssze\u00e1ll\u00edt\u00e1sa, kiad\u00e1s k\u00e9sz\u00edt\u00e9se, \u00e9rtes\u00edt\u00e9sek k\u00fcld\u00e9se, a legutols\u00f3 pull request feature branch-j\u00e9nek t\u00f6rl\u00e9se. Ha az \u00e9p\u00edt\u00e9s az \u00e9rtes\u00edt\u00e9sek k\u00fcld\u00e9s\u00e9n\u00e9l megbukik, akkor k\u00e9zzel kell elt\u00e1vol\u00edtania az \u00f6sszes er\u0151forr\u00e1st a klaszterb\u0151l.<\/li>\n<li>Megfelel\u0151 kontextus n\u00e9lk\u00fcl a feature branch t\u00f6rl\u00e9se a master \u00e9p\u00edt\u00e9sben nem nyilv\u00e1nval\u00f3.<\/li>\n<\/ul>\n<p>\n<\/li>\n<li>\n<p>Webhook-ok haszn\u00e1lata (<noindex><a rel=\"nofollow\" href=\"https:\/\/github.community\/t\/trigger-jenkins-job-when-a-pull-request-is-merged-to-a-branch\/1169\">p\u00e9ld\u00e1m<\/a><\/noindex>).<\/p>\n<p><\/p>\n<ul>\n<li>Lehets\u00e9ges, hogy ez nem a te megk\u00f6zel\u00edt\u00e9sed. P\u00e9ld\u00e1ul a <noindex><a rel=\"nofollow\" href=\"https:\/\/www.jenkins.io\">Jenkins<\/a><\/noindex>, csak egyfajta pipeline t\u00e1mogatja a konfigur\u00e1ci\u00f3k forr\u00e1sk\u00f3dba val\u00f3 ment\u00e9s\u00e9nek lehet\u0151s\u00e9g\u00e9t. Webhook-ok haszn\u00e1latakor saj\u00e1t scriptet kell \u00edrni a feldolgoz\u00e1sukhoz. Ezt a scriptet a Jenkins fel\u00fclet\u00e9n kell elhelyezni, ami nehezen karbantarthat\u00f3.<\/li>\n<\/ul>\n<p>\n<\/li>\n<li>\n<p>\u00cdrj egy <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/controllers\/cron-jobs\/\">Cronjob-ot<\/a><\/noindex> \u00e9s add hozz\u00e1 a Kubernetes klasztert.<\/p>\n<p><\/p>\n<ul>\n<li>Id\u0151r\u00e1ford\u00edt\u00e1s az \u00edr\u00e1sra \u00e9s a karbantart\u00e1sra.<\/li>\n<li>Az oper\u00e1tor m\u00e1r hasonl\u00f3 st\u00edlusban m\u0171k\u00f6dik, dokument\u00e1lt \u00e9s karbantartott.<\/li>\n<\/ul>\n<p>\n<\/li>\n<\/ol>\n<p><\/p>\n<p>K\u00f6sz\u00f6n\u00f6m a cikk figyelm\u00e9\u00e9rt. <strong><noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/dmytrostriletskyi\/stale-feature-branch-operator\">Link a projekthez a Github-on<\/a><\/noindex><\/strong>.<\/p>\n<p>Forr\u00e1s: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/508534\/\">habr.com<\/a> <\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041f\u0440\u0438\u0432\u0435\u0442! Feature branch (aka deploy preview, review app) \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e master \u0432\u0435\u0442\u043a\u0430, \u043d\u043e \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 pull request \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 URL. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0438 \u043a\u043e\u0434 \u0432 production-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438, \u0444\u0438\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c \u0438\u043b\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043b\u043e\u0433\u0430\u043c. \u041f\u043e\u043a\u0430 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0432 pull request&#8217;\u0435, \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 commit \u0442\u0435\u043a\u0443\u0449\u0438\u0439 deploy \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f, \u0430 \u043d\u043e\u0432\u044b\u0439 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":86903,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-86902","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041f\u0440\u0438\u0432\u0435\u0442!\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/udalyaem-ustarevshuyu-feature-branch-v-kubernetes-klastere\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"hu_HU\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0443\u044e feature branch \u0432 Kubernetes \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041f\u0440\u0438\u0432\u0435\u0442!\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/udalyaem-ustarevshuyu-feature-branch-v-kubernetes-klastere\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-07-01T05:42:28+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-07-01T05:42:28+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47T\u00f6r\u00f6lj\u00fck a r\u00e9gi feature branch-t a Kubernetes klaszterben | ProHoster","description":"Hell\u00f3!","canonical_url":"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/udalyaem-ustarevshuyu-feature-branch-v-kubernetes-klastere","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"hu_HU","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0443\u044e feature branch \u0432 Kubernetes \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 | ProHoster","og:description":"\u041f\u0440\u0438\u0432\u0435\u0442!","og:url":"https:\/\/prohoster.info\/hu\/blog\/administrirovanie\/udalyaem-ustarevshuyu-feature-branch-v-kubernetes-klastere","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-07-01T05:42:28+00:00","article:modified_time":"2020-07-01T05:42:28+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"86902","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 14:03:55","updated":"2022-10-03 08:48:02","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/posts\/86902","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/comments?post=86902"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/posts\/86902\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/media\/86903"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/media?parent=86902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/categories?post=86902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/hu\/wp-json\/wp\/v2\/tags?post=86902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}