From 095be2721d334451e5762108c4533b3fb208f491 Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Fri, 20 Oct 2023 16:02:43 +0200 Subject: [PATCH] feat: deploy Zipline --- k8s/configure_cluster.yaml | 1 + k8s/configure_minio.yaml | 5 + k8s/configure_postgres.yaml | 1 + k8s/inventory/group_vars/all.yml | 266 +++++++++--------- k8s/roles/minio-config/tasks/main.yaml | 10 + .../nocodb/files/resources/deployment.yaml | 23 ++ k8s/roles/requirements.yaml | 1 + k8s/roles/zipline/files/config/base.env | 14 + k8s/roles/zipline/files/kustomization.yaml | 23 ++ .../zipline/files/resources/deployment.yaml | 51 ++++ .../zipline/files/resources/ingress.yaml | 17 ++ .../zipline/files/resources/service.yaml | 12 + k8s/roles/zipline/tasks/main.yml | 39 +++ 13 files changed, 334 insertions(+), 129 deletions(-) create mode 100644 k8s/configure_minio.yaml create mode 100644 k8s/roles/minio-config/tasks/main.yaml create mode 100644 k8s/roles/zipline/files/config/base.env create mode 100644 k8s/roles/zipline/files/kustomization.yaml create mode 100644 k8s/roles/zipline/files/resources/deployment.yaml create mode 100644 k8s/roles/zipline/files/resources/ingress.yaml create mode 100644 k8s/roles/zipline/files/resources/service.yaml create mode 100644 k8s/roles/zipline/tasks/main.yml diff --git a/k8s/configure_cluster.yaml b/k8s/configure_cluster.yaml index ef0b17f..f8610e5 100644 --- a/k8s/configure_cluster.yaml +++ b/k8s/configure_cluster.yaml @@ -13,3 +13,4 @@ - role: drone - role: fider - role: nextcloud + - role: zipline diff --git a/k8s/configure_minio.yaml b/k8s/configure_minio.yaml new file mode 100644 index 0000000..7330fd0 --- /dev/null +++ b/k8s/configure_minio.yaml @@ -0,0 +1,5 @@ +--- +- name: Configure postgres + hosts: localhost + roles: + - role: minio-config \ No newline at end of file diff --git a/k8s/configure_postgres.yaml b/k8s/configure_postgres.yaml index 5ec7509..10fe7d6 100644 --- a/k8s/configure_postgres.yaml +++ b/k8s/configure_postgres.yaml @@ -1,3 +1,4 @@ +--- - name: Configure postgres hosts: localhost roles: diff --git a/k8s/inventory/group_vars/all.yml b/k8s/inventory/group_vars/all.yml index 038d355..cd90027 100644 --- a/k8s/inventory/group_vars/all.yml +++ b/k8s/inventory/group_vars/all.yml @@ -1,130 +1,138 @@ $ANSIBLE_VAULT;1.1;AES256 -35356639666463343134653764343137393366303637353732343563313063353065623432366633 -3335346130393835336334653031323738313765333233650a373139333466383166313839646335 -66343835646266393236393232663536633630353438653536376566303336323836666461386639 -3230366662653530640a383565353035303765666338393962333732323738656431343761336639 -31396364333232386635393030656432616563353362396437363037636563613330306665666235 -65663139633237323434313438353536306161393030383036656239666234633334366530316435 -39323233396539353965303761343466303538386134636331396566386433346435303365303464 -36393339393939306637336533333839613532623761323330613263313266316630346264313362 -32616164353638316262383030346335343132363962306135623438323837353762636463393938 -64663135323135383135623331633137336265616461623236306336313262623332336436643836 -38396230386534646532353634656166646336396635326535623137393731663435636436373935 -32383161623361383834343635626539396132326566313635393534396439383935666336646366 -35343531363762336534393465323535323061333563633538666663343065313033313932356232 -62356364383431633564666136313039353830363762643766626636346262366363366536333164 -33623461363836643637396332353062316238313239613739376437383162313834613062306635 -66646539333337613936333532356332626237623733616363616437303263393037333833333239 -30383637656565303036613338333364326531323861336632633763613338313431343035303661 -65326464326435643438653935363735663062623563613366623133626533616633346331373032 -32356335316461363563666133303465653732373830616232613031353734386233396639393262 -38653764663136333139353639353931643362366333663136656536613064343637663863623536 -39333034623431323731333834636137336362646430396231343261346132336239306362393334 -62376139373166363365666662376465643666393433346264316333316163356235393937303361 -30346235653263353233323363353834643963336563613937383633633031656330366661323263 -33356263623530346436313564646130656266333532633063346336303564626339383632306239 -38636334366238336633373365653863373638373866643364366635633033303833613038353836 -66643664643662616633663431663466646234666233343631376265653031306663316536366663 -66373263313731303733306366663730656163306439333733666363623665656166366439373963 -66383738613766323332616463393337623333363735313064663638646332353537363062626130 -65386666336132373432303566333231353138336464333065663433643237343135353532396239 -64663036613233633861636138316536323936396666346437643436653437623663626663313031 -61396535313536663265666534306131306664353332633032323361353465333132303861316161 -39346335346238663239366664646532613661646330323766663161336232363365353738393364 -39366633303734666666383939656331383032303436656362353033663665633962366534356162 -66353934323631386533636162343933656663646334343666623664336162643937636631646633 -64363961383033653735333335636332363231323939363465353632623762316531643761333363 -65376538666263333863353534346565623166353563626233396238343566626531326637333131 -30613963323839656538613361396330613136396363353534366139336232313866393664393165 -32663065643332373532666566323634386465363933356631343638616638643433386632663065 -61656631306162646563383830613939363436333230323636656337313064383930353139343538 -64353631343466356361666635363934653861353863633866333866346538646230656135643936 -37613166636430343238323238646236386631316636313838396462623064653366306465623363 -66316331316130386562343536323737363565336534336337616537653532643764653338326436 -39633363396637376539633331616566343539623664376537623438393365373834343063303662 -37373536333632653764363133303365323865336438376663646564386463636163663731396336 -31313934366362316534343031333337633065653631343132383031326664613966646162356132 -36393365303638666264326666343861656361383831643236363961303132356432333330316437 -65323361386564616137663762636464303430373739636236363234623733323862353435396439 -30633937656564636334643332353738643766326364353765393064653936646237616532326565 -62363732653266383831326162653337323937346133303463383665393234633165303362306664 -64313164393461623439333339663262316331303534303438656362336363303765626565636234 -62346631646330666466613663373234653730333935663533616533666430633663643663313037 -63366235613235393932366535336238333235313531343965616336623730346639636262623231 -63363661313865353137366134333964646564666236346432343766353936343463326262306532 -64346339656530343463313035636531326264633539636136616130656439393565373563323266 -33386666663530633231393763336161613765383039643861363863316638373230613265643631 -64313733363463316539663433326336333831386565353335326632643661663563353931383564 -39623163303565376438386639326265663330303334663265306637656536663530646331356436 -33656465636338623233313135336536646138323937313833643537333731613132656532656266 -31346630333862353663386564326539636137663565323830356533346239306264623235393839 -33633736346133386331633031363137393034326231633038646431363439366634343766636138 -62303261376634636131323539663936386634616464653963393634623330303366353362633764 -37646335646562396634356139653932643964396563393062343438303135366538366630393537 -33643761366564636133373635633061366336333535633636346331633237616639656236313431 -66386137336637366337313030663432613963633339383963626663393931653562333730303537 -31393038336261346331393931396633626437666234626433306363383834653637613466333362 -34306662623266633939613832663162326139383331313933303434386237306163613938613731 -65346639373032666164613064383832323536653331323335313038336561653163323261653338 -30373965336233343732333739653965386261623733373765313939313037356536613333393965 -39303038643063323934303339353638333938306337323035336638326536356365643864373234 -31633932656232653665653661623865333032303266663963343862636130666433613035343663 -35356361313465366336306139333137363131616536376130373233623934376133646437626432 -64336239353562633039666464376235656634646466663935623032316237613730383339386532 -32633765323766373164656564646361333130383436646132376434373231326331613835376164 -33373438333864613330613035313938623435626532663932373064323736333532623366376435 -62323363656337353330333936316465623533313135333335323266643934323433373837326234 -33353039336439386235316634303965366661643137353466356437383436656432613732383764 -39333262626537616537643133356235383564373262393538303061333139313861376534656633 -32343863323834333462313838613239383962333064343537613533346638323663343765323830 -32383632623063356530623864633036373266326434343533353561633034303439643362376131 -66663263613032646438616235386535313866333863623239356362663138666262373664353235 -63326463636333393930373433343964363438383564393762623565353862666533613962393436 -63393336366532646233383762346138373631313565353331393137376266353564333736636164 -30636363353366643033306162663336663163323339323833303838643833356635323535303735 -32356264396437316166303161303766303162343164323930356163363139653130636663656237 -33383464383831323236353835333432646331313461646661623161303035323736346663303838 -62656462336637353432343938376237316563653634366561373532323131623033383162373639 -33653838316538333934613133303932343163323235616238343239626333663532663935643731 -62336161336134383035333865373233313837333130376131383435653032363936656631616431 -64633362336232663930653835666236373530663538323265666466616662346235633635663839 -33373930636263613864643565646239353133623936376464323534653636656437623032323030 -38383539343934333232666337353239346366346536363230626561383537383239353831613637 -35623536633637333463313966656333633761346363346437656563643337326139666163303132 -33313738613163323532613836356337303563633661306465363861326634376330653065306539 -66643831336634366131633237356132656138333438333637666665666230633335646437303764 -36346562656366633565366163343662356462373338373834366233316264663165386233303138 -66663565356132613038623165346231343735363134653162363062336562303461623930373339 -33343934623438333334626664373835663937336335366661323730373065346566353338663661 -36313539336136623062613038636231643631373864653436666435643636393766396666646561 -30316535316636613435613037623566373862353865623735666562366430363231306530366236 -37666436393330353565643461376339626162633032336333323363376262313432633432303362 -62646535323265643938343434623662643538636463633438366334353262303737616131303132 -36383565376166383733656133613738333936643966303962313632353330663132636432383164 -36653638646330316265333561336339386539353861313661323565316463346133323633373631 -62623138383062643066346266316465333533343233383331663130643261626364643164343763 -36363539666161323638393132363863373930383164303831313836623563343761373461306665 -61343166343635333634633539653431646363633837373966633935363261313666653864656139 -37333863396230323539326338396162656138373563623861363739646633333534306632346437 -63626261356665323663323730643964306438646437643161343833346439626533663337383165 -35353033643734383935656635333837353234633433363938653438323464333138643335626338 -35653464366232636431333062313966396336363661393531323462616337333062623937363735 -61633937373366393263656161373762623333633633323962323634613063313931326435356561 -66363034643064633065366266393662636636633964656639616339643965623131346330313165 -62633639373431336665396332326136656666646635343837333864363933313134633838313235 -39333666393433366538653935333138313165393037396432383461323463393932396236323036 -34356138386133653635626331636139333237373666356634303864313938393134366330656565 -65363065313365303164353735633261396464366465633435313634363532393763613532386631 -33653565346261613035396162393966316533373639393861376538656134643735303730643539 -32653739303261393536643963363332613166646639363262373039336231323330643033646261 -36366436626232306163393763633036366536376533663934343566646236663662633464323764 -61333862643834636130353037376264666362396461633764373536383561366231383365353863 -63316664616632636161646338323737613761633466653962636430653939313134616535333766 -64323238316432393039663366396461633338626637383936336264333938643363643435396639 -30346361356663613364633138653533396431323331636361613238313961653461353464303236 -64373939656138356539666630383465613931353531343965336537336134376339343131353361 -36363231363236316466613864613932376337316362363635316230366439633738336439656130 -64643966633961313935613163373034616537643333333037316137356164343638363864383166 -38646462356263313632336239616638376530386461373862386661393664653439386235643930 -37393739343632303334623263393538306365663933636161306263386136323539633937356436 -38666639363066346265633637643566643337376232383766306138393332383164 +65613032633935633062303533363430366230613563656130383863333566316132333861633230 +6534656562653935303135303966646433373832313136300a623636646431623465616561333730 +36353534353162353234366665303865656563643862636235376339303633353137373661393562 +6264353137396138380a646637643535313833373330386533373739363532306138373633623063 +63393561353362333361356164333264313666313764626639383935386139623837356335383130 +33613437653132356238316165383238306161633361613831383836366233373831636561643230 +30626464383862633235656562656136613236336161386666633737383664626530643630393962 +34383436653039626430303364316337663433383332393532653431313734363430353430663331 +30356164623039633066616266623239633139333264666636323039623663623136623566363737 +31353666626237393639633532303664346138306162303461363537653234393837353039316436 +31616137623664336437653130656566396466336262373063313364343632633038346336383036 +38343261356566356335646563653962343230313061626536336362636133353361303364653437 +37353535666465646135323536373066646332313361623034343038303038613530616561653339 +64333766643431326534646364396630383262623861346434623139613930373539383733623636 +30313934313766626566613063623038393632663432666233356566646364313861316361363164 +61333237353336616666366437326239353264323338656361386161346166633135653665373261 +37363064343061643165663732376133646135353337356331333666373631336664323531373533 +30306539616661366536353739656331396565393138626162323735373366383563343130656366 +61616664363338616132363534343431346536373363326266393864346138323939643937366466 +37656331386166333130343237623639663964333333376434663030343835626438333731366466 +65653539373535383364326635343462653638363436646436656162336566343030616366383937 +32336637333261613035666664663636353931353234636664656336366464356463303038303736 +34326432386436616335313632363566326362653565303366613966306433663163313832613361 +33653231316630623430386164633530646635393734383239303863333566643963303962323139 +38643736646563656638303265313537343235613765323435333136613330623336373065393165 +33616433333234633333626563323265666434383465353936333835393439323035663535356165 +36303962353130643136326136613338336335633033633835366438643236383463376133343266 +33343862376233396537623334386135663139376665303331373630663039383630383234313164 +66653764353064616366373661613065356264373939663537643361373831343830393065336232 +36343531393233626632396338656539666539306131306336313239393935383432623631613664 +65373634396537386461663332646132356333363634303561656235636337393238363366396362 +30303862376631353031653662356230633734376337326336663132333661643836346139666563 +30393564353565323664363730646364316132373939336135343463306636656535653262333132 +63366135646235653539636632626463313434613033616136386433666539313065313832653338 +32396533303130323633333336303363623263316433653932343332336438366431343161666432 +34623739333062636532376230393264303638353934643361616636306236613939323134326130 +39316365636434653265366432636134363935326335636133356639656165356336613034613039 +37333538383136336335313234303134343739363038323836323538623932333362366162333630 +37343236616539343266313665373662363665303063333134393830336433343431666166313665 +39396335313731393233383234663031396634333034303661636434376634333533633265666230 +34633561623139666363663165653264653533653939306234313637353062656330316335663865 +33613634346265646162653163303239386263303132323831366538626136363331636162376231 +38363464623830343630336238323532363564353130323237343265626230346332356537636633 +64393666643830376535363730663430623230343564646264623237363332393639656434626235 +64303637623930373137666332643233326137343864343735623237386531323638326465353861 +64343234653065626163313836663832306161386464376231363164646366383066313437393631 +36343234643237653463643265623036303436333362666433623061376436633762346634396662 +39396661653037373862313730633130653033393566313064336135636162316563303531373134 +35643862613962653261383633646331353533333332666535636163303930323031616363323136 +39616233326636636231366435616439373330333439346563343937633764326130323231373730 +33346230336334623633376633366566656636643738323864626666623832313830363132613430 +37613133343433343932343965666563663132353763313261613738386338623030303437313238 +36616637646433383466333866363638363733366136313436313765653730316330663533626130 +30383763633762613638643136366665306537373366396339316136646462653039373231623832 +33303461633531303737623061643063366238396464303832353334356336623164363238656230 +36323931333066343033303961313765363930353039653530633531346532316663323966346535 +32313132366639653666626661356235313236613130303662343935643534373433323763633032 +62333963373264323736396639376530653434353036336562393434383639366163316232353439 +38363630343138323864653031333830363330633363376165373239313263316234616131336139 +35333332633135323266396334313432323633633834633764316432373532633865323766616438 +64303833333366386562326630616635663336373562303861366437663238376438663166313666 +38393462663939623035323337393538666166306263393662663432323334653833666532363432 +32366333313161306134623130613161353863346233663030633166616434643232653530653336 +30333739656463393639663663313331346636353062306237323739373639326338386338303065 +38383961396239636661373534316639333461323539323262326332366263313933396563616161 +61663232326162616565313232303836353431666663623734656136643936323266336261326331 +34353262393361653863393630363434636361616334376236626465393263346162356636356664 +30616238346138663432303666353839373465613464366234653364333763613930663933336332 +63616261633430353530336531623365623031336566356464653234636639316438383237343464 +30303034333630336633383462316437636161353630396531623737333132306161373436326632 +64646535343735623961356538333735396236336266366632336139613136303762643734323234 +30343536363438623030646430383935383130643665633533383566303631333130303866343564 +62353639353531653265326164336231373063396235346464373539666161636333396463666532 +33336638623362613165333834336133356462626331393030623537353862663431383830323539 +61346461306361616632353563396131623536653165396664313764353463363331616466383465 +36333666323031306462373332623534613831333962633237666431393331633632313730646535 +63626265303239383162373136323661323934623861393265346366366462616534343537373333 +32373030353030613262323837393931386430613733653730333362383335646138366530386364 +37633263313832653666643266343434396565353762623736346563336663316630626435383639 +65323234346238346437636238326566613366623561313635623938343735656461353639636263 +34663834346532366361393835363037336230656436323735363261373032326137343663636262 +37663534633434616231306338376264613133626162366639666137663337646631313637326161 +39316163666162353335353365376531356264613332386630393736393362356432303437313261 +30643664396461323839333938376533393062313531313336396164653434363633636335623431 +36353864346434663166396561343537356636343337616136303133643131326233313731303637 +33663135343534363434326537636234613130383834633839636465346535393364306266316237 +34366133666665313463343535313130333636626433383331336538313665666536326234306666 +63306430383937633732636437356130353034623265343436613665373264613666343835626130 +64633937333134393266343366376430346366386363333836613039666639363935663232316165 +38663263643731343066356639306466363364646132313830663232613730303037393563326231 +35373864666136656364323933643166383438316666646631326433323261353830626338373832 +61633361393632363738623236626262646564353636633261383635353366373034353763663831 +37326630323538326136653737366134623132303535613131623663383662326331633530636239 +62356333306263303861666336616661306562656233623038313361613635316264346164313061 +63626161353335646165643065373061323334353238383464396336323266326662333438383761 +34653239313165306232393163646433313533643038326636373565633836653435656263616663 +62326330316231313330633934623638646135326439666431663838613264386530343762323031 +66366361393533386565353062633331666431316437353138383533386164623763353838623938 +64356462353962333535356631326266336463656337336230383733366162626431393230376538 +38373731323162326566613934633739346133633135666238386231316661376161663038393430 +39393130386138366433393836663666613236333537313432663436323431613462306135343239 +64613635303930303864636231636134666632376264343663343131626631653936643038633334 +63343139613434366134646561363139343861393763343834313266303337656635366666326233 +62313535326437646136623631346431313938353139316434653938323162366331373063343639 +31333466656430376538373332336364623233346634373431656130643133313664366132626536 +61363265663566633530626632666262333034316335363434313835333333393434623536303635 +37346431633236336635316131393931333335363432313438383334326661643966316131626533 +39313333656531626633643366616438316466313936656135323032646532323761666563313033 +39613064613631346366303632343638643464356537653631313664376339633334366362653365 +63666136353630323866326535343131616531663865613530646332356161313134643561623934 +62333631643434613461323461303339333564666530393135363338666565643432633539396131 +34366335653939666433313235313763376537376165393636613066326338386139393865666534 +30376635343030613933336564653363623539643836376337306162353539373435623836623532 +61626336396465653766366266653832346666343837653034356336373239343665313831306162 +31306138613739303439343164393162636366356430396538303661323033663434306666376366 +65663065313165313461323734393236613933323634356138386165326535303262663337343031 +64396439323530636265353139313733303764373738613462643466343666656661383561313765 +30626164393037343134383137333333333131356231323431613661373736393237373964376633 +38346165653732306239393864633537626530323662353466343861363265393562343230313731 +38366261633733623338303565626561396231323266373836303264326532653036363866653363 +33396139326230616336343631383335393765343866366234366639333063633661323733636232 +63373932353665333662303038386637343332383364623163326262316233383466646338303134 +36356434666637313636346361366461326634333064306433613839356466333865303739306564 +62376339646639383133393233326437326337623434613930333663356334643562306566646131 +62653238626162613430363835346338363431656163633461626234306365383530633531323238 +35613364383131303634363431336632313039643562393332353835326534376261313761346366 +62353234343366386438343830343237306333383761313564636134323963643466383239393538 +61363663313438636663663933393165346337336638353239316134653733663337656437653663 +35383564353235393661616139353336623563336237613838363937363537656638383236373335 +63323730363363303233653733383735626365363465316235386632393931633063623662633838 +37383436376263373537376330323836383036353661373734653238383034303962373766363139 +63316131386333383736333736336534346539396334333734336666303239376432376437643866 +33663032343534346362626539386438363538303239313638663830336131393632393136353234 +31623263653862383431376436393130616339663666663630356262646566343163393263353831 +37666330666562393865303835353166616334376234323061646636303639343332633631656234 +36393830323435303538653938636132383730353538336539303863643331666534626336353731 +37626631313238646532323963393439636433666664363264306132386563366432 diff --git a/k8s/roles/minio-config/tasks/main.yaml b/k8s/roles/minio-config/tasks/main.yaml new file mode 100644 index 0000000..3ac7729 --- /dev/null +++ b/k8s/roles/minio-config/tasks/main.yaml @@ -0,0 +1,10 @@ +--- +- name: Manage buckets + amazon.aws.s3_bucket: + name: "{{ item.name }}" + state: '{{ item.state | default("present") }}' + endpoint_url: http://localhost:9000 + access_key: "{{ minio.rootUser }}" + secret_key: "{{ minio.rootPassword }}" + loop: + - name: zipline \ No newline at end of file diff --git a/k8s/roles/nocodb/files/resources/deployment.yaml b/k8s/roles/nocodb/files/resources/deployment.yaml index 0f0dd30..c3b1a9e 100644 --- a/k8s/roles/nocodb/files/resources/deployment.yaml +++ b/k8s/roles/nocodb/files/resources/deployment.yaml @@ -7,6 +7,9 @@ spec: selector: matchLabels: app.kubernetes.io/name: nocodb + replicas: 1 + strategy: + type: Recreate template: metadata: labels: @@ -29,6 +32,26 @@ spec: name: nocodb-metadata - mountPath: /usr/src/app/ name: app-volume + livenessProbe: + httpGet: + path: /api/v1/health + port: web + scheme: HTTP + initialDelaySeconds: 10 + timeoutSeconds: 3 + periodSeconds: 5 + successThreshold: 1 + failureThreshold: 3 + readinessProbe: + httpGet: + path: /api/v1/health + port: web + scheme: HTTP + initialDelaySeconds: 5 + timeoutSeconds: 3 + periodSeconds: 5 + successThreshold: 1 + failureThreshold: 3 resources: requests: memory: "168Mi" diff --git a/k8s/roles/requirements.yaml b/k8s/roles/requirements.yaml index ff33494..3aec16b 100644 --- a/k8s/roles/requirements.yaml +++ b/k8s/roles/requirements.yaml @@ -3,3 +3,4 @@ collections: - kubernetes.core - hetzner.hcloud - community.postgresql +- amazon.aws diff --git a/k8s/roles/zipline/files/config/base.env b/k8s/roles/zipline/files/config/base.env new file mode 100644 index 0000000..a51a5c9 --- /dev/null +++ b/k8s/roles/zipline/files/config/base.env @@ -0,0 +1,14 @@ +CORE_RETURN_HTTPS=true +CORE_HOST=0.0.0.0 +CORE_PORT=3000 +CORE_LOGGER=true +DATASOURCE_TYPE=s3 +DATASOURCE_S3_ENDPOINT=minio.minio.svc.cluster.local +DATASOURCE_S3_PORT=9000 +DATASOURCE_S3_BUCKET=zipline +DATASOURCE_S3_FORCE_S3_PATH=true +DATASOURCE_S3_REGION=us-east-1 +FEATURES_INVITES=true +FEATURES_OAUTH_REGISTRATION=true +FEATURES_OAUTH_LOGIN_ONLY=true +FEATURES_USER_REGISTRATION=false \ No newline at end of file diff --git a/k8s/roles/zipline/files/kustomization.yaml b/k8s/roles/zipline/files/kustomization.yaml new file mode 100644 index 0000000..3983e93 --- /dev/null +++ b/k8s/roles/zipline/files/kustomization.yaml @@ -0,0 +1,23 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: zipline + +images: +- name: zipline + newName: ghcr.io/diced/zipline + newTag: "3.7.4" + +commonLabels: + app.kubernetes.io/instance: icb4dc0de + app.kubernetes.io/managed-by: kustomize + +resources: + - "resources/deployment.yaml" + - "resources/service.yaml" + - "resources/ingress.yaml" + +secretGenerator: + - name: zipline-base-config + envs: + - "config/base.env" diff --git a/k8s/roles/zipline/files/resources/deployment.yaml b/k8s/roles/zipline/files/resources/deployment.yaml new file mode 100644 index 0000000..4267856 --- /dev/null +++ b/k8s/roles/zipline/files/resources/deployment.yaml @@ -0,0 +1,51 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: zipline +spec: + selector: + matchLabels: + app.kubernetes.io/name: zipline + replicas: 2 + template: + metadata: + labels: + app.kubernetes.io/name: zipline + spec: + containers: + - name: zipline + image: zipline + envFrom: + - secretRef: + name: zipline-base-config + - secretRef: + name: zipline-secret-config + ports: + - containerPort: 3000 + protocol: TCP + name: web + volumeMounts: + - mountPath: /tmp + name: temp + resources: + requests: + memory: "256Mi" + cpu: "50m" + limits: + memory: "512Mi" + cpu: "500m" + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + volumes: + - name: temp + emptyDir: + sizeLimit: 1500Mi + securityContext: + runAsUser: 1000 + runAsGroup: 1000 + runAsNonRoot: true \ No newline at end of file diff --git a/k8s/roles/zipline/files/resources/ingress.yaml b/k8s/roles/zipline/files/resources/ingress.yaml new file mode 100644 index 0000000..5f9d5bc --- /dev/null +++ b/k8s/roles/zipline/files/resources/ingress.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: zipline +spec: + rules: + - host: share.icb4dc0.de + http: + paths: + - pathType: Prefix + path: / + backend: + service: + name: zipline + port: + number: 3000 \ No newline at end of file diff --git a/k8s/roles/zipline/files/resources/service.yaml b/k8s/roles/zipline/files/resources/service.yaml new file mode 100644 index 0000000..a06a794 --- /dev/null +++ b/k8s/roles/zipline/files/resources/service.yaml @@ -0,0 +1,12 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: zipline +spec: + selector: + app.kubernetes.io/name: zipline + ports: + - protocol: TCP + port: 3000 + targetPort: 3000 \ No newline at end of file diff --git a/k8s/roles/zipline/tasks/main.yml b/k8s/roles/zipline/tasks/main.yml new file mode 100644 index 0000000..50cb1c7 --- /dev/null +++ b/k8s/roles/zipline/tasks/main.yml @@ -0,0 +1,39 @@ +--- +- name: Create Zipline namespace + kubernetes.core.k8s: + name: zipline + api_version: v1 + kind: Namespace + state: present + definition: + metadata: + labels: + prometheus: default + +- name: Create Zipline secrets + kubernetes.core.k8s: + state: present + definition: + apiVersion: v1 + kind: Secret + metadata: + name: zipline-secret-config + namespace: zipline + data: + # Auth + CORE_SECRET: "{{ zipline.auth.secret | b64encode }}" + + # DB + CORE_DATABASE_URL: "{{ 'postgres://%s:%s@postgres-15-postgresql.postgres.svc.cluster.local:5432/zipline' | format(zipline.db.user, zipline.db.password) | b64encode }}" + + # Datasource + DATASOURCE_S3_ACCESS_KEY_ID: "{{ minio.rootUser | b64encode }}" + DATASOURCE_S3_SECRET_ACCESS_KEY: "{{ minio.rootPassword | b64encode }}" + + # Auth + OAUTH_GITHUB_CLIENT_ID: "{{ zipline.auth.clientId | b64encode }}" + OAUTH_GITHUB_CLIENT_SECRET: "{{ zipline.auth.clientSecret | b64encode }}" + +- name: Deploy Zipline kustomization + k8s: + definition: "{{ lookup('kubernetes.core.kustomize', dir=([role_path, 'files'] | path_join)) }}"