diff --git a/README.md b/README.md index 8cbbc7ae..8cc7d02a 100644 --- a/README.md +++ b/README.md @@ -581,11 +581,10 @@ install the latest stable version of Longhorn: $ sesdev create k3s --deploy-longhorn ``` -To deploy a specific version of Longorn, use the `--longhorn-version` option -to specify a tag name from https://github.com/longhorn/longhorn/tags, e.g.: +To deploy a specific version of Longorn, use the `--longhorn-version` option: ``` -$ sesdev create k3s --deploy-longhorn --longhorn-version=v1.4.1 +$ sesdev create k3s --deploy-longhorn --longhorn-version=1.4.1 ``` Currently Longhorn deployments will only use _one_ disk. If more are diff --git a/sesdev/__init__.py b/sesdev/__init__.py index 501859e4..5b365385 100644 --- a/sesdev/__init__.py +++ b/sesdev/__init__.py @@ -964,7 +964,7 @@ def caasp4(deployment_id, **kwargs): @click.option("--deploy-longhorn", is_flag=True, default=False, help="Deploy Longhorn on k3s") @click.option("--longhorn-version", default=None, - help='Longhorn version to install, e.g. "v1.4.1" (defaults to latest stable)') + help='Longhorn version to install, e.g. "1.4.1" (defaults to latest stable)') @click.option("--k3s-version", default=None, help='k3s version to install (defaults to latest stable)') def k3s(deployment_id, **kwargs): diff --git a/seslib/templates/k3s/provision.sh.j2 b/seslib/templates/k3s/provision.sh.j2 index c1180566..f45a5d2e 100644 --- a/seslib/templates/k3s/provision.sh.j2 +++ b/seslib/templates/k3s/provision.sh.j2 @@ -87,6 +87,10 @@ helm version # by default, which of course won't work. echo "export KUBECONFIG=/etc/rancher/k3s/k3s.yaml" >> /etc/profile.local +# The earlier addition of KUBECONFIG to /etc/profile.local won't help +# us in this current session, so also need to set it explicitly here. +export KUBECONFIG=/etc/rancher/k3s/k3s.yaml + {% if k3s_deploy_ses %} mkdir -p ~/cluster @@ -99,9 +103,6 @@ tar -xzf rook-ceph-*.tgz kubectl create namespace rook-ceph -# The earlier addition of KUBECONFIG to /etc/profile.local won't help -# us in this current session, so need to set it explicitly here. -export KUBECONFIG=/etc/rancher/k3s/k3s.yaml helm install -n rook-ceph rook-ceph ./rook-ceph/ echo "Waiting for the rook operator" @@ -123,30 +124,15 @@ kubectl create -f rook-ceph/examples/toolbox.yaml {% if k3s_deploy_longhorn %} -{% if longhorn_version %} -longhorn_version={{ longhorn_version }} -{% else %} -longhorn_version=$( - curl -sL \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version:2022-11-28" \ - https://api.github.com/repos/longhorn/longhorn/releases | \ - jq -r '.[].tag_name' | \ - grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | \ - sort --version-sort --reverse | \ - head -n 1 -) -{% endif %} - -curl -sSfL https://raw.githubusercontent.com/longhorn/longhorn/${longhorn_version}/scripts/environment_check.sh | bash - -curl -sSLO https://raw.githubusercontent.com/longhorn/longhorn/${longhorn_version}/deploy/longhorn.yaml - # Make longhorn create default disks on all nodes that aren't the master -sed -i '/default-setting\.yaml: |-/a \ \ \ \ create-default-disk-labeled-nodes: true' longhorn.yaml kubectl label node -l 'node-role.kubernetes.io/master!=true' node.longhorn.io/create-default-disk=true -kubectl apply -f longhorn.yaml +helm repo add longhorn https://charts.longhorn.io +helm repo update +helm install longhorn longhorn/longhorn \ + --namespace longhorn-system \ + --create-namespace {{ "--version {}".format(longhorn_version) if longhorn_version }} \ + --set defaultSettings.createDefaultDiskLabeledNodes=true # On k3s this just gives a traefik ingress for the UI with no authentication echo "