forked from kubernetes-sigs/kwok
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Lint and Test Charts | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
lint-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Helm | ||
uses: azure/[email protected] | ||
with: | ||
version: v3.14.4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
check-latest: true | ||
|
||
- name: Set up chart-testing | ||
uses: helm/[email protected] | ||
|
||
- name: Run chart-testing (list-changed) | ||
id: list-changed | ||
run: | | ||
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) | ||
if [[ -n "$changed" ]]; then | ||
echo "changed=true" >> "$GITHUB_OUTPUT" | ||
fi | ||
- name: Run chart-testing (lint) | ||
if: steps.list-changed.outputs.changed == 'true' | ||
run: ct lint --target-branch ${{ github.event.repository.default_branch }} | ||
|
||
- name: Create kind cluster | ||
if: steps.list-changed.outputs.changed == 'true' | ||
uses: helm/[email protected] | ||
|
||
- name: Run chart-testing (install) | ||
if: steps.list-changed.outputs.changed == 'true' | ||
run: ct install --target-branch ${{ github.event.repository.default_branch }} | ||
|
||
linter-artifacthub: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: artifacthub/ah | ||
options: --user root | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Run ah lint | ||
working-directory: ./charts/ | ||
run: ah lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Releases Charts | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'kwok-chart-v*' | ||
- 'kwok-stage-fast-chart-v*' | ||
|
||
jobs: | ||
releases: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # important parameter for helm chart | ||
|
||
- name: Set version | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
- name: Create charts tmp directory | ||
run: | | ||
mkdir .tmp-charts | ||
if [[ "${RELEASE_VERSION}" = "kwok-chart-v"* ]]; then | ||
cp -a charts/kwok .tmp-charts/kwok | ||
fi | ||
if [[ "${RELEASE_VERSION}" = "kwok-stage-fast-chart-v"* ]]; then | ||
cp -a charts/kwok .tmp-charts/stage-fast | ||
fi | ||
- name: Install Helm | ||
uses: azure/setup-helm@v4 | ||
|
||
- name: Set up Git user | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Release charts | ||
uses: helm/[email protected] | ||
env: | ||
CR_CHARTS_DIR: ".tmp-charts" | ||
CR_RELEASE_NAME_TEMPLATE: "${{ env.RELEASE_VERSION }}" | ||
CR_MAKE_RELEASE_LATEST: false | ||
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Login to ghcr.io | ||
run: | | ||
helm registry login --username ${GITHUB_ACTOR} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io | ||
- name: Release Charts to GHCR | ||
run: | | ||
helm push "${{ env.RELEASE_VERSION }}.tgz" oci://ghcr.io/${{ github.repository }}/charts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.helmignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v2 | ||
appVersion: 0.5.2 | ||
description: KWOK (Kubernetes WithOut Kubelet) | ||
type: application | ||
home: https://kwok.sigs.k8s.io | ||
icon: https://github.com/kubernetes-sigs/kwok/raw/main/logo/kwok.png | ||
keywords: | ||
- kubernetes | ||
- kwok | ||
sources: | ||
- https://github.com/kubernetes-sigs/kwok | ||
name: kwok | ||
version: 0.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# KWOK (Kubernetes WithOut Kubelet) | ||
|
||
[KWOK](https://github.com/kubernetes-sigs/kwok/) - Simulates thousands of Nodes and Clusters. | ||
|
||
## Installing the Chart | ||
|
||
Before you can install the chart you will need to add the `kwok` repo to [Helm](https://helm.sh/). | ||
|
||
```shell | ||
helm repo add kwok https://kubernetes-sigs.github.io/kwok/ | ||
``` | ||
|
||
After you've installed the repo you can install the chart. | ||
|
||
```shell | ||
helm upgrade --namespace kube-system --install kwok kwok/kwok | ||
``` | ||
|
||
Set up default stage policy (required) | ||
> NOTE: This configures the pod/node emulation behavior, if not it will do nothing. | ||
```shell | ||
helm upgrade --install kwok kwok/stage-fast | ||
``` | ||
|
||
## Configuration | ||
|
||
The following table lists the configurable parameters of the kwok chart and their default values. | ||
|
||
| Parameter | Description | Default | | ||
|--------------------|------------------------------------------------------------------------------|-----------------------------| | ||
| `image.repository` | Image repository. | `registry.k8s.io/kwok/kwok` | | ||
| `image.tag` | Image tag, will override the default tag derived from the chart app version. | `v[chart appVersion]` | | ||
| `image.pullPolicy` | Image pull policy. | `IfNotPresent` | | ||
| `imagePullSecrets` | Image pull secrets. | `[]` | | ||
| `nameOverride` | Override the `name` of the chart. | `""` | | ||
| `fullnameOverride` | Override the `fullname` of the chart. | `""` | | ||
| `replicas` | The replica count for Deployment. | `1` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../kustomize/crd/bases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "kwok.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "kwok.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "kwok.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "kwok.labels" -}} | ||
helm.sh/chart: {{ include "kwok.chart" . }} | ||
{{ include "kwok.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "kwok.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "kwok.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "kwok.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "kwok.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "kwok.fullname" . }} | ||
labels: | ||
{{- include "kwok.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{- .Values.replicas }} | ||
selector: | ||
matchLabels: | ||
{{- include "kwok.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "kwok.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "kwok.fullname" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
restartPolicy: Always | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | (printf "v%s" .Chart.AppVersion) }}" | ||
args: | ||
- --manage-all-nodes=false | ||
- --manage-nodes-with-annotation-selector=kwok.x-k8s.io/node=fake | ||
- --manage-nodes-with-label-selector= | ||
- --manage-single-node= | ||
- --disregard-status-with-annotation-selector=kwok.x-k8s.io/status=custom | ||
- --disregard-status-with-label-selector= | ||
- --node-ip=$(POD_IP) | ||
- --node-port=10247 | ||
- --cidr=10.0.0.1/24 | ||
- --node-lease-duration-seconds=40 | ||
- --enable-crds=Stage | ||
- --enable-crds=Metric | ||
- --enable-crds=Attach | ||
- --enable-crds=ClusterAttach | ||
- --enable-crds=Exec | ||
- --enable-crds=ClusterExec | ||
- --enable-crds=Logs | ||
- --enable-crds=ClusterLogs | ||
- --enable-crds=PortForward | ||
- --enable-crds=ClusterPortForward | ||
- --enable-crds=ResourceUsage | ||
- --enable-crds=ClusterResourceUsage | ||
env: | ||
- name: POD_IP | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.podIP | ||
- name: HOST_IP | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.hostIP | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
livenessProbe: | ||
failureThreshold: 10 | ||
httpGet: | ||
path: /healthz | ||
port: 10247 | ||
scheme: HTTP | ||
initialDelaySeconds: 30 | ||
periodSeconds: 60 | ||
timeoutSeconds: 10 | ||
readinessProbe: | ||
failureThreshold: 5 | ||
httpGet: | ||
path: /healthz | ||
port: 10247 | ||
scheme: HTTP | ||
initialDelaySeconds: 2 | ||
periodSeconds: 20 | ||
timeoutSeconds: 2 | ||
startupProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /healthz | ||
port: 10247 | ||
scheme: HTTP | ||
initialDelaySeconds: 2 | ||
periodSeconds: 10 | ||
timeoutSeconds: 2 | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
Oops, something went wrong.