From f87ec638e40c63016e0c1ccba2322893a67a26a1 Mon Sep 17 00:00:00 2001 From: Schubert Anselme Date: Mon, 4 Nov 2024 11:25:40 -0500 Subject: [PATCH] chore: Update project dependencies (#16) Signed-off-by: Schubert Anselme --- .bashrc | 1 - .devcontainer/.onCreateCommandMarker | 1 - .devcontainer/.postCreateCommandMarker | 1 - .devcontainer/.updateContentCommandMarker | 1 - .editorconfig | 23 +- .github/workflows/build.yml | 37 --- .gitignore | 2 +- .gitmodules | 9 +- .idea | 1 - .vscode | 1 - .zshrc | 1 - build/img/Dockerfile | 37 --- config/Brewfile | 1 + config/gitconfig | 1 + config/kind.yaml | 30 +-- config/systemd/journal-to-tty.service | 13 -- config/systemd/x11vnc.service | 9 - hack/bashrc | 117 ---------- hack/boilerplate.txt | 2 +- hack/certificate.yaml | 13 -- hack/cl.yaml | 19 -- hack/cluster | 1 + hack/clusterissuer.yaml | 7 - hack/compose-dev.yaml | 23 -- hack/config.yaml | 70 ------ hack/env.example | 2 - hack/gateway.yaml | 28 --- hack/kustomization.yaml | 8 - hack/lb.yaml | 19 -- hack/manifest | 1 + hack/pod.yaml | 1 + hack/run | 46 ---- modules/dotfiles | 2 +- modules/tooling | 2 +- scripts/aliases.sh | 2 +- scripts/config-devos.sh | 50 ---- scripts/configure.sh | 2 +- scripts/environment.sh | 2 +- scripts/gencert.sh | 1 + scripts/init-devos.sh | 267 ---------------------- scripts/install | 2 +- tools/quickstart | 1 + 42 files changed, 43 insertions(+), 814 deletions(-) delete mode 120000 .bashrc delete mode 100644 .devcontainer/.onCreateCommandMarker delete mode 100644 .devcontainer/.postCreateCommandMarker delete mode 100644 .devcontainer/.updateContentCommandMarker mode change 120000 => 100644 .editorconfig delete mode 100644 .github/workflows/build.yml delete mode 120000 .idea delete mode 120000 .vscode delete mode 120000 .zshrc delete mode 100644 build/img/Dockerfile create mode 120000 config/Brewfile create mode 120000 config/gitconfig mode change 100644 => 120000 config/kind.yaml delete mode 100644 config/systemd/journal-to-tty.service delete mode 100644 config/systemd/x11vnc.service delete mode 100644 hack/bashrc mode change 100644 => 120000 hack/boilerplate.txt delete mode 100644 hack/certificate.yaml delete mode 100644 hack/cl.yaml create mode 120000 hack/cluster delete mode 100644 hack/clusterissuer.yaml delete mode 100644 hack/compose-dev.yaml delete mode 100644 hack/config.yaml delete mode 100644 hack/env.example delete mode 100644 hack/gateway.yaml delete mode 100644 hack/kustomization.yaml delete mode 100644 hack/lb.yaml create mode 120000 hack/manifest create mode 120000 hack/pod.yaml delete mode 100755 hack/run delete mode 100755 scripts/config-devos.sh create mode 120000 scripts/gencert.sh delete mode 100755 scripts/init-devos.sh create mode 120000 tools/quickstart diff --git a/.bashrc b/.bashrc deleted file mode 120000 index 0f5757b..0000000 --- a/.bashrc +++ /dev/null @@ -1 +0,0 @@ -modules/dotfiles/.bashrc \ No newline at end of file diff --git a/.devcontainer/.onCreateCommandMarker b/.devcontainer/.onCreateCommandMarker deleted file mode 100644 index b20434d..0000000 --- a/.devcontainer/.onCreateCommandMarker +++ /dev/null @@ -1 +0,0 @@ -2024-11-03T10:35:08.497977799Z diff --git a/.devcontainer/.postCreateCommandMarker b/.devcontainer/.postCreateCommandMarker deleted file mode 100644 index b20434d..0000000 --- a/.devcontainer/.postCreateCommandMarker +++ /dev/null @@ -1 +0,0 @@ -2024-11-03T10:35:08.497977799Z diff --git a/.devcontainer/.updateContentCommandMarker b/.devcontainer/.updateContentCommandMarker deleted file mode 100644 index b20434d..0000000 --- a/.devcontainer/.updateContentCommandMarker +++ /dev/null @@ -1 +0,0 @@ -2024-11-03T10:35:08.497977799Z diff --git a/.editorconfig b/.editorconfig deleted file mode 120000 index efbc18b..0000000 --- a/.editorconfig +++ /dev/null @@ -1 +0,0 @@ -modules/dotfiles/.editorconfig \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b40e48e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,22 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# http://editorconfig.org + +root = true + +[*] +# We recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +# Change these settings to your own preference +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index d3ce519..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build Pipeline - -on: - push: - paths: - - build/img/** - - build/scripts/init-devos.sh - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} - -permissions: read-all - -jobs: - container: - runs-on: ubuntu-latest - permissions: - contents: read - pages: write - id-token: write - steps: - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7 https://github.com/actions/checkout/commit/692973e3d937129bcbf40652eb9f2f61becf3332 - with: - fetch-depth: 0 - persist-credentials: false - - name: Build Container - uses: ./.github/actions/build - with: - build-container-image: true - container-image-file: build/img/Dockerfile - container-image-name: devos - container-image-platforms: linux/amd64,linux/arm64,linux/riscv64 - container-image-repo-password: ${{ secrets.GHCR_TOKEN }} - container-image-repo-username: ${{ github.repository_owner }} - push-container-image: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }} diff --git a/.gitignore b/.gitignore index 16e3063..f343351 100644 --- a/.gitignore +++ b/.gitignore @@ -157,7 +157,7 @@ fabric.properties *.vsix # Project files -.*/ +.* .env !.devcontainer/ !.github/ diff --git a/.gitmodules b/.gitmodules index 526aa95..4ab8355 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,7 @@ [submodule "modules/dotfiles"] - path = modules/dotfiles - url = https://github.com/anselmes/dotfiles.git + path = modules/dotfiles + url = https://github.com/anselmes/dotfiles.git [submodule "modules/tooling"] - path = modules/tooling - url = git@github.com:anselmes/tooling.git + path = modules/tooling + url = https://github.com/anselmes/tooling.git + diff --git a/.idea b/.idea deleted file mode 120000 index 9530425..0000000 --- a/.idea +++ /dev/null @@ -1 +0,0 @@ -modules/dotfiles/.idea \ No newline at end of file diff --git a/.vscode b/.vscode deleted file mode 120000 index 69e37ee..0000000 --- a/.vscode +++ /dev/null @@ -1 +0,0 @@ -modules/dotfiles/.vscode \ No newline at end of file diff --git a/.zshrc b/.zshrc deleted file mode 120000 index 5059e7f..0000000 --- a/.zshrc +++ /dev/null @@ -1 +0,0 @@ -modules/dotfiles/.zshrc \ No newline at end of file diff --git a/build/img/Dockerfile b/build/img/Dockerfile deleted file mode 100644 index 218aa13..0000000 --- a/build/img/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM ubuntu:24.04 - -ENV DEBIAN_FRONTEND=noninteractive -ENV X11VNC_SKIP_DISPLAY=="" - -COPY config/systemd/journal-to-tty.service /lib/systemd/system/journal-to-tty.service -RUN apt-get update -y && \ - apt-get install --no-install-recommends -y \ - ca-certificates \ - cron \ - curl \ - dbus \ - file \ - iproute2 \ - libvirt-daemon \ - libvirt-daemon-system \ - openssl \ - software-properties-common \ - ssh \ - systemd && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -# todo: checksum downloaded binaries -COPY scripts/init-devos.sh /tmp/init-devos.sh -COPY scripts/install-docker.sh /tmp/install-docker.sh -RUN chmod +x \ - /tmp/init-devos.sh \ - /tmp/install-docker.sh && \ - /tmp/init-devos.sh && \ - echo "devos ALL=(ALL) NOPASSWD: ALL" >/etc/sudoers.d/devos && \ - systemctl enable journal-to-tty.service && \ - useradd -m devos - -CMD ["/sbin/init"] -USER devos -HEALTHCHECK NONE diff --git a/config/Brewfile b/config/Brewfile new file mode 120000 index 0000000..95b1745 --- /dev/null +++ b/config/Brewfile @@ -0,0 +1 @@ +../modules/tooling/config/Brewfile \ No newline at end of file diff --git a/config/gitconfig b/config/gitconfig new file mode 120000 index 0000000..ad04c4a --- /dev/null +++ b/config/gitconfig @@ -0,0 +1 @@ +../modules/tooling/config/gitconfig \ No newline at end of file diff --git a/config/kind.yaml b/config/kind.yaml deleted file mode 100644 index 08d7cdf..0000000 --- a/config/kind.yaml +++ /dev/null @@ -1,29 +0,0 @@ ---- -apiVersion: kind.x-k8s.io/v1alpha4 -kind: Cluster -name: devos -networking: - apiServerAddress: 127.0.0.1 - apiServerPort: 6443 - disableDefaultCNI: false - ipFamily: dual -featureGates: - UserNamespacesSupport: true -nodes: - - role: control-plane - extraMounts: - - hostPath: /var/run/docker.sock - containerPath: /var/run/docker.sock - extraPortMappings: - - containerPort: 80 - hostPort: 80 - protocol: TCP - listenAddress: 0.0.0.0 - - containerPort: 443 - hostPort: 443 - protocol: TCP - listenAddress: 0.0.0.0 - - containerPort: 31443 - hostPort: 31443 - protocol: TCP - listenAddress: 0.0.0.0 diff --git a/config/kind.yaml b/config/kind.yaml new file mode 120000 index 0000000..78d1500 --- /dev/null +++ b/config/kind.yaml @@ -0,0 +1 @@ +../modules/tooling/config/kind.yaml \ No newline at end of file diff --git a/config/systemd/journal-to-tty.service b/config/systemd/journal-to-tty.service deleted file mode 100644 index 2725055..0000000 --- a/config/systemd/journal-to-tty.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Journald console log streamer -Requires=systemd-journald.service -After=systemd-journald.service - -[Service] -Restart=always -RestartSec=0 -ExecStart=/bin/journalctl -f -StandardOutput=tty - -[Install] -WantedBy=basic.target diff --git a/config/systemd/x11vnc.service b/config/systemd/x11vnc.service deleted file mode 100644 index 6d4c803..0000000 --- a/config/systemd/x11vnc.service +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=VNC Server - -[Service] -Environment="HOME=/root" -ExecStart=/usr/bin/x11vnc --create --forever --shared - -[Install] -WantedBy=graphical.target diff --git a/hack/bashrc b/hack/bashrc deleted file mode 100644 index b488fcc..0000000 --- a/hack/bashrc +++ /dev/null @@ -1,117 +0,0 @@ -# ~/.bashrc: executed by bash(1) for non-login shells. -# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) -# for examples - -# If not running interactively, don't do anything -case $- in - *i*) ;; - *) return;; -esac - -# don't put duplicate lines or lines starting with space in the history. -# See bash(1) for more options -HISTCONTROL=ignoreboth - -# append to the history file, don't overwrite it -shopt -s histappend - -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=1000 -HISTFILESIZE=2000 - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize - -# If set, the pattern "**" used in a pathname expansion context will -# match all files and zero or more directories and subdirectories. -#shopt -s globstar - -# make less more friendly for non-text input files, see lesspipe(1) -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in (used in the prompt below) -if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -# set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - xterm-color|*-256color) color_prompt=yes;; -esac - -# uncomment for a colored prompt, if the terminal has the capability; turned -# off by default to not distract the user: the focus in a terminal window -# should be on the output of commands, not on the prompt -#force_color_prompt=yes - -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi -fi - -if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' -else - PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' -fi -unset color_prompt force_color_prompt - -# If this is an xterm set the title to user@host:dir -case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" - ;; -*) - ;; -esac - -# enable color support of ls and also add handy aliases -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - alias grep='grep --color=auto' - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' -fi - -# colored GCC warnings and errors -#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' - -# some more ls aliases -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' - -# Add an "alert" alias for long running commands. Use like so: -# sleep 10; alert -alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' - -# Alias definitions. -# You may want to put all your additions into a separate file like -# ~/.bash_aliases, instead of adding them here directly. -# See /usr/share/doc/bash-doc/examples in the bash-doc package. - -if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases -fi - -# enable programmable completion features (you don't need to enable -# this, if it's already enabled in /etc/bash.bashrc and /etc/profile -# sources /etc/bash.bashrc). -if ! shopt -oq posix; then - if [ -f /usr/share/bash-completion/bash_completion ]; then - . /usr/share/bash-completion/bash_completion - elif [ -f /etc/bash_completion ]; then - . /etc/bash_completion - fi -fi diff --git a/hack/boilerplate.txt b/hack/boilerplate.txt deleted file mode 100644 index 2a9d259..0000000 --- a/hack/boilerplate.txt +++ /dev/null @@ -1 +0,0 @@ -SPDX-License-Identifier: GPL-3.0 diff --git a/hack/boilerplate.txt b/hack/boilerplate.txt new file mode 120000 index 0000000..f6eee60 --- /dev/null +++ b/hack/boilerplate.txt @@ -0,0 +1 @@ +../modules/tooling/hack/boilerplate.txt \ No newline at end of file diff --git a/hack/certificate.yaml b/hack/certificate.yaml deleted file mode 100644 index a05fe3a..0000000 --- a/hack/certificate.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: default-gw-cert - namespace: kube-system -spec: - secretName: default-gw-tls - dnsNames: - - "*.devos.local" - issuerRef: - kind: ClusterIssuer - name: self-signed-ca-issuer diff --git a/hack/cl.yaml b/hack/cl.yaml deleted file mode 100644 index 80c0879..0000000 --- a/hack/cl.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -apiVersion: k0sctl.k0sproject.io/v1beta1 -kind: Cluster -metadata: - name: devos -spec: - hosts: - - role: controller+worker - noTaints: true - ssh: - address: 127.0.0.1 - keyPath: ~/.ssh_rsa - port: 22 - user: ubuntu - installFlags: - - --enable-cloud-provider - - --kubelet-extra-args="--cloud-provider=external" - k0s: - config: {} diff --git a/hack/cluster b/hack/cluster new file mode 120000 index 0000000..9dc0d7a --- /dev/null +++ b/hack/cluster @@ -0,0 +1 @@ +../modules/tooling/hack/cluster \ No newline at end of file diff --git a/hack/clusterissuer.yaml b/hack/clusterissuer.yaml deleted file mode 100644 index b9337c6..0000000 --- a/hack/clusterissuer.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -apiVersion: cert-manager.io/v1 -kind: ClusterIssuer -metadata: - name: self-signed-ca-issuer -spec: - selfSigned: {} diff --git a/hack/compose-dev.yaml b/hack/compose-dev.yaml deleted file mode 100644 index 6155569..0000000 --- a/hack/compose-dev.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -services: - devos: - image: ghcr.io/anselmes/devos:main - privileged: true - stdin_open: true - tty: true - user: root # note: required for /sbin/init - working_dir: /home/devos/workspace - # env_file: - # - .env - volumes: - - .:/home/devos/workspace - - ~/.gitconfig:/home/devos/.gitconfig:ro - - ~/.gnupg:/home/devos/.gnupg:ro - - ~/.ssh:/home/devos/.ssh:ro - - ~/.zshrc:/home/devos/.zshrc:ro - ports: - - 10022:22 - - 10080:80 - - 10443:443 - - 15900:5900 - - 16443:6443 diff --git a/hack/config.yaml b/hack/config.yaml deleted file mode 100644 index e987b36..0000000 --- a/hack/config.yaml +++ /dev/null @@ -1,70 +0,0 @@ ---- -apiVersion: k0s.k0sproject.io/v1beta1 -kind: Cluster -metadata: - name: devos -spec: - api: - sans: - - kubernetes.devos.local - network: - provider: custom - featureGates: - - name: UserNamespacesSupport - enabled: true - extensions: - helm: - charts: - - name: cilium - chartname: cilium/cilium - namespace: kube-system - order: 1 - version: 1.16.2 - values: | - l2announcements: - enabled: true - gatewayAPI: - enabled: true - operator: - replicas: 1 - kubeProxyReplacement: true - - name: openebs - chartname: openebs/openebs - namespace: kube-system - order: 1 - version: 3.10.0 - values: | - analytics: - enabled: false - localprovisioner: - hostpathClass: - isDefaultClass: true - - name: cert-manager - chartname: jetstack/cert-manager - namespace: cert-manager - order: 2 - version: v1.16.0 - values: | - crds: - enabled: true - - name: flux - chartname: oci://registry-1.docker.io/bitnamicharts/flux - namespace: cicd - order: 3 - version: 2.3.20 - values: | - global: - storageClass: openebs-hostpath - persistence: - enabled: true - repositories: - - name: cilium - url: https://helm.cilium.io/ - - name: grafana - url: https://grafana.github.io/helm-charts/ - - name: jetstack - url: https://charts.jetstack.io/ - - name: openebs - url: https://openebs.github.io/charts/ - telemetry: - enabled: false diff --git a/hack/env.example b/hack/env.example deleted file mode 100644 index 16214fd..0000000 --- a/hack/env.example +++ /dev/null @@ -1,2 +0,0 @@ -export IPADDR="$(multipass ls | grep devos | awk '{print $3}')" -export SSHKEY="${HOME}/.ssh/id_ed25519" diff --git a/hack/gateway.yaml b/hack/gateway.yaml deleted file mode 100644 index d1cb75a..0000000 --- a/hack/gateway.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- -apiVersion: gateway.networking.k8s.io/v1beta1 -kind: Gateway -metadata: - name: default - namespace: kube-system - annotations: - cert-manager.io/cluster-issuer: self-signed-ca-issuer -spec: - gatewayClassName: cilium - listeners: - - name: http - port: 80 - protocol: HTTP - allowedRoutes: - namespaces: - from: All - - name: https - port: 443 - protocol: HTTPS - hostname: "*.devos.local" - allowedRoutes: - namespaces: - from: All - tls: - mode: Terminate - certificateRefs: - - name: default-gw-cert diff --git a/hack/kustomization.yaml b/hack/kustomization.yaml deleted file mode 100644 index 9f71c80..0000000 --- a/hack/kustomization.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: - - certificate.yaml - - clusterissuer.yaml - - gateway.yaml - - lb.yaml diff --git a/hack/lb.yaml b/hack/lb.yaml deleted file mode 100644 index 63d5dab..0000000 --- a/hack/lb.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -apiVersion: cilium.io/v2alpha1 -kind: CiliumL2AnnouncementPolicy -metadata: - name: default-l2-policy - namespace: kube-system -spec: - externalIPs: true - loadBalancerIPs: true ---- -apiVersion: cilium.io/v2alpha1 -kind: CiliumLoadBalancerIPPool -metadata: - name: default-ip-pool - namespace: kube-system -spec: - allowFirstLastIPs: No - blocks: - - cidr: 172.16.0.1/24 diff --git a/hack/manifest b/hack/manifest new file mode 120000 index 0000000..502e1b4 --- /dev/null +++ b/hack/manifest @@ -0,0 +1 @@ +../modules/tooling/hack/manifest \ No newline at end of file diff --git a/hack/pod.yaml b/hack/pod.yaml new file mode 120000 index 0000000..085a945 --- /dev/null +++ b/hack/pod.yaml @@ -0,0 +1 @@ +../modules/tooling/hack/pod.yaml \ No newline at end of file diff --git a/hack/run b/hack/run deleted file mode 100755 index 4158706..0000000 --- a/hack/run +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-3.0 - -set -euo pipefail - -DIR="$(dirname $(realpath $(dirname $0)))" -export KUBECONFIG="${DIR}/hack/kubeconfig.yaml" - -export IPADDR="${1:-127.0.0.1}" -export SSHKEY="${2:-~/.ssh_rsa}" - -# generate config -yq '.spec.k0s.config = load("config.yaml") | .spec.hosts[].ssh.address = env(IPADDR) | .spec.hosts[].ssh.keyPath = env(SSHKEY) | del(.spec.hosts[].installFlags)' cl.yaml | - tee /tmp/cl.yaml | - sed '/#/d' - -# create cluster -k0sctl apply --config /tmp/cl.yaml - -# get kubeconfig -k0sctl kubeconfig --config /tmp/cl.yaml > "${KUBECONFIG}" - -# apply crds -grep -q gateway <(kubectl get crd) || - kustomize build https://github.com/kubernetes-sigs/gateway-api/config/crd/experimental | kubectl apply -f - -grep -q snapshot <(kubectl get crd) || - kustomize build https://github.com/kubernetes-csi/external-snapshotter/client/config/crd | kubectl apply -f - - -# apply manifests -while [[ -z $(helm ls -n cicd | grep flux) ]]; do - echo "charts not ready" - helm ls -A - sleep 5 -done -kustomize build "${DIR}/hack" | kubectl apply -f - - -# get lb -CIDR="$(yq 'select(.metadata.name == "default-ip-pool")|.spec.blocks[].cidr' lb.yaml)" -VIP="$(yq 'select(.metadata.name == "default-ip-pool")|.spec.blocks[].cidr' lb.yaml | cut -d '/' -f 1 | sed 's/.$/1/')" -sudo route -n add -net "${CIDR}" "${IPADDR}" - -echo """ -Cluster is ready: -- CIDR=${CIDR} -- VIP=${VIP} -""" diff --git a/modules/dotfiles b/modules/dotfiles index e8a5631..2a1b07e 160000 --- a/modules/dotfiles +++ b/modules/dotfiles @@ -1 +1 @@ -Subproject commit e8a5631af244baba46c46861eb6222dc7432d4eb +Subproject commit 2a1b07efa0073268b97acdedb85048333a1efbb8 diff --git a/modules/tooling b/modules/tooling index 809a766..09a84bc 160000 --- a/modules/tooling +++ b/modules/tooling @@ -1 +1 @@ -Subproject commit 809a7668b1b8e343dc39f62138d5a4da8c597a24 +Subproject commit 09a84bc9dcdf585b8f3dc17a263110641c0e3539 diff --git a/scripts/aliases.sh b/scripts/aliases.sh index 25f23ed..c2c846d 120000 --- a/scripts/aliases.sh +++ b/scripts/aliases.sh @@ -1 +1 @@ -modules/tooling/scripts/aliases.sh \ No newline at end of file +../modules/tooling/scripts/aliases.sh \ No newline at end of file diff --git a/scripts/config-devos.sh b/scripts/config-devos.sh deleted file mode 100755 index d8e4fde..0000000 --- a/scripts/config-devos.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-3.0 - -set -euxo pipefail - -DIR="$(dirname $(realpath $(dirname "${0}")))" - -# check dependencies -commands=( - "curl" - "git" - "gnupg2" - "zsh" -) - -sudo apt-get update -y -for command in "${commands[@]}"; do - if [[ -z $(command -v "${command}") ]]; then - sudo apt-get install -y "${command}" - fi -done - -# configure permissions -groups=( - "docker" - "libvirt" - "plugdev" - "sudo" -) - -for g in "${groups[@]}"; do - sudo usermod -aG "${g}" "${USER}" || true -done - -# configure environment -if [[ ! -d "${HOME}/.oh-my-zsh" ]]; then - curl -fsSLo /tmp/ohmyzsh-install.sh https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh - bash /tmp/ohmyzsh-install.sh --unattended || true - rm -f /tmp/ohmyzsh-install.sh -fi - -ln -sf "${DIR}/config/bashrc" "${HOME}/.bashrc" || true -ln -sf "${DIR}/config/gitconfig" "${HOME}/.gitconfig" || true -ln -sf "${DIR}/config/sshconfig" "${HOME}/.ssh/config" || true -ln -sf "${DIR}/config/zshrc" "${HOME}/.zshrc" || true - -sudo ln -sf "${DIR}/scripts/aliases.sh" /etc/profile.d/aliases.sh -sudo ln -sf "${DIR}/scripts/environment.sh" /etc/profile.d/environment.sh - -sudo chsh -s "$(command -v zsh)" "${USER}" diff --git a/scripts/configure.sh b/scripts/configure.sh index cf7e8ec..e1f2011 120000 --- a/scripts/configure.sh +++ b/scripts/configure.sh @@ -1 +1 @@ -modules/tooling/scripts/configure.sh \ No newline at end of file +../modules/tooling/scripts/configure.sh \ No newline at end of file diff --git a/scripts/environment.sh b/scripts/environment.sh index 03f85a0..b88f583 120000 --- a/scripts/environment.sh +++ b/scripts/environment.sh @@ -1 +1 @@ -modules/tooling/scripts/environment.sh \ No newline at end of file +../modules/tooling/scripts/environment.sh \ No newline at end of file diff --git a/scripts/gencert.sh b/scripts/gencert.sh new file mode 120000 index 0000000..7232743 --- /dev/null +++ b/scripts/gencert.sh @@ -0,0 +1 @@ +../modules/tooling/scripts/gencert.sh \ No newline at end of file diff --git a/scripts/init-devos.sh b/scripts/init-devos.sh deleted file mode 100755 index 2831c55..0000000 --- a/scripts/init-devos.sh +++ /dev/null @@ -1,267 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-3.0 - -set -euxo pipefail - -: "${ARCH:=$(dpkg --print-architecture)}" - -: "${CARGO_HOME:=/usr/local/rust/cargo}" -: "${GOPATH:=/usr/local/go}" -: "${KREW_ROOT:=/usr/local/krew}" -: "${RUSTUP_HOME:=/usr/local/rust/rustup}" - -: "${BUF_VERSION:=1.36.0}" -: "${CFSSL_VERSION:=1.6.5}" -: "${CILIUM_VERSION:=0.16.18}" -: "${CLOUDFLARED_VERSION:=2024.9.1}" -: "${CLUSTERCTL_VERSION:=1.8.3}" -: "${COSIGN_VERSION:=2.4.0}" -: "${GH_VERSION:=2.57.0}" -: "${GO_VERSION:=1.23.2}" -: "${JQ_VERSION:=1.7.1}" -: "${K0SCTL_VERSION:=0.19.0}" -: "${KIND_VERSION:=0.24.0}" -: "${KUBECTL_VERSION:=v1.31.1}" -: "${NODE_VERSION:=20.18.0}" -: "${OP_VERSION:=2.30.0}" -: "${SBCTL_VERSION:=0.15.4}" -: "${SOPS_VERSION:=3.9.0}" -: "${TRIVY_VERSION:=0.55.2}" -: "${VAULT_VERSION:=1.17.6}" -: "${YQ_VERSION:=4.44.3}" - -ARGS=${@} -DIR="$(dirname $(realpath $(dirname "${0}")))" - -apt-get update -yq -apt-get install --no-install-recommends -y \ - ansible \ - genisoimage \ - git \ - git-lfs \ - libvirt-clients \ - python3-openstackclient \ - python3-pip \ - sudo \ - unzip \ - vim \ - virtinst \ - zip - -mkdir -p \ - "${CARGO_HOME}" \ - "${GOPATH}" \ - "${KREW_ROOT}" \ - "${RUSTUP_HOME}" - -# install docker -if [[ ${ARGS} == *"--docker"* && -z $(command -v docker) ]]; then - "${DIR}/scripts/install-docker.sh" -fi - -# install rust -if [[ ${ARGS} == *"--rust"* && -z $(command -v rustc) ]]; then - curl -fsSLo /tmp/rustup-init.sh https://sh.rustup.rs - RUSTUP_HOME="${RUSTUP_HOME}" CARGO_HOME="${CARGO_HOME}" sh /tmp/rustup-init.sh -y -fi - -# install go -if [[ ${ARGS} == *"--go"* && -z $(command -v go) ]]; then - curl -fsSLo /tmp/go.tar.gz "https://golang.org/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz" - tar -xvf /tmp/go.tar.gz -C /usr/local/ >/dev/null -fi - -# install node -if [[ ${ARGS} == *"--go"* && -z $(command -v node) ]]; then - curl -fsSLo /tmp/node.tar.gz "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${ARCH}.tar.gz" - tar -xvf /tmp/node.tar.gz -C /usr/local/ >/dev/null -fi - -# install yq -if [[ -z $(command -v yq) ]]; then - curl -fsSLo /tmp/yq "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_${ARCH}" - install /tmp/yq /usr/local/bin/ -fi - -# install jq -if [[ -z $(command -v jq) ]]; then - curl -fsSLo /tmp/jq "https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-arm64" - install /tmp/jq /usr/local/bin/ -fi - -# install buf -if [[ -z $(command -v buf) ]]; then - curl -fsSLo /tmp/buf "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-$(uname -s)-$(uname -m)" - install /tmp/buf /usr/local/bin/ -fi - -# install cfssl -if [[ -z $(command -v cfssl) ]]; then - curl -fsSLo /tmp/cfssl "https://github.com/cloudflare/cfssl/releases/download/v${CFSSL_VERSION}/cfssl_${CFSSL_VERSION}_linux_${ARCH}" - install /tmp/cfssl /usr/local/bin/ -fi - -# install cilium cli -if [[ -z $(command -v cilium) ]]; then - curl -fsSLo /tmp/cilium.tar.gz "https://github.com/cilium/cilium-cli/releases/download/v${CILIUM_VERSION}/cilium-linux-${ARCH}.tar.gz" - tar -xvf /tmp/cilium.tar.gz -C /tmp/ >/dev/null - install /tmp/cilium /usr/local/bin/ -fi - -# install cloudflared -if [[ ${ARGS} == *"--cloudflared"* && -z $(command -v cloudflared) ]]; then - curl -fsSLo /tmp/cloudflared "https://github.com/cloudflare/cloudflared/releases/download/${CLOUDFLARED_VERSION}/cloudflared-linux-${ARCH}" - install /tmp/cloudflared /usr/local/bin/ -fi - -# install clusterctl -if [[ -z $(command -v clusterctl) ]]; then - curl -fsSLo /tmp/clusterctl "https://github.com/kubernetes-sigs/cluster-api/releases/download/v${CLUSTERCTL_VERSION}/clusterctl-linux-${ARCH}" - install /tmp/clusterctl /usr/local/bin/ -fi - -# install cosign -if [[ -z $(command -v cosign) ]]; then - curl -fsSLo /tmp/cosign "https://github.com/sigstore/cosign/releases/download/v${COSIGN_VERSION}/cosign-linux-${ARCH}" - install /tmp/cosign /usr/local/bin/ -fi - -# install github cli -if [[ -z $(command -v gh) ]]; then - curl -fsSLo /tmp/gh.tar.gz "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_${ARCH}.tar.gz" - tar -xvf /tmp/gh.tar.gz -C /tmp/ >/dev/null - install "/tmp/gh_${GH_VERSION}_linux_${ARCH}/bin/gh" /usr/local/bin/ -fi - -# install k0sctl -if [[ -z $(command -v k0sctl) ]]; then - curl -fsSLo /tmp/k0sctl "https://github.com/k0sproject/k0sctl/releases/download/v${K0SCTL_VERSION}/k0sctl-linux-${ARCH}" - install /tmp/k0sctl /usr/local/bin/ -fi - -# install kind -if [[ -z $(command -v kind) ]]; then - curl -fsSLo /tmp/kind "https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-${ARCH}" - install /tmp/kind /usr/local/bin/ -fi - -# install kubectl -if [[ -z $(command -v kubectl) ]]; then - curl -fsSLo /tmp/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl" - install /tmp/kubectl /usr/local/bin/ -fi - -# install 1password cli -if [[ -z $(command -v op) ]]; then - curl -fsSLo /tmp/op.zip "https://cache.agilebits.com/dist/1P/op2/pkg/v${OP_VERSION}/op_linux_${ARCH}_v${OP_VERSION}.zip" - unzip -d /tmp/op /tmp/op.zip - install /tmp/op/op /usr/local/bin/ - groupadd -f onepassword-cli - chgrp onepassword-cli /usr/local/bin/op - chmod g+s /usr/local/bin/op -fi - -# install sbctl -if [[ -z $(command -v sbctl) ]]; then - curl -fsSLo /tmp/sbctl.tar.gz "https://github.com/Foxboron/sbctl/releases/download/${SBCTL_VERSION}/sbctl-${SBCTL_VERSION}-linux-${ARCH}.tar.gz" - tar -xvf /tmp/sbctl.tar.gz -C /tmp/ >/dev/null - install /tmp/sbctl/sbctl /usr/local/bin/ -fi - -# install sops -if [[ -z $(command -v sops) ]]; then - curl -fsSLo /tmp/sops "https://github.com/getsops/sops/releases/download/v${SOPS_VERSION}/sops-v${SOPS_VERSION}.linux.${ARCH}" - install /tmp/sops /usr/local/bin/ -fi - -# install trivy -if [[ -z $(command -v trivy) ]]; then - curl -fsSLo /tmp/trivy.tar.gz "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-ARM64.tar.gz" - tar -xvf /tmp/trivy.tar.gz -C /tmp/ >/dev/null - install /tmp/trivy /usr/local/bin/ -fi - -# install vault -if [[ -z $(command -v vault) ]]; then - curl -fsSLo /tmp/vault.zip "https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_${ARCH}.zip" - unzip -d /tmp/vault /tmp/vault.zip - install /tmp/vault/vault /usr/local/bin/ -fi - -# install flux -if [[ -z $(command -v flux) ]]; then - curl -fsSLo /tmp/flux-install.sh https://fluxcd.io/install.sh - bash /tmp/flux-install.sh -fi - -# install helm -if [[ -z $(command -v helm) ]]; then - curl -fsSLo /tmp/get-helm-3.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 - bash /tmp/get-helm-3.sh -fi - -# install krew -if [[ -z $(command -v krew) ]]; then - curl -fsSLo /tmp/krew.tar.gz "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew-linux_${ARCH}.tar.gz" - tar -xvf /tmp/krew.tar.gz -C /tmp/ >/dev/null - KREW_ROOT="${KREW_ROOT}" /tmp/krew-linux_"${ARCH}" install krew -fi - -# install trunk.io -if [[ -z $(command -v trunk) ]]; then - curl -fsSLo /tmp/trunk.sh https://get.trunk.io - chmod 755 /tmp/trunk.sh - /tmp/trunk.sh - chmod 755 "$(command -v trunk)" -fi - -# enable windows manager -if [[ ${ARGS} == *"--wm"* ]]; then - apt-get install --no-install-recommends -y \ - icewm \ - x11vnc \ - xauth \ - xinit \ - xterm \ - xvfb - cp -f config/systemd/x11vnc.service /lib/systemd/system/x11vnc.service - systemctl enable x11vnc.service - echo "exec icewm" >~/.xinitrc && chmod +x ~/.xinitrc -fi - -# post -plugins=( - "ca-cert" - "cert-manager" - "ctx" - "gopass" - "hns" - "images" - "konfig" - "minio" - "node-shell" - "ns" - "oidc-login" - "open-svc" - "openebs" - "operator" - "outdated" - "rabbitmq" - "rook-ceph" - "starboard" - "view-secret" - "view-serviceaccount-kubeconfig" - "view-utilization" -) -for p in "${plugins[@]}"; do - KREW_ROOT="${KREW_ROOT}" /usr/local/krew/bin/kubectl-krew install "${p}" -done - -chmod -R 777 \ - "${CARGO_HOME}" \ - "${GOPATH}" \ - "${KREW_ROOT}" \ - "${RUSTUP_HOME}" - -# cleanup -rm -rf /tmp/* diff --git a/scripts/install b/scripts/install index 2fc2509..67975cf 120000 --- a/scripts/install +++ b/scripts/install @@ -1 +1 @@ -modules/tooling/scripts/install \ No newline at end of file +../modules/tooling/scripts/install \ No newline at end of file diff --git a/tools/quickstart b/tools/quickstart new file mode 120000 index 0000000..0aef856 --- /dev/null +++ b/tools/quickstart @@ -0,0 +1 @@ +../modules/tooling/tools/quickstart \ No newline at end of file