Skip to content

Commit

Permalink
♻️ Add kind dev setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Shark committed Aug 12, 2022
1 parent b968b71 commit c982669
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 81 deletions.
13 changes: 13 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
FROM rust:1.63

RUN apt-get update \
&& apt-get install -y --no-install-recommends zsh sudo openjdk-11-jre pre-commit \
&& adduser --disabled-password --u 1000 --gid 65534 --gecos '' rust \
&& echo "rust ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers.d/rust

# Install kubectl, k9s, kind, helm & the Argo Workflows CLI
RUN curl -sSL -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl \
&& chmod +x /usr/local/bin/kubectl \
&& curl -sSL -o kind https://github.com/kubernetes-sigs/kind/releases/download/v0.14.0/kind-darwin-amd64 \
&& chmod +x kind \
&& curl -sSL https://get.helm.sh/helm-v3.9.3-linux-amd64.tar.gz | tar xz linux-amd64/helm -C /usr/local/bin --strip-components=1 \
&& curl -sSL https://github.com/derailed/k9s/releases/download/v0.26.3/k9s_Linux_x86_64.tar.gz | tar xz k9s -C /usr/local/bin
&& curl -sSL https://github.com/argoproj/argo-workflows/releases/download/v3.3.9/argo-linux-amd64.gz | gunzip > /usr/local/bin/argo-linux-amd64 \
&& mv /usr/local/bin/argo-linux-amd64 /usr/local/bin/argo \
&& chmod +x /usr/local/bin/argo

USER rust
RUN touch ~/.zshrc \
&& rustup component add rustfmt \
Expand Down
12 changes: 11 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,15 @@
"terminal.integrated.defaultProfile.linux": "zsh",
"ltex.java.path": "/usr/lib/jvm/java-11-openjdk-amd64",
"grammarly.startTextCheckInPausedState": true
}
},
"features": {
"docker-in-docker": {
"version": "latest",
"moby": true,
"dockerDashComposeVersion": "v1"
}
},
"runArgs": [
"--init"
]
}
64 changes: 0 additions & 64 deletions argo-plugin/plugin-distributed.yaml

This file was deleted.

1 change: 0 additions & 1 deletion argo-plugin/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: argoproj.io/v1alpha1
kind: ExecutorPlugin
metadata:
name: wasm
namespace: argo-workflows
spec:
sidecar:
container:
Expand Down
30 changes: 15 additions & 15 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ On [Hetzner Cloud](https://hetzner.cloud) in region `nbg1`. OS is Ubuntu 22.04 (
## Installation

1. **Install k3s**

Use [quick installation method](https://rancher.com/docs/k3s/latest/en/installation/install-options/#options-for-installation-with-script).

Install it on the primary VM:
Expand All @@ -24,7 +24,7 @@ On [Hetzner Cloud](https://hetzner.cloud) in region `nbg1`. OS is Ubuntu 22.04 (
curl -sfL https://get.k3s.io | sh -
systemctl edit k3s
```

Add:

```
Expand All @@ -44,7 +44,7 @@ On [Hetzner Cloud](https://hetzner.cloud) in region `nbg1`. OS is Ubuntu 22.04 (
export INSTALL_K3S_VERSION="v1.22.10%2Bk3s1"
curl -sfL https://get.k3s.io | sh -
```

Do the same edit for the `k3s-agent` service.

2. **Deploy Docker Registry**
Expand All @@ -55,7 +55,7 @@ On [Hetzner Cloud](https://hetzner.cloud) in region `nbg1`. OS is Ubuntu 22.04 (
helm repo add twuni https://helm.twun.io
helm install docker-registry twuni/docker-registry -f values.yaml
```

`values.yaml`:

```yaml
Expand All @@ -75,7 +75,7 @@ On [Hetzner Cloud](https://hetzner.cloud) in region `nbg1`. OS is Ubuntu 22.04 (
helm repo add minio https://charts.min.io/
helm install minio minio/minio --values values.yaml
```

`values.yaml`:

```yaml
Expand All @@ -95,7 +95,7 @@ On [Hetzner Cloud](https://hetzner.cloud) in region `nbg1`. OS is Ubuntu 22.04 (
nodeSelector:
node-role.kubernetes.io/master: 'true'
```
Log into Minio Dashboard at `http://node-ip:31207` with credentials `minioadmin`/`minioadmin` and create the bucket `argo-workflows`.

4. **Install Jaeger**
Expand All @@ -112,7 +112,7 @@ On [Hetzner Cloud](https://hetzner.cloud) in region `nbg1`. OS is Ubuntu 22.04 (
kubectl apply -n argo-workflows -f https://raw.githubusercontent.com/argoproj/argo-workflows/master/manifests/quick-start/base/agent-role.yaml
kubectl apply -n argo-workflows -f https://raw.githubusercontent.com/argoproj/argo-workflows/master/manifests/quick-start/base/agent-default-rolebinding.yaml
```

:warning: Role `agent` must be extended:

```yaml
Expand All @@ -123,10 +123,10 @@ On [Hetzner Cloud](https://hetzner.cloud) in region `nbg1`. OS is Ubuntu 22.04 (
verbs:
- create
```

Edit deployments to add `node-role.kubernetes.io/master: 'true'` to `nodeSelector`.

Edit the `workflow-controller` deployment add add `ARGO_EXECUTOR_PLUGINS=true`.
Edit the `workflow-controller` deployment and add `ARGO_EXECUTOR_PLUGINS=true`.

Create the ConfigMap `workflow-controller-configmap` (namespace `argo-workflows`):

Expand All @@ -146,11 +146,11 @@ On [Hetzner Cloud](https://hetzner.cloud) in region `nbg1`. OS is Ubuntu 22.04 (
secretKeySecret:
name: argo-workflows-s3
key: secret_key
insecure: true
bucket: argo-workflows
endpoint: minio.default.svc.cluster.local:9000
region: eu-central-1
pathStyleEndpoint: true
insecure: true
bucket: argo-workflows
endpoint: minio.default.svc.cluster.local:9000
region: eu-central-1
pathStyleEndpoint: true
```

And the Secret `argo-workflows-s3` (namespace `argo-workflows`):
Expand Down Expand Up @@ -183,7 +183,7 @@ On [Hetzner Cloud](https://hetzner.cloud) in region `nbg1`. OS is Ubuntu 22.04 (
kubectl apply -f krustlet1.yaml
kubectl apply -f krustlet2.yaml
```

Accept the CSRs:

```shell
Expand Down
File renamed without changes.
24 changes: 24 additions & 0 deletions doc/kind/argo-workflows/agent-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: agent
rules:
- apiGroups: # this was added
- argoproj.io
resources:
- workflowtaskresults
verbs:
- create
- apiGroups: # this already exists
- argoproj.io
resources:
- workflowtasksets
verbs:
- list
- watch
- apiGroups: # this already exists
- argoproj.io
resources:
- workflowtasksets/status
verbs:
- patch
12 changes: 12 additions & 0 deletions doc/kind/argo-workflows/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: workflow-controller
spec:
template:
spec:
containers:
- name: workflow-controller
env:
- name: ARGO_EXECUTOR_PLUGINS
value: 'true'
15 changes: 15 additions & 0 deletions doc/kind/argo-workflows/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: argowf

resources:
- https://github.com/argoproj/argo-workflows/releases/download/v3.3.6/namespace-install.yaml
- https://raw.githubusercontent.com/argoproj/argo-workflows/master/manifests/quick-start/base/agent-role.yaml
- https://raw.githubusercontent.com/argoproj/argo-workflows/master/manifests/quick-start/base/agent-default-rolebinding.yaml
- s3.yaml

patches:
- path: workflow-controller-configmap.yaml
- path: deployment.yaml
- path: agent-role.yaml
8 changes: 8 additions & 0 deletions doc/kind/argo-workflows/s3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: s3
type: Opaque
data:
access_key: bWluaW9hZG1pbg== # minioadmin
secret_key: bWluaW9hZG1pbg== # minioadmin
19 changes: 19 additions & 0 deletions doc/kind/argo-workflows/workflow-controller-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: workflow-controller-configmap
data:
artifactRepository: |
archiveLogs: true
s3:
accessKeySecret:
name: s3
key: access_key
secretKeySecret:
name: s3
key: secret_key
insecure: true
bucket: argo-workflows
endpoint: minio.minio.svc.cluster.local:9000
region: eu-central-1
pathStyleEndpoint: true
16 changes: 16 additions & 0 deletions doc/kind/k8s-development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# K8s Development

## Create a kind cluster

```
kind create cluster --config=kind-config.yaml --image kindest/node:v1.22.9@sha256:8135260b959dfe320206eb36b3aeda9cffcb262f4b44cda6b33f7bb73f453105
helm -n minio install --create-namespace minio minio/minio --values minio-values.yaml
kubectl -n minio run --rm --image=minio/mc --command --wait --attach create-bucket -- bash -c "mc alias set minio http://minio.minio.svc.cluster.local:9000 minioadmin minioadmin && mc mb minio/argo-workflows"
kubectl create ns argowf
kubectl -n argowf apply -k argo-workflows
# Create a sample workflow
kubectl -n argowf create -f https://raw.githubusercontent.com/argoproj/argo-workflows/master/examples/hello-world.yaml
```
7 changes: 7 additions & 0 deletions doc/kind/kind-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 31207
hostPort: 31207
12 changes: 12 additions & 0 deletions doc/kind/minio-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
mode: standalone
rootUser: minioadmin
rootPassword: minioadmin
persistence:
enabled: true
resources:
requests:
memory: 256Mi
consoleService:
type: NodePort
port: "9001"
nodePort: 31207

0 comments on commit c982669

Please sign in to comment.