diff --git a/.gitignore b/.gitignore index 527a30bef..cb6665927 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,9 @@ target .vite venv .venv +.vagrant +temporary_files testing/go_cli_api/ainarictl testing/ansible_deploy/.vagrant/ @@ -24,6 +26,7 @@ src/sdk/python/ainari_sdk/ainari_messages gitIdentityChange.sh proto3_pb2.py CMakeLists.txt.user* +ainari_docker_files.tar *.proto3.pb.go *.qmake2cmake @@ -38,3 +41,4 @@ CMakeLists.txt.user* *.whl *.orig *.egg-info + diff --git a/CHANGELOG.md b/CHANGELOG.md index 67526bc84..0fef230ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [Unreleased] + +### Added + +- Vagrantfile with ansible playbook to deploy multiple virtual machines with a kubernestes with fully deployed ainari-setup and sdk-api-test +- image pull-policy can now be changed by the helm-values + +### Changed + +- changed the image-build process for the new vagrant-test-setup + ## v0.10.0 (Changes since v0.9.0) diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 000000000..702da1d39 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,63 @@ +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Run host-side script first in "vagrant up"-command +if ARGV.any? { |arg| arg == "up" } + puts "Building Docker images before vagrant up..." + system("./scripts/build_docker_images.sh") or abort("build_docker_images.sh failed, stopping!") +end + +Vagrant.configure("2") do |config| + # There is no official debian 13 image for vagrant, because of the license-change + # Used this alternative images instead: https://github.com/alchemy-solutions/vagrant-cloud-images + config.vm.box = "cloud-image/debian-13" + + nodes = { + "server" => "192.168.56.10", + "agent1" => "192.168.56.11", + "agent2" => "192.168.56.12" + } + + nodes.each do |name, ip| + config.vm.define name do |node| + # Add three extra disks of 5G each in addition to the root disk for the onsen + node.vm.provider :libvirt do |libvirt| + libvirt.storage :file, size: "5G", name: "ainari-#{name}-vdb.qcow2" + end + + node.vm.hostname = name + node.vm.network "private_network", ip: ip + node.vm.provider "libvirt" do |vb| + vb.memory = 4096 + vb.cpus = 4 + vb.storage :file, size: 10 + end + end + end + + # Run provision.yml for the 'ainari-test' group + config.vm.provision "ansible" do |ansible| + ansible.playbook = "testing/vagrant/playbook.yaml" + ansible.become = true + + ansible.extra_vars = { + ansible_python_interpreter: "/usr/bin/python3" + } + # ansible.verbose = "vvv" + ansible.groups = { + "k3s_server" => ["server"], + "k3s_agents" => ["agent1", "agent2"] + } + end +end diff --git a/deploy/k8s/ainari/templates/dashboard/dashboard-deployment.yaml b/deploy/k8s/ainari/templates/dashboard/dashboard-deployment.yaml index 19373d3e1..e322ad221 100644 --- a/deploy/k8s/ainari/templates/dashboard/dashboard-deployment.yaml +++ b/deploy/k8s/ainari/templates/dashboard/dashboard-deployment.yaml @@ -35,7 +35,7 @@ spec: containers: - name: dashboard image: {{ .Values.docker.registry }}/ainari_dashboard:{{ .Values.docker.tag }} - imagePullPolicy: Always + imagePullPolicy: {{ .Values.docker.pull_policy }} env: - name: RUST_LOG value: "debug" diff --git a/deploy/k8s/ainari/templates/hanami/hanami-deployment.yaml b/deploy/k8s/ainari/templates/hanami/hanami-deployment.yaml index d554e0cbd..f37ad1de9 100644 --- a/deploy/k8s/ainari/templates/hanami/hanami-deployment.yaml +++ b/deploy/k8s/ainari/templates/hanami/hanami-deployment.yaml @@ -35,7 +35,7 @@ spec: containers: - name: hanami image: {{ .Values.docker.registry }}/hanami:{{ .Values.docker.tag }} - imagePullPolicy: Always + imagePullPolicy: {{ .Values.docker.pull_policy }} env: - name: RUST_LOG value: "debug" diff --git a/deploy/k8s/ainari/templates/miko/miko-config.yaml b/deploy/k8s/ainari/templates/miko/miko-config.yaml index df1d1f6e9..8ff221b0c 100644 --- a/deploy/k8s/ainari/templates/miko/miko-config.yaml +++ b/deploy/k8s/ainari/templates/miko/miko-config.yaml @@ -20,19 +20,19 @@ data: file_path = "/etc/ainari/miko/miko_db" [endpoints.hanami] - public_address = "https://local-hanami:443" + public_address = "https://{{ .Values.api.domain_hanami }}:443" internal_address = "https://hanami-tls-service.default.svc.cluster.local:8443" [endpoints.ryokan] - public_address = "https://local-ryokan:443" + public_address = "https://{{ .Values.api.domain_ryokan }}:443" internal_address = "https://ryokan-tls-service.default.svc.cluster.local:8443" [endpoints.torii] - public_address = "https://local-torii:443" + public_address = "https://{{ .Values.api.domain_torii }}:443" internal_address = "https://torii-tls-service.default.svc.cluster.local:8443" [endpoints.omamori] - public_address = "https://local-omamori:443" + public_address = "https://{{ .Values.api.domain_omamori }}:443" internal_address = "https://omamori-tls-service.default.svc.cluster.local:8443" kind: ConfigMap diff --git a/deploy/k8s/ainari/templates/miko/miko-deployment.yaml b/deploy/k8s/ainari/templates/miko/miko-deployment.yaml index 41a64bd55..2d3443dc0 100644 --- a/deploy/k8s/ainari/templates/miko/miko-deployment.yaml +++ b/deploy/k8s/ainari/templates/miko/miko-deployment.yaml @@ -17,7 +17,7 @@ spec: containers: - name: miko image: {{ .Values.docker.registry }}/miko:{{ .Values.docker.tag }} - imagePullPolicy: Always + imagePullPolicy: {{ .Values.docker.pull_policy }} env: - name: AINARI_ADMIN_ID value: {{ required "user.id is required!" .Values.user.id }} diff --git a/deploy/k8s/ainari/templates/omamori/omamori-deployment.yaml b/deploy/k8s/ainari/templates/omamori/omamori-deployment.yaml index e0f5016ad..cdf803abe 100644 --- a/deploy/k8s/ainari/templates/omamori/omamori-deployment.yaml +++ b/deploy/k8s/ainari/templates/omamori/omamori-deployment.yaml @@ -35,7 +35,7 @@ spec: containers: - name: omamori image: {{ .Values.docker.registry }}/omamori:{{ .Values.docker.tag }} - imagePullPolicy: Always + imagePullPolicy: {{ .Values.docker.pull_policy }} env: - name: RUST_LOG value: "debug" diff --git a/deploy/k8s/ainari/templates/onsen/onsen-deployment.yaml b/deploy/k8s/ainari/templates/onsen/onsen-deployment.yaml index a02330c86..26ac0090d 100644 --- a/deploy/k8s/ainari/templates/onsen/onsen-deployment.yaml +++ b/deploy/k8s/ainari/templates/onsen/onsen-deployment.yaml @@ -35,7 +35,7 @@ spec: containers: - name: onsen image: {{ .Values.docker.registry }}/onsen:{{ .Values.docker.tag }} - imagePullPolicy: Always + imagePullPolicy: {{ .Values.docker.pull_policy }} env: - name: RUST_LOG value: "debug,h2=info" diff --git a/deploy/k8s/ainari/templates/ryokan/ryokan-deployment.yaml b/deploy/k8s/ainari/templates/ryokan/ryokan-deployment.yaml index 4d7254133..5fbd01327 100644 --- a/deploy/k8s/ainari/templates/ryokan/ryokan-deployment.yaml +++ b/deploy/k8s/ainari/templates/ryokan/ryokan-deployment.yaml @@ -35,7 +35,7 @@ spec: containers: - name: ryokan image: {{ .Values.docker.registry }}/ryokan:{{ .Values.docker.tag }} - imagePullPolicy: Always + imagePullPolicy: {{ .Values.docker.pull_policy }} env: - name: RUST_LOG value: "debug,h2=info" diff --git a/deploy/k8s/ainari/templates/sakura/sakura-deployment.yaml b/deploy/k8s/ainari/templates/sakura/sakura-deployment.yaml index e21320ca5..1bd1d165b 100644 --- a/deploy/k8s/ainari/templates/sakura/sakura-deployment.yaml +++ b/deploy/k8s/ainari/templates/sakura/sakura-deployment.yaml @@ -35,7 +35,7 @@ spec: containers: - name: sakura image: {{ .Values.docker.registry }}/sakura:{{ .Values.docker.tag }} - imagePullPolicy: Always + imagePullPolicy: {{ .Values.docker.pull_policy }} env: - name: RUST_LOG value: "debug,h2=info" diff --git a/deploy/k8s/ainari/templates/torii/torii-deployment.yaml b/deploy/k8s/ainari/templates/torii/torii-deployment.yaml index 3fcb49884..95cf1bc3e 100644 --- a/deploy/k8s/ainari/templates/torii/torii-deployment.yaml +++ b/deploy/k8s/ainari/templates/torii/torii-deployment.yaml @@ -35,7 +35,7 @@ spec: containers: - name: torii image: {{ .Values.docker.registry }}/torii:{{ .Values.docker.tag }} - imagePullPolicy: Always + imagePullPolicy: {{ .Values.docker.pull_policy }} env: - name: RUST_LOG value: "debug" diff --git a/deploy/k8s/ainari/values.yaml b/deploy/k8s/ainari/values.yaml index 6d2b86986..6f380e70e 100644 --- a/deploy/k8s/ainari/values.yaml +++ b/deploy/k8s/ainari/values.yaml @@ -13,6 +13,7 @@ token: docker: tag: "develop" registry: "kitsudaiki" + pull_policy: "Always" api: domain_sakura: local-sakura diff --git a/dockerfiles/Dockerfile_build_base b/dockerfiles/Dockerfile_build_base new file mode 100644 index 000000000..72d6dcbbb --- /dev/null +++ b/dockerfiles/Dockerfile_build_base @@ -0,0 +1,29 @@ +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM debian:12.12-slim@sha256:78d2f66e0fec9e5a39fb2c72ea5e052b548df75602b5215ed01a17171529f706 + +ARG DEBIAN_FRONTEND=noninteractive + +RUN set -e && \ + apt-get update && \ + apt-get install --no-install-recommends -y \ + protobuf-compiler \ + gcc \ + curl \ + pkg-config \ + libssl-dev \ + libsqlite3-dev \ + ca-certificates +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y diff --git a/dockerfiles/Dockerfile_dashboard b/dockerfiles/Dockerfile_dashboard index 3feb2f063..97b5f65dc 100644 --- a/dockerfiles/Dockerfile_dashboard +++ b/dockerfiles/Dockerfile_dashboard @@ -1,5 +1,18 @@ -# Step 1: Build the app -FROM node:24-alpine AS build +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM node:24-alpine@sha256:c921b97d4b74f51744057454b306b418cf693865e73b8100559189605f6955b8 AS build WORKDIR /app diff --git a/dockerfiles/Dockerfile_hanami b/dockerfiles/Dockerfile_hanami index 2fab6a2af..933d58fd2 100644 --- a/dockerfiles/Dockerfile_hanami +++ b/dockerfiles/Dockerfile_hanami @@ -1,22 +1,33 @@ -FROM debian:12.12-slim@sha256:78d2f66e0fec9e5a39fb2c72ea5e052b548df75602b5215ed01a17171529f706 AS builder - -ARG DEBIAN_FRONTEND=noninteractive +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM kitsudaiki/ainari_build_base:0.1.0@sha256:24467cc617f19791b20719d1c826dd8f2db34aac55ed54dbb6263e6c64d29c74 AS builder WORKDIR /app -RUN apt-get update && \ - apt-get install -y protobuf-compiler \ - gcc \ - curl \ - pkg-config \ - libssl-dev \ - libsqlite3-dev && \ - curl https://sh.rustup.rs -sSf | sh -s -- -y - -COPY . . +COPY src src +COPY Cargo.toml Cargo.toml +COPY Cargo.lock Cargo.lock -RUN ~/.cargo/bin/cargo build --release -p hanami +RUN ~/.cargo/bin/cargo build --release RUN cp target/release/hanami /app/ +RUN cp target/release/miko /app/ +RUN cp target/release/omamori /app/ +RUN cp target/release/onsen /app/ +RUN cp target/release/ryokan /app/ +RUN cp target/release/sakura /app/ +RUN cp target/release/torii /app/ # --------------------------------------------------- diff --git a/dockerfiles/Dockerfile_miko b/dockerfiles/Dockerfile_miko index c59f8139f..ae1a22897 100644 --- a/dockerfiles/Dockerfile_miko +++ b/dockerfiles/Dockerfile_miko @@ -1,22 +1,33 @@ -FROM debian:12.12-slim@sha256:78d2f66e0fec9e5a39fb2c72ea5e052b548df75602b5215ed01a17171529f706 AS builder - -ARG DEBIAN_FRONTEND=noninteractive +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM kitsudaiki/ainari_build_base:0.1.0@sha256:24467cc617f19791b20719d1c826dd8f2db34aac55ed54dbb6263e6c64d29c74 AS builder WORKDIR /app -RUN apt-get update && \ - apt-get install -y protobuf-compiler \ - gcc \ - curl \ - pkg-config \ - libssl-dev \ - libsqlite3-dev && \ - curl https://sh.rustup.rs -sSf | sh -s -- -y - -COPY . . +COPY src src +COPY Cargo.toml Cargo.toml +COPY Cargo.lock Cargo.lock -RUN ~/.cargo/bin/cargo build --release -p miko +RUN ~/.cargo/bin/cargo build --release +RUN cp target/release/hanami /app/ RUN cp target/release/miko /app/ +RUN cp target/release/omamori /app/ +RUN cp target/release/onsen /app/ +RUN cp target/release/ryokan /app/ +RUN cp target/release/sakura /app/ +RUN cp target/release/torii /app/ # --------------------------------------------------- diff --git a/dockerfiles/Dockerfile_omamori b/dockerfiles/Dockerfile_omamori index d3c8442bb..7fd57ee66 100644 --- a/dockerfiles/Dockerfile_omamori +++ b/dockerfiles/Dockerfile_omamori @@ -1,22 +1,33 @@ -FROM debian:12.12-slim@sha256:78d2f66e0fec9e5a39fb2c72ea5e052b548df75602b5215ed01a17171529f706 AS builder - -ARG DEBIAN_FRONTEND=noninteractive +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM kitsudaiki/ainari_build_base:0.1.0@sha256:24467cc617f19791b20719d1c826dd8f2db34aac55ed54dbb6263e6c64d29c74 AS builder WORKDIR /app -RUN apt-get update && \ - apt-get install -y protobuf-compiler \ - gcc \ - curl \ - pkg-config \ - libssl-dev \ - libsqlite3-dev && \ - curl https://sh.rustup.rs -sSf | sh -s -- -y - -COPY . . +COPY src src +COPY Cargo.toml Cargo.toml +COPY Cargo.lock Cargo.lock -RUN ~/.cargo/bin/cargo build --release -p omamori +RUN ~/.cargo/bin/cargo build --release +RUN cp target/release/hanami /app/ +RUN cp target/release/miko /app/ RUN cp target/release/omamori /app/ +RUN cp target/release/onsen /app/ +RUN cp target/release/ryokan /app/ +RUN cp target/release/sakura /app/ +RUN cp target/release/torii /app/ # --------------------------------------------------- diff --git a/dockerfiles/Dockerfile_onsen b/dockerfiles/Dockerfile_onsen index 1907fa025..0b74d6017 100644 --- a/dockerfiles/Dockerfile_onsen +++ b/dockerfiles/Dockerfile_onsen @@ -1,21 +1,33 @@ -FROM debian:12.12-slim@sha256:78d2f66e0fec9e5a39fb2c72ea5e052b548df75602b5215ed01a17171529f706 AS builder - -ARG DEBIAN_FRONTEND=noninteractive +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM kitsudaiki/ainari_build_base:0.1.0@sha256:24467cc617f19791b20719d1c826dd8f2db34aac55ed54dbb6263e6c64d29c74 AS builder WORKDIR /app -RUN apt-get update && \ - apt-get install -y protobuf-compiler \ - gcc \ - curl \ - pkg-config \ - libssl-dev && \ - curl https://sh.rustup.rs -sSf | sh -s -- -y - -COPY . . +COPY src src +COPY Cargo.toml Cargo.toml +COPY Cargo.lock Cargo.lock -RUN ~/.cargo/bin/cargo build --release -p onsen +RUN ~/.cargo/bin/cargo build --release +RUN cp target/release/hanami /app/ +RUN cp target/release/miko /app/ +RUN cp target/release/omamori /app/ RUN cp target/release/onsen /app/ +RUN cp target/release/ryokan /app/ +RUN cp target/release/sakura /app/ +RUN cp target/release/torii /app/ # --------------------------------------------------- @@ -29,7 +41,7 @@ RUN apt-get update && \ wireguard-tools \ iptables-persistent \ iproute2 && \ - apt-get clean autoclean &&\ + apt-get clean autoclean && \ apt-get autoremove --yes # horrible dirty workaround to prevent the error diff --git a/dockerfiles/Dockerfile_ryokan b/dockerfiles/Dockerfile_ryokan index 8d8a6dd32..ab0947c00 100644 --- a/dockerfiles/Dockerfile_ryokan +++ b/dockerfiles/Dockerfile_ryokan @@ -1,22 +1,33 @@ -FROM debian:12.12-slim@sha256:78d2f66e0fec9e5a39fb2c72ea5e052b548df75602b5215ed01a17171529f706 AS builder - -ARG DEBIAN_FRONTEND=noninteractive +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM kitsudaiki/ainari_build_base:0.1.0@sha256:24467cc617f19791b20719d1c826dd8f2db34aac55ed54dbb6263e6c64d29c74 AS builder WORKDIR /app -RUN apt-get update && \ - apt-get install -y protobuf-compiler \ - gcc \ - curl \ - pkg-config \ - libssl-dev \ - libsqlite3-dev && \ - curl https://sh.rustup.rs -sSf | sh -s -- -y - -COPY . . +COPY src src +COPY Cargo.toml Cargo.toml +COPY Cargo.lock Cargo.lock -RUN ~/.cargo/bin/cargo build --release -p ryokan +RUN ~/.cargo/bin/cargo build --release +RUN cp target/release/hanami /app/ +RUN cp target/release/miko /app/ +RUN cp target/release/omamori /app/ +RUN cp target/release/onsen /app/ RUN cp target/release/ryokan /app/ +RUN cp target/release/sakura /app/ +RUN cp target/release/torii /app/ # --------------------------------------------------- diff --git a/dockerfiles/Dockerfile_sakura b/dockerfiles/Dockerfile_sakura index 6d2a1ec34..c2d8cc8bf 100644 --- a/dockerfiles/Dockerfile_sakura +++ b/dockerfiles/Dockerfile_sakura @@ -1,22 +1,33 @@ -FROM debian:12.12-slim@sha256:78d2f66e0fec9e5a39fb2c72ea5e052b548df75602b5215ed01a17171529f706 AS builder - -ARG DEBIAN_FRONTEND=noninteractive +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM kitsudaiki/ainari_build_base:0.1.0@sha256:24467cc617f19791b20719d1c826dd8f2db34aac55ed54dbb6263e6c64d29c74 AS builder WORKDIR /app -RUN apt-get update && \ - apt-get install -y protobuf-compiler \ - gcc \ - curl \ - pkg-config \ - libssl-dev \ - libsqlite3-dev && \ - curl https://sh.rustup.rs -sSf | sh -s -- -y - -COPY . . +COPY src src +COPY Cargo.toml Cargo.toml +COPY Cargo.lock Cargo.lock -RUN ~/.cargo/bin/cargo build --release -p sakura +RUN ~/.cargo/bin/cargo build --release +RUN cp target/release/hanami /app/ +RUN cp target/release/miko /app/ +RUN cp target/release/omamori /app/ +RUN cp target/release/onsen /app/ +RUN cp target/release/ryokan /app/ RUN cp target/release/sakura /app/ +RUN cp target/release/torii /app/ # --------------------------------------------------- diff --git a/dockerfiles/Dockerfile_torii b/dockerfiles/Dockerfile_torii index b4ab68b5e..93fa26f2b 100644 --- a/dockerfiles/Dockerfile_torii +++ b/dockerfiles/Dockerfile_torii @@ -1,21 +1,32 @@ -FROM debian:12.12-slim@sha256:78d2f66e0fec9e5a39fb2c72ea5e052b548df75602b5215ed01a17171529f706 AS builder - -ARG DEBIAN_FRONTEND=noninteractive +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM kitsudaiki/ainari_build_base:0.1.0@sha256:24467cc617f19791b20719d1c826dd8f2db34aac55ed54dbb6263e6c64d29c74 AS builder WORKDIR /app -RUN apt-get update && \ - apt-get install -y protobuf-compiler \ - gcc \ - curl \ - pkg-config \ - libssl-dev \ - libsqlite3-dev && \ - curl https://sh.rustup.rs -sSf | sh -s -- -y - -COPY . . - -RUN ~/.cargo/bin/cargo build --release -p torii +COPY src src +COPY Cargo.toml Cargo.toml +COPY Cargo.lock Cargo.lock + +RUN ~/.cargo/bin/cargo build --release +RUN cp target/release/hanami /app/ +RUN cp target/release/miko /app/ +RUN cp target/release/omamori /app/ +RUN cp target/release/onsen /app/ +RUN cp target/release/ryokan /app/ +RUN cp target/release/sakura /app/ RUN cp target/release/torii /app/ # --------------------------------------------------- diff --git a/docs/deployer/config/hanami_config.md b/docs/deployer/config/hanami_config.md index 4ef0a130e..fcba94d42 100644 --- a/docs/deployer/config/hanami_config.md +++ b/docs/deployer/config/hanami_config.md @@ -12,12 +12,12 @@ ### `api` Configuration -| Parameter | Type | Default | Description | -| ------------------ | ------- | ----------- | ----------------------------------------- | -| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | -| `public_port` | integer | `11418` | Port for public API access. | -| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | -| `internal_port` | integer | `10418` | Port for internal API access. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ----------- | ----------------------------------- | +| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | +| `public_port` | integer | `11418` | Port for public API access. | +| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | +| `internal_port` | integer | `10418` | Port for internal API access. | ### `database` Configuration diff --git a/docs/deployer/config/miko_config.md b/docs/deployer/config/miko_config.md index 4a8ecb233..7aae5e334 100644 --- a/docs/deployer/config/miko_config.md +++ b/docs/deployer/config/miko_config.md @@ -11,12 +11,12 @@ ### `api` Configuration -| Parameter | Type | Default | Description | -| ------------------ | ------- | ----------- | ----------------------------------------- | -| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | -| `public_port` | integer | `11417` | Port for public API access. | -| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | -| `internal_port` | integer | `10417` | Port for internal API access. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ----------- | ----------------------------------- | +| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | +| `public_port` | integer | `11417` | Port for public API access. | +| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | +| `internal_port` | integer | `10417` | Port for internal API access. | ### `database` Configuration diff --git a/docs/deployer/config/omamori_config.md b/docs/deployer/config/omamori_config.md index 3c96be476..51490a53c 100644 --- a/docs/deployer/config/omamori_config.md +++ b/docs/deployer/config/omamori_config.md @@ -12,12 +12,12 @@ ### `api` Configuration -| Parameter | Type | Default | Description | -| ------------------ | ------- | ----------- | ----------------------------------------- | -| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | -| `public_port` | integer | `11421` | Port for public API access. | -| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | -| `internal_port` | integer | `10421` | Port for internal API access. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ----------- | ----------------------------------- | +| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | +| `public_port` | integer | `11421` | Port for public API access. | +| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | +| `internal_port` | integer | `10421` | Port for internal API access. | ### `miko` Configuration diff --git a/docs/deployer/config/ryokan_config.md b/docs/deployer/config/ryokan_config.md index 35ecc623b..54f745698 100644 --- a/docs/deployer/config/ryokan_config.md +++ b/docs/deployer/config/ryokan_config.md @@ -12,12 +12,12 @@ ### `api` Configuration -| Parameter | Type | Default | Description | -| ------------------ | ------- | ----------- | ----------------------------------------- | -| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | -| `public_port` | integer | `11416` | Port for public API access. | -| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | -| `internal_port` | integer | `10416` | Port for internal API access. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ----------- | ----------------------------------- | +| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | +| `public_port` | integer | `11416` | Port for public API access. | +| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | +| `internal_port` | integer | `10416` | Port for internal API access. | ### `database` Configuration diff --git a/docs/deployer/config/sakura_config.md b/docs/deployer/config/sakura_config.md index d70f3da05..d20e2ccce 100644 --- a/docs/deployer/config/sakura_config.md +++ b/docs/deployer/config/sakura_config.md @@ -13,12 +13,12 @@ ### `api` Configuration -| Parameter | Type | Default | Description | -| ------------------ | ------- | ----------- | ----------------------------------------- | -| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | -| `public_port` | integer | `11420` | Port for public API access. | -| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | -| `internal_port` | integer | `10420` | Port for internal API access. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ----------- | ----------------------------------- | +| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | +| `public_port` | integer | `11420` | Port for public API access. | +| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | +| `internal_port` | integer | `10420` | Port for internal API access. | ### `database` Configuration diff --git a/docs/deployer/config/torii_config.md b/docs/deployer/config/torii_config.md index 7463f3f6a..655deaa2d 100644 --- a/docs/deployer/config/torii_config.md +++ b/docs/deployer/config/torii_config.md @@ -12,12 +12,12 @@ ### `api` Configuration -| Parameter | Type | Default | Description | -| ------------------ | ------- | ----------- | ----------------------------------------- | -| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | -| `public_port` | integer | `11419` | Port for public API access. | -| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | -| `internal_port` | integer | `10419` | Port for internal API access. | +| Parameter | Type | Default | Description | +| --------------- | ------- | ----------- | ----------------------------------- | +| `public_ip` | string | `"0.0.0.0"` | IP address for public API access. | +| `public_port` | integer | `11419` | Port for public API access. | +| `internal_ip` | string | `"0.0.0.0"` | IP address for internal API access. | +| `internal_port` | integer | `10419` | Port for internal API access. | ### `database` Configuration diff --git a/docs/developer/repo/build_base_image.md b/docs/developer/repo/build_base_image.md new file mode 100644 index 000000000..19cf07dcb --- /dev/null +++ b/docs/developer/repo/build_base_image.md @@ -0,0 +1,40 @@ +# Build base-image + +- Enable QEMU (for cross-architecture builds) + + ```bash + docker run --privileged --rm tonistiigi/binfmt --install all + ``` + + This lets your x64 machine build ARM images locally + +- Verify + + ```bash + docker buildx ls + ``` + + ( You should see linux/amd64 and linux/arm64. ) + +- Create and use a Buildx builder + + ```bash + docker buildx create --name multi-builder --use + docker buildx inspect --bootstrap + ``` + +- Login to Docker Hub + + ```bash + docker login + ``` + +- Build new base-image + + ```bash + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + -f dockerfiles/Dockerfile_build_base \ + -t kitsudaiki/ainari_build_base:0.1.0 \ + --push . + ``` diff --git a/docs/developer/repo/local_testing.md b/docs/developer/repo/local_testing.md new file mode 100644 index 000000000..95bbdfd2b --- /dev/null +++ b/docs/developer/repo/local_testing.md @@ -0,0 +1,118 @@ +# Local testing + +## Testing in multi-node kubernetes + +In the repository there is a Vagrantfile with connected minimalistic playbook, which creates 3 +locally hosted libvirt virtual machines, installes a k3s-kubernetes within these instances, +configures and installes ainari in there and runs the sdk-api-test against the setup. This +test-setup doesn't require docker-hub. At the beginning of the setup it build docker-images from the +local source code and pushes these local images direcly into the k3s-kubernetes without any +additional registry and also uses the local helm chart for the deployment within the kubernetes. +That way the code, dockerfiles, helm-charts and sdk-lib are tested in single automated workflow in a +virtual multi-node environment. + +### Minimal Requirements + +- **CPU**: 8 threads (better 16 threads to avoid cpu-overcommit) +- **Memory**: 14 GiB + +### Installation + +This installation uses Vagrant with libvirt as provider to deploy the virtual machines. + +- Install apt-packages necessary for libvirt and the libvirt-provider + + ```bash + sudo apt update + sudo apt install -y \ + qemu-kvm \ + libvirt-daemon-system \ + libvirt-clients \ + virtinst \ + bridge-utils \ + cpu-checker + build-essential \ + ruby-dev \ + pkg-config \ + libvirt-dev \ + libxml2-dev \ + libxslt-dev \ + zlib1g-dev \ + rsync + ``` + +- Enable and start libvirt: + + ```bash + sudo systemctl enable --now libvirtd + ``` + +- So you don’t need sudo every time + + ```bash + sudo usermod -aG libvirt,kvm $USER + ``` + + ( after this you have to logout and login again ) + +- Install the libvirt provider plugin + + ```bash + vagrant plugin install vagrant-libvirt + ``` + +- Update `/etc/hosts` by adding the content + + ```plain + 192.168.56.10 local-vagrant-hanami + 192.168.56.10 local-vagrant-miko + 192.168.56.10 local-vagrant-ryokan + 192.168.56.10 local-vagrant-sakura + 192.168.56.10 local-vagrant-torii + 192.168.56.10 local-vagrant-omamori + 192.168.56.10 local-vagrant-onsen + 192.168.56.10 local-vagrant-ainari + ``` + +- Install local ansible required to execute the playbook + + ```bash + python3 -m venv venv + source venv/bin/activate + pip3 install ansible + ``` + +### Usage + +#### Vagrant-actions: + +- create a complete new test-installation + + `vagrant up` + +- in case a run failed and you want to run it again or with updated playbooks against the same + already existing vagrant environment + + `vagrant provision` + +- ssh into server of the virtual machines + + `vagrant ssh server` + + with this you will enter the machine with the kubernetes api. It is only a minimalistic shell, so + run `/bin/bash` at first in there to get a real bash shell. There you can also run `kubectl` and + `helm` commands. + +- delete previous vagrant environment + + `vagrant destroy -f` + +#### access the dashboard + +After a finished `vagrant up`, enter the address `https://local-vagrant-ainari` into your browser +and you should see the dashboard + +Login: + +- **user**: `asdf` +- **password**: `asdfasdf` diff --git a/mkdocs.yml b/mkdocs.yml index 16aceba29..92029a520 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -69,6 +69,7 @@ nav: - Repo: - developer/repo/repo_structure.md - developer/repo/build_guide.md + - developer/repo/local_testing.md - developer/repo/development.md - developer/repo/dependencies.md - developer/repo/git_workflow.md diff --git a/scripts/build_docker_images.sh b/scripts/build_docker_images.sh new file mode 100755 index 000000000..b7b6cd6a1 --- /dev/null +++ b/scripts/build_docker_images.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +docker build -f dockerfiles/Dockerfile_ainari_base -t kitsudaiki/ainari_base:latest . + +docker build -f dockerfiles/Dockerfile_hanami -t kitsudaiki/hanami:local_test . +docker build -f dockerfiles/Dockerfile_miko -t kitsudaiki/miko:local_test . +docker build -f dockerfiles/Dockerfile_omamori -t kitsudaiki/omamori:local_test . +docker build -f dockerfiles/Dockerfile_onsen -t kitsudaiki/onsen:local_test . +docker build -f dockerfiles/Dockerfile_ryokan -t kitsudaiki/ryokan:local_test . +docker build -f dockerfiles/Dockerfile_sakura -t kitsudaiki/sakura:local_test . +docker build -f dockerfiles/Dockerfile_torii -t kitsudaiki/torii:local_test . +docker build -f dockerfiles/Dockerfile_dashboard -t kitsudaiki/ainari_dashboard:local_test . + +mkdir -p temporary_files +docker save -o temporary_files/ainari_docker_files.tar \ + kitsudaiki/hanami:local_test \ + kitsudaiki/miko:local_test \ + kitsudaiki/omamori:local_test \ + kitsudaiki/onsen:local_test \ + kitsudaiki/ryokan:local_test \ + kitsudaiki/sakura:local_test \ + kitsudaiki/torii:local_test \ + kitsudaiki/ainari_dashboard:local_test diff --git a/scripts/collect-api-specs.sh b/scripts/collect-api-specs.sh index efe9dbea7..2a3dc0e85 100755 --- a/scripts/collect-api-specs.sh +++ b/scripts/collect-api-specs.sh @@ -1,5 +1,19 @@ #!/bin/bash +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + curl 127.0.0.1:11417/openapi.json | jq > ./docs/user/rest_api/open_api_docu_miko.json curl 127.0.0.1:11416/openapi.json | jq > ./docs/user/rest_api/open_api_docu_ryokan.json curl 127.0.0.1:11418/openapi.json | jq > ./docs/user/rest_api/open_api_docu_hanami.json diff --git a/src/cli/ainarictl/common/output_parsing.go b/src/cli/ainarictl/common/output_parsing.go index 3f72a4cca..3ff0bde94 100644 --- a/src/cli/ainarictl/common/output_parsing.go +++ b/src/cli/ainarictl/common/output_parsing.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/main.go b/src/cli/ainarictl/main.go index c974c5cc0..c6bd2611d 100644 --- a/src/cli/ainarictl/main.go +++ b/src/cli/ainarictl/main.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/checkpoint.go b/src/cli/ainarictl/resources/checkpoint.go index 5502d9acd..006f25b62 100644 --- a/src/cli/ainarictl/resources/checkpoint.go +++ b/src/cli/ainarictl/resources/checkpoint.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/cluster.go b/src/cli/ainarictl/resources/cluster.go index b0d5e08ae..9909c6eea 100644 --- a/src/cli/ainarictl/resources/cluster.go +++ b/src/cli/ainarictl/resources/cluster.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/common.go b/src/cli/ainarictl/resources/common.go index 2420f41e0..bde9abf51 100644 --- a/src/cli/ainarictl/resources/common.go +++ b/src/cli/ainarictl/resources/common.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/dataset.go b/src/cli/ainarictl/resources/dataset.go index 72ae377dd..f05fc2680 100644 --- a/src/cli/ainarictl/resources/dataset.go +++ b/src/cli/ainarictl/resources/dataset.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/host.go b/src/cli/ainarictl/resources/host.go index eeb6b69f0..3b84ee206 100644 --- a/src/cli/ainarictl/resources/host.go +++ b/src/cli/ainarictl/resources/host.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/login.go b/src/cli/ainarictl/resources/login.go index b7b36eb7f..cc47ebb0a 100644 --- a/src/cli/ainarictl/resources/login.go +++ b/src/cli/ainarictl/resources/login.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/project.go b/src/cli/ainarictl/resources/project.go index 10fcfde1e..8e339394a 100644 --- a/src/cli/ainarictl/resources/project.go +++ b/src/cli/ainarictl/resources/project.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/proxy.go b/src/cli/ainarictl/resources/proxy.go index 66539ac39..8c165f049 100644 --- a/src/cli/ainarictl/resources/proxy.go +++ b/src/cli/ainarictl/resources/proxy.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/quota.go b/src/cli/ainarictl/resources/quota.go index e449d6d68..fde93ed53 100644 --- a/src/cli/ainarictl/resources/quota.go +++ b/src/cli/ainarictl/resources/quota.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/secret.go b/src/cli/ainarictl/resources/secret.go index ca8d7717e..0cf0124ba 100644 --- a/src/cli/ainarictl/resources/secret.go +++ b/src/cli/ainarictl/resources/secret.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/task.go b/src/cli/ainarictl/resources/task.go index cbf6f0ae1..30ef78401 100644 --- a/src/cli/ainarictl/resources/task.go +++ b/src/cli/ainarictl/resources/task.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/cli/ainarictl/resources/user.go b/src/cli/ainarictl/resources/user.go index 50a8a4261..29b897923 100644 --- a/src/cli/ainarictl/resources/user.go +++ b/src/cli/ainarictl/resources/user.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/dashboard/app/src/styles/base.css b/src/dashboard/app/src/styles/base.css index c6f4a048f..6a72d902c 100644 --- a/src/dashboard/app/src/styles/base.css +++ b/src/dashboard/app/src/styles/base.css @@ -1,6 +1,6 @@ /* Apache License Version 2.0 -Copyright 2022 Tobias Anker +Copyright 2022 Tobias Anker Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/dashboard/app/src/styles/button.css b/src/dashboard/app/src/styles/button.css index 2aa815dc0..78d5a6123 100644 --- a/src/dashboard/app/src/styles/button.css +++ b/src/dashboard/app/src/styles/button.css @@ -1,6 +1,6 @@ /* Apache License Version 2.0 -Copyright 2022 Tobias Anker +Copyright 2022 Tobias Anker Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/dashboard/app/src/styles/card.css b/src/dashboard/app/src/styles/card.css index cd7ad7af4..e8e766f52 100644 --- a/src/dashboard/app/src/styles/card.css +++ b/src/dashboard/app/src/styles/card.css @@ -1,6 +1,6 @@ /* Apache License Version 2.0 -Copyright 2022 Tobias Anker +Copyright 2022 Tobias Anker Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/dashboard/app/src/styles/devider.css b/src/dashboard/app/src/styles/devider.css index 94df675f2..5fba8d158 100644 --- a/src/dashboard/app/src/styles/devider.css +++ b/src/dashboard/app/src/styles/devider.css @@ -1,6 +1,6 @@ /* Apache License Version 2.0 -Copyright 2022 Tobias Anker +Copyright 2022 Tobias Anker Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/dashboard/app/src/styles/dropdown.css b/src/dashboard/app/src/styles/dropdown.css index f094b537c..7ad1d49d8 100644 --- a/src/dashboard/app/src/styles/dropdown.css +++ b/src/dashboard/app/src/styles/dropdown.css @@ -1,6 +1,6 @@ /* Apache License Version 2.0 -Copyright 2022 Tobias Anker +Copyright 2022 Tobias Anker Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/dashboard/app/src/styles/modal.css b/src/dashboard/app/src/styles/modal.css index 303a8d86a..eedba48c1 100644 --- a/src/dashboard/app/src/styles/modal.css +++ b/src/dashboard/app/src/styles/modal.css @@ -1,6 +1,6 @@ /* Apache License Version 2.0 -Copyright 2022 Tobias Anker +Copyright 2022 Tobias Anker Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/dashboard/app/src/styles/other.css b/src/dashboard/app/src/styles/other.css index 08fdcf120..af8d0a695 100644 --- a/src/dashboard/app/src/styles/other.css +++ b/src/dashboard/app/src/styles/other.css @@ -1,6 +1,6 @@ /* Apache License Version 2.0 -Copyright 2022 Tobias Anker +Copyright 2022 Tobias Anker Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/dashboard/app/src/styles/primevue_overrides.css b/src/dashboard/app/src/styles/primevue_overrides.css index 1b1146d5b..208960e58 100644 --- a/src/dashboard/app/src/styles/primevue_overrides.css +++ b/src/dashboard/app/src/styles/primevue_overrides.css @@ -1,6 +1,6 @@ /* Apache License Version 2.0 -Copyright 2022 Tobias Anker +Copyright 2022 Tobias Anker Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/dashboard/app/src/styles/slider.css b/src/dashboard/app/src/styles/slider.css index 28fbf1928..d17880c9a 100644 --- a/src/dashboard/app/src/styles/slider.css +++ b/src/dashboard/app/src/styles/slider.css @@ -1,6 +1,6 @@ /* Apache License Version 2.0 -Copyright 2022 Tobias Anker +Copyright 2022 Tobias Anker Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/dashboard/app/src/styles/tab.css b/src/dashboard/app/src/styles/tab.css index 863deda83..9c146b1b4 100644 --- a/src/dashboard/app/src/styles/tab.css +++ b/src/dashboard/app/src/styles/tab.css @@ -1,6 +1,6 @@ /* Apache License Version 2.0 -Copyright 2022 Tobias Anker +Copyright 2022 Tobias Anker Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/dashboard/app/src/styles/table.css b/src/dashboard/app/src/styles/table.css index 7ec502bec..7f27defbb 100644 --- a/src/dashboard/app/src/styles/table.css +++ b/src/dashboard/app/src/styles/table.css @@ -1,6 +1,6 @@ /* Apache License Version 2.0 -Copyright 2022 Tobias Anker +Copyright 2022 Tobias Anker Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/access_context.go b/src/sdk/go/ainari_sdk/access_context.go index 78174d623..14e266f8e 100644 --- a/src/sdk/go/ainari_sdk/access_context.go +++ b/src/sdk/go/ainari_sdk/access_context.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/checkpoint.go b/src/sdk/go/ainari_sdk/checkpoint.go index 8dba12e3f..57fbfed28 100644 --- a/src/sdk/go/ainari_sdk/checkpoint.go +++ b/src/sdk/go/ainari_sdk/checkpoint.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/cluster.go b/src/sdk/go/ainari_sdk/cluster.go index c959bb9e9..1aafe5b3d 100644 --- a/src/sdk/go/ainari_sdk/cluster.go +++ b/src/sdk/go/ainari_sdk/cluster.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/common.go b/src/sdk/go/ainari_sdk/common.go index 82e3574e8..b7fbd948a 100644 --- a/src/sdk/go/ainari_sdk/common.go +++ b/src/sdk/go/ainari_sdk/common.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/dataset.go b/src/sdk/go/ainari_sdk/dataset.go index d70306f16..923f24eb7 100644 --- a/src/sdk/go/ainari_sdk/dataset.go +++ b/src/sdk/go/ainari_sdk/dataset.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/host.go b/src/sdk/go/ainari_sdk/host.go index 8efe79fee..0b27efd12 100644 --- a/src/sdk/go/ainari_sdk/host.go +++ b/src/sdk/go/ainari_sdk/host.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/http_request.go b/src/sdk/go/ainari_sdk/http_request.go index 58df20af6..24033a456 100644 --- a/src/sdk/go/ainari_sdk/http_request.go +++ b/src/sdk/go/ainari_sdk/http_request.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/project.go b/src/sdk/go/ainari_sdk/project.go index 48e10a9d5..7de8c1010 100644 --- a/src/sdk/go/ainari_sdk/project.go +++ b/src/sdk/go/ainari_sdk/project.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/proxy.go b/src/sdk/go/ainari_sdk/proxy.go index 5fa109922..63a861c26 100644 --- a/src/sdk/go/ainari_sdk/proxy.go +++ b/src/sdk/go/ainari_sdk/proxy.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/quota.go b/src/sdk/go/ainari_sdk/quota.go index fa86504ac..132f35c82 100644 --- a/src/sdk/go/ainari_sdk/quota.go +++ b/src/sdk/go/ainari_sdk/quota.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/secret.go b/src/sdk/go/ainari_sdk/secret.go index 51ecab869..2591d4c66 100644 --- a/src/sdk/go/ainari_sdk/secret.go +++ b/src/sdk/go/ainari_sdk/secret.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/task.go b/src/sdk/go/ainari_sdk/task.go index 3761ae46e..0ed9473d3 100644 --- a/src/sdk/go/ainari_sdk/task.go +++ b/src/sdk/go/ainari_sdk/task.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/token.go b/src/sdk/go/ainari_sdk/token.go index 44e1f1d36..fb0e03206 100644 --- a/src/sdk/go/ainari_sdk/token.go +++ b/src/sdk/go/ainari_sdk/token.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/go/ainari_sdk/user.go b/src/sdk/go/ainari_sdk/user.go index 8301e5d93..07758757e 100644 --- a/src/sdk/go/ainari_sdk/user.go +++ b/src/sdk/go/ainari_sdk/user.go @@ -3,7 +3,7 @@ * * @copyright Apache License Version 2.0 * - * Copyright 2022 Tobias Anker + * Copyright 2022 Tobias Anker * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/access_context.py b/src/sdk/python/ainari_sdk/ainari_sdk/access_context.py index 736e67d11..dd8e0fa61 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/access_context.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/access_context.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/ainari_exceptions.py b/src/sdk/python/ainari_sdk/ainari_sdk/ainari_exceptions.py index 7d4eefabb..9f11e8656 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/ainari_exceptions.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/ainari_exceptions.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/ainari_request.py b/src/sdk/python/ainari_sdk/ainari_sdk/ainari_request.py index ce3db5aa4..891ec8a85 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/ainari_request.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/ainari_request.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/checkpoint.py b/src/sdk/python/ainari_sdk/ainari_sdk/checkpoint.py index bfe019767..ed5ac79a8 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/checkpoint.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/checkpoint.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/cluster.py b/src/sdk/python/ainari_sdk/ainari_sdk/cluster.py index ea0df1a4b..3d6ad3bd3 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/cluster.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/cluster.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/common.py b/src/sdk/python/ainari_sdk/ainari_sdk/common.py index 3730c3826..faf63f3ee 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/common.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/common.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/dataset.py b/src/sdk/python/ainari_sdk/ainari_sdk/dataset.py index 7d11f00cb..45a8123d0 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/dataset.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/dataset.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/host.py b/src/sdk/python/ainari_sdk/ainari_sdk/host.py index e2cdb07f7..d6612579e 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/host.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/host.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/login.py b/src/sdk/python/ainari_sdk/ainari_sdk/login.py index d976be21b..ce95e5d1f 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/login.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/login.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/logs.py b/src/sdk/python/ainari_sdk/ainari_sdk/logs.py index 723ba9550..3c61b523f 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/logs.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/logs.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/project.py b/src/sdk/python/ainari_sdk/ainari_sdk/project.py index 176f27ac1..8af621256 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/project.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/project.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/proxy.py b/src/sdk/python/ainari_sdk/ainari_sdk/proxy.py index d7cd97d5a..04cfeab46 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/proxy.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/proxy.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/quota.py b/src/sdk/python/ainari_sdk/ainari_sdk/quota.py index 39fa9fb9c..fc8ad530a 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/quota.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/quota.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/secret.py b/src/sdk/python/ainari_sdk/ainari_sdk/secret.py index a45a7ce4d..f65d4c121 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/secret.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/secret.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/task.py b/src/sdk/python/ainari_sdk/ainari_sdk/task.py index a5ce6f398..a68674213 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/task.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/task.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/sdk/python/ainari_sdk/ainari_sdk/user.py b/src/sdk/python/ainari_sdk/ainari_sdk/user.py index 2ac702193..bfd7bc24b 100644 --- a/src/sdk/python/ainari_sdk/ainari_sdk/user.py +++ b/src/sdk/python/ainari_sdk/ainari_sdk/user.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/testing/python_sdk_api/measure_tests.py b/testing/python_sdk_api/measure_tests.py index 2f48491d8..6a63a9a86 100755 --- a/testing/python_sdk_api/measure_tests.py +++ b/testing/python_sdk_api/measure_tests.py @@ -1,6 +1,6 @@ #!python3 -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. diff --git a/testing/python_sdk_api/sdk_api_test.py b/testing/python_sdk_api/sdk_api_test.py index fa6d831d7..15f614ca2 100755 --- a/testing/python_sdk_api/sdk_api_test.py +++ b/testing/python_sdk_api/sdk_api_test.py @@ -1,6 +1,6 @@ #!python3 -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. diff --git a/testing/python_sdk_api/test_values.py b/testing/python_sdk_api/test_values.py index ff37fe4a5..b258ae1ff 100644 --- a/testing/python_sdk_api/test_values.py +++ b/testing/python_sdk_api/test_values.py @@ -1,4 +1,4 @@ -# Copyright 2022 Tobias Anker +# Copyright 2022 Tobias Anker # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. diff --git a/testing/vagrant/hanami_testing.conf b/testing/vagrant/hanami_testing.conf new file mode 100644 index 000000000..033f14f64 --- /dev/null +++ b/testing/vagrant/hanami_testing.conf @@ -0,0 +1,10 @@ +[connection] +miko_address = https://local-vagrant-miko +test_user = asdf +test_passphrase = asdfasdf + +[test_data] +train_inputs = /tmp/train-images-idx3-ubyte +train_labels = /tmp/train-labels-idx1-ubyte +request_inputs = /tmp/t10k-images-idx3-ubyte +request_labels = /tmp/t10k-labels-idx1-ubyte diff --git a/testing/vagrant/ingress-nginx-controller.yaml b/testing/vagrant/ingress-nginx-controller.yaml new file mode 100644 index 000000000..feb442194 --- /dev/null +++ b/testing/vagrant/ingress-nginx-controller.yaml @@ -0,0 +1,23 @@ +--- + +apiVersion: v1 +kind: Service +metadata: + name: ingress-nginx-controller-loadbalancer + namespace: ingress-nginx +spec: + selector: + app.kubernetes.io/component: controller + app.kubernetes.io/instance: ingress-nginx + app.kubernetes.io/name: ingress-nginx + ports: + - name: http + port: 80 + protocol: TCP + targetPort: 80 + - name: https + port: 443 + protocol: TCP + targetPort: 443 + type: LoadBalancer + loadBalancerIP: 192.168.56.10 diff --git a/testing/vagrant/playbook.yaml b/testing/vagrant/playbook.yaml new file mode 100755 index 000000000..df04c89be --- /dev/null +++ b/testing/vagrant/playbook.yaml @@ -0,0 +1,364 @@ +# Copyright 2022 Tobias Anker +# +# Licensed under the Apache License, Version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +- name: Install k3s server + hosts: k3s_server + become: true + tasks: + - name: Install k3s server + ansible.builtin.shell: curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable traefik" sh - + args: + creates: /usr/local/bin/k3s + + - name: Wait for k3s node token to exist + wait_for: + path: /var/lib/rancher/k3s/server/node-token + timeout: 120 + +- name: Install k3s agents + hosts: k3s_agents + become: true + vars: + k3s_server_host: "{{ groups['k3s_server'][0] }}" + tasks: + - name: Wait for k3s node token on server + wait_for: + path: /var/lib/rancher/k3s/server/node-token + timeout: 180 + delegate_to: "{{ k3s_server_host }}" + run_once: true + + - name: Read k3s token from server + command: cat /var/lib/rancher/k3s/server/node-token + delegate_to: "{{ k3s_server_host }}" + register: k3s_token + changed_when: false + run_once: true + + - name: Install k3s agent + ansible.builtin.shell: | + curl -sfL https://get.k3s.io | \ + K3S_URL=https://{{ hostvars[k3s_server_host].ansible_host }}:6443 \ + K3S_TOKEN={{ k3s_token.stdout }} sh - + args: + creates: /usr/local/bin/k3s-agent + + - name: Install rsync for the next step + apt: + name: rsync + state: present + update_cache: true + + - name: Ensure /opt/app exists + file: + path: /opt/app + state: directory + owner: root + group: root + mode: "0755" + + - name: Copy selected subdirectories + synchronize: + src: "{{ playbook_dir }}/../../{{ item }}" + dest: /opt/app/ + recursive: true + loop: + - temporary_files + + - name: Load pre-build docker-images into the k3s cache + ansible.builtin.shell: ctr -n k8s.io images import /opt/app/temporary_files/ainari_docker_files.tar + + +- name: Install all on the server + hosts: k3s_server + become: true + vars: + cert_manager_namespace: cert-manager + cert_manager_version: v1.14.4 + tasks: + - name: Wait until all k3s nodes are registered and Ready + ansible.builtin.shell: | + kubectl get nodes --no-headers | awk '{print $2}' | grep -v Ready || true + register: node_status + retries: 30 + delay: 10 + until: node_status.stdout == "" + + - name: Wait for Kubernetes API to be ready + ansible.builtin.shell: | + kubectl get nodes + register: kubectl_ready + retries: 20 + delay: 10 + until: kubectl_ready.rc == 0 + + - name: Install kubectl (from k3s) + file: + src: /usr/local/bin/k3s + dest: /usr/local/bin/kubectl + state: link + + - name: Install Helm + ansible.builtin.shell: | + curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash + args: + creates: /usr/local/bin/helm + + - name: Ensure kubeconfig is usable for root + file: + path: /etc/rancher/k3s/k3s.yaml + mode: "0644" + + - name: Ensure .kube directory exists for vagrant user + file: + path: /home/vagrant/.kube + state: directory + owner: vagrant + group: vagrant + mode: "0755" + + - name: Copy kubeconfig to vagrant home + copy: + src: /etc/rancher/k3s/k3s.yaml + dest: /home/vagrant/.kube/config + remote_src: true + owner: vagrant + group: vagrant + mode: "0644" + + - name: Fix kubeconfig server address (use node IP) + replace: + path: /home/vagrant/.kube/config + regexp: 'https://127.0.0.1:6443' + replace: "https://{{ ansible_facts['default_ipv4']['address'] }}:6443" + + - name: Install Docker + apt: + name: + - docker.io + state: present + update_cache: true + + - name: Enable and start Docker + systemd: + name: docker + enabled: true + state: started + + - name: Install rsync for the next step + apt: + name: rsync + state: present + update_cache: true + + - name: Ensure /opt/app exists + file: + path: /opt/app + state: directory + owner: root + group: root + mode: "0755" + + - name: Copy selected subdirectories + synchronize: + src: "{{ playbook_dir }}/../../{{ item }}" + dest: /opt/app/ + recursive: true + loop: + - src + - deploy + - dockerfiles + - scripts + - testing + - temporary_files + + - name: Load pre-build docker-images into the k3s cache + ansible.builtin.shell: ctr -n k8s.io images import /opt/app/temporary_files/ainari_docker_files.tar + + - name: Install nginx-ingress + ansible.builtin.shell: | + kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/baremetal/deploy.yaml + kubectl apply -f /opt/app/testing/vagrant/ingress-nginx-controller.yaml + + - name: Add Jetstack Helm repo + command: helm repo add jetstack https://charts.jetstack.io + changed_when: false + + - name: Update Helm repositories + command: helm repo update + changed_when: false + + - name: Ensure cert-manager namespace exists + ansible.builtin.shell: | + kubectl get namespace cert-manager || kubectl create namespace cert-manager + + - name: Install cert-manager CRDs + ansible.builtin.shell: kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.4/cert-manager.crds.yaml + + - name: Install cert-manager Helm chart + ansible.builtin.shell: helm upgrade --install cert-manager jetstack/cert-manager --namespace cert-manager --version v1.14.4 --wait + environment: + KUBECONFIG: /etc/rancher/k3s/k3s.yaml + + - name: Install WireGuard tools + apt: + name: wireguard-tools + state: present + update_cache: true + + - name: Ensure Python 3 pip and packaging are installed + apt: + name: + - python3-pip + - python3-venv + - python3-packaging + state: present + update_cache: true + + - name: Create Python virtual environment + ansible.builtin.shell: python3 -m venv .venv + args: + chdir: "{{ ansible_env.HOME }}" + creates: "{{ ansible_env.HOME }}/.venv" + + - name: Install Jinja2 in the virtual environment + pip: + name: jinja2 + virtualenv: "{{ ansible_env.HOME }}/.venv" + + - name: Create wireguard-certs + ansible.builtin.shell: python3 wg_gen.py + args: + chdir: "/opt/app/deploy/k8s" + + - name: Ensure cert-manager namespace exists + ansible.builtin.shell: | + kubectl label nodes {{ item }} hanami-node=true + kubectl label nodes {{ item }} miko-node=true + kubectl label nodes {{ item }} ryokan-node=true + kubectl label nodes {{ item }} sakura-node=true + kubectl label nodes {{ item }} torii-node=true + kubectl label nodes {{ item }} omamori-node=true + kubectl label nodes {{ item }} onsen-node=true + kubectl label nodes {{ item }} ainari-dashboard-node=true + loop: + - server + - agent1 + - agent2 + + - name: Check if Helm release of ainari exists + ansible.builtin.command: + cmd: helm status ainari + register: helm_status + failed_when: false + changed_when: false + environment: + KUBECONFIG: /etc/rancher/k3s/k3s.yaml + + - name: Install ainari + ansible.builtin.shell: helm install ainari ./ainari/ -f /opt/app/testing/vagrant/test_values.yaml + args: + chdir: "/opt/app/deploy/k8s" + environment: + KUBECONFIG: /etc/rancher/k3s/k3s.yaml + when: helm_status.rc != 0 + + - name: Upgrade ainari + ansible.builtin.shell: helm upgrade ainari ./ainari/ -f /opt/app/testing/vagrant/test_values.yaml + args: + chdir: "/opt/app/deploy/k8s" + environment: + KUBECONFIG: /etc/rancher/k3s/k3s.yaml + when: helm_status.rc == 0 + + - name: Add entries for the services to the /etc/hosts + ansible.builtin.blockinfile: + path: /etc/hosts + marker: "# {mark} ANSIBLE MANAGED HOSTS" + block: | + 192.168.56.10 local-vagrant-hanami + 192.168.56.10 local-vagrant-miko + 192.168.56.10 local-vagrant-ryokan + 192.168.56.10 local-vagrant-sakura + 192.168.56.10 local-vagrant-torii + 192.168.56.10 local-vagrant-omamori + 192.168.56.10 local-vagrant-onsen + 192.168.56.10 local-vagrant-ainari + + - name: Ensure target directory for test-config exists + ansible.builtin.file: + path: /etc/ainari + state: directory + mode: '0755' + owner: vagrant + group: vagrant + + - name: Copy test-config to target-directory + copy: + src: /opt/app/testing/vagrant/hanami_testing.conf + dest: /etc/ainari/hanami_testing.conf + remote_src: true + owner: vagrant + group: vagrant + mode: "0644" + + - name: Check if mnist-test-files are already downloaded + ansible.builtin.stat: + path: "{{ item }}" + loop: + - /tmp/train-images-idx3-ubyte + - /tmp/train-labels-idx1-ubyte + - /tmp/t10k-images-idx3-ubyte + - /tmp/t10k-labels-idx1-ubyte + register: minst_file_stats + + - name: Download MNIST-files + ansible.builtin.shell: | + wget https://storage.googleapis.com/cvdf-datasets/mnist/train-images-idx3-ubyte.gz + wget https://storage.googleapis.com/cvdf-datasets/mnist/train-labels-idx1-ubyte.gz + wget https://storage.googleapis.com/cvdf-datasets/mnist/t10k-images-idx3-ubyte.gz + wget https://storage.googleapis.com/cvdf-datasets/mnist/t10k-labels-idx1-ubyte.gz + gzip -d train-images-idx3-ubyte.gz + gzip -d train-labels-idx1-ubyte.gz + gzip -d t10k-images-idx3-ubyte.gz + gzip -d t10k-labels-idx1-ubyte.gz + args: + chdir: "/tmp/" + when: > + minst_file_stats.results + | selectattr('stat.exists') + | list + | length == 0 + + - name: Install airnari-sdk + pip: + name: /opt/app/src/sdk/python/ainari_sdk + # requirements: /opt/app/src/sdk/python/ainari_sdk/requirements.txt + virtualenv: "{{ ansible_env.HOME }}/.venv" + + - name: Sleep to ensure that the kuberentes-services are up and running + pause: + seconds: 60 + + - name: Run sdk-api-tests + block: + - name: Run sdk-api-tests + ansible.builtin.shell: "{{ ansible_env.HOME }}/.venv/bin/python sdk_api_test.py" + register: cmd_result + args: + chdir: "/opt/app/testing/python_sdk_api" + always: + # print output of the sdk-api-test as plain text + - debug: var=cmd_result.stdout_lines diff --git a/testing/vagrant/test_values.yaml b/testing/vagrant/test_values.yaml new file mode 100644 index 000000000..33d99ca11 --- /dev/null +++ b/testing/vagrant/test_values.yaml @@ -0,0 +1,21 @@ +docker: + tag: "local_test" + pull_policy: "Never" + +user: + id: "asdf" + name: "asdf" + passphrase: "asdfasdf" + +token: + data: "this-is-a-test" + +api: + domain_sakura: local-vagrant-sakura + domain_miko: local-vagrant-miko + domain_ryokan: local-vagrant-ryokan + domain_torii: local-vagrant-torii + domain_hanami: local-vagrant-hanami + domain_omamori: local-vagrant-omamori + domain_onsen: local-vagrant-onsen + domain_dashboard: local-vagrant-ainari