From e5b9e5a78a7c95e76a93b9633d82197693eeb941 Mon Sep 17 00:00:00 2001 From: Xan Manning Date: Thu, 27 May 2021 18:13:55 +0000 Subject: [PATCH] Updated CHANGELOG and molecule tests --- .devcontainer/Dockerfile | 26 ++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 28 ++++++++++++++++++++++++++++ CHANGELOG.md | 13 +++++++++++++ README.md | 23 +++++++++++++++++++++-- defaults/main.yml | 6 +++++- molecule/autodeploy/converge.yml | 3 +++ 6 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..7cbf942 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,26 @@ +ARG VARIANT=focal +FROM ubuntu:${VARIANT} + +COPY molecule/requirements.txt /tmp/molecule/requirements.txt +COPY requirements.txt /tmp/requirements.txt + +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install curl git python3-dev python3-pip \ + python3-venv shellcheck sudo unzip docker.io jq \ + && curl -L \ + "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \ + -o /usr/bin/kubectl \ + && chmod +x /usr/bin/kubectl \ + && python3 -m pip install pip --upgrade \ + && python3 -m pip install -r /tmp/molecule/requirements.txt + +RUN useradd -m vscode && \ + usermod -aG docker vscode && \ + echo 'vscode ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/vscode && \ + echo 'source /etc/bash_completion.d/git-prompt' >> /home/vscode/.bashrc && \ + echo 'sudo chown vscode /var/run/docker-host.sock' >> /home/vscode/.bashrc && \ + echo 'export PS1="${PS1}\[\033[38;5;196m\]$(__git_ps1)\[$(tput sgr0)\] "' >> /home/vscode/.bashrc + +RUN ln -s /var/run/docker-host.sock /var/run/docker.sock + +USER vscode diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..b442a63 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +{ + "name": "Ubuntu", + "build": { + "context": "..", + "dockerfile": "Dockerfile", + "args": { "VARIANT": "focal" } + }, + + "settings": { + "terminal.integrated.profiles.linux": { + "bash (login)": { + "path": "/bin/bash", + "args": ["-l"] + } + } + }, + + "extensions": [ + "ms-azuretools.vscode-docker", + "redhat.vscode-yaml" + ], + + "mounts": [ + "source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind" + ], + + "remoteUser": "vscode" +} diff --git a/CHANGELOG.md b/CHANGELOG.md index c3809d3..1365ce1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,19 @@ --- --> +## 2021-05-27, v2.10.0 + +### Notable changes + +- Only deploy templates on primary controller #119 +- Allow control plane static pods #120 +- Add support for specifying URLs in templates #124 + +### Contributors + +- [@bjw-s](https://github.com/bjw-s) +- [@onedr0p](https://github.com/onedr0p) + ## 2021-05-14, v2.9.1 diff --git a/README.md b/README.md index da050b1..89d3843 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,9 @@ consistency. These are generally cluster-level configuration. | `k3s_github_url` | Set the GitHub URL to install k3s from. | https://github.com/k3s-io/k3s | | `k3s_install_dir` | Installation directory for k3s. | `/usr/local/bin` | | `k3s_install_hard_links` | Install using hard links rather than symbolic links. | `false` | -| `k3s_server_manifests_urls` | A list of URLs (w/ url and filename) to deploy on the primary control plane. | [] | +| `k3s_server_manifests_urls` | A list of URLs to deploy on the primary control plane. Read notes below. | [] | | `k3s_server_manifests_templates` | A flat list of templates to deploy on the primary control plane. | [] | -| `k3s_server_pod_manifests_urls` | A list of URLs (w/ url and filename) for installing static pod manifests on the control plane. | [] | +| `k3s_server_pod_manifests_urls` | A list of URLs for installing static pod manifests on the control plane. Read notes below. | [] | | `k3s_server_pod_manifests_templates` | A flat list of templates for installing static pod manifests on the control plane. | [] | | `k3s_use_experimental` | Allow the use of experimental features in k3s. | `false` | | `k3s_use_unsupported_config` | Allow the use of unsupported configurations in k3s. | `false` | @@ -298,6 +298,25 @@ ensure a majority in the event of a network partition. If you want to use 2 members or an even number of members, please set `k3s_use_unsupported_config` to `true`. +#### Important note about `k3s_server_manifests_urls` and `k3s_server_pod_manifests_urls` + +To deploy server manifests and server pod manifests from URL, you need to +specify a `url` and a `filename`. Below is an example of how to deploy the +Tigera operator for Calico and kube-vip. + +```yaml +--- + +k3s_server_manifests_urls: + - url: https://docs.projectcalico.org/archive/v3.19/manifests/tigera-operator.yaml + filename: tigera-operator.yaml + +k3s_server_pod_manifests_urls: + - url: https://raw.githubusercontent.com/kube-vip/kube-vip/main/example/deploy/0.1.4.yaml + filename: kube-vip.yaml + +``` + ## Dependencies No dependencies on other roles. diff --git a/defaults/main.yml b/defaults/main.yml index 71424f0..f205493 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -40,12 +40,16 @@ k3s_server_manifests_templates: [] # A list of URLs used for preconfigure the cluster. k3s_server_manifests_urls: [] +# - url: https://some/url/to/manifest.yml +# filename: manifest.yml # A list of templates used for installing static pod manifests on the control plane. k3s_server_pod_manifests_templates: [] # A list of URLs used for installing static pod manifests on the control plane. k3s_server_pod_manifests_urls: [] +# - url: https://some/url/to/manifest.yml +# filename: manifest.yml # Use experimental features in k3s? k3s_use_experimental: false @@ -128,4 +132,4 @@ k3s_registries: # # path to the key file used in the registry # key_file: # # path to the ca file used in the registry -# ca_file: \ No newline at end of file +# ca_file: diff --git a/molecule/autodeploy/converge.yml b/molecule/autodeploy/converge.yml index 503e08a..73dc77b 100644 --- a/molecule/autodeploy/converge.yml +++ b/molecule/autodeploy/converge.yml @@ -13,5 +13,8 @@ default-local-storage-path: /var/lib/k3s-io/local-storage k3s_server_manifests_templates: - "molecule/autodeploy/templates/00-ns-monitoring.yml.j2" + k3s_server_manifests_urls: + - url: https://raw.githubusercontent.com/metallb/metallb/v0.9.6/manifests/namespace.yaml + filename: 05-metallb-namespace.yml roles: - role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"