Skip to content

Commit

Permalink
All our tweaks should go here
Browse files Browse the repository at this point in the history
If there is another thing to add to our fork, pls add it here.

Example:

```
echo -e "#foo?\n\n bar?" > foo-bar.md # Pls keep adding the changes to standalone files that are not present in the upstream to mitigate the risk of conflict
add foo-bar.md
git commit -s --ammend
yada yada
```

Signed-off-by: Jirka Kremser <[email protected]>
Signed-off-by: Jan Wozniak <[email protected]>
Signed-off-by: Jirka Kremser <[email protected]>
  • Loading branch information
jkremser committed Jul 10, 2024
1 parent 8b3a8ec commit fa1fcca
Show file tree
Hide file tree
Showing 7 changed files with 2,511 additions and 0 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/gh-release-chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Helm Publish

on:
workflow_dispatch:
inputs:
version:
description: "target version of either keda (~v2.14.2-1) or http-add-on (v0.8.0-1) helm chart"
required: false
default: 'v2.14.2-2'
type: string
keda:
description: "set this to false if you want to release http-add-on helm chart"
required: false
default: 'true'
type: string
permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create k3s cluster
uses: AbsaOSS/k3d-action@v2
with:
cluster-name: "test-cluster"
k3d-version: v5.6.0
args: >-
--no-lb
--k3s-arg "--disable=traefik,servicelb,local-storage@server:*"
- name: Smoke test helm rendering and deployability (keda chart)
if: inputs.keda == 'true'
run: |
helm template ./keda \
-n keda \
--create-namespace \
--set customManagedBy=kedify | kubectl apply --server-side --force-conflicts -f -
kubectl wait --timeout=300s -nkeda --for=condition=ready pod -lapp.kubernetes.io/name=keda-admission-webhooks
kubectl wait --timeout=300s -nkeda --for=condition=ready pod -lapp.kubernetes.io/name=keda-operator-metrics-apiserver
kubectl wait --timeout=300s -nkeda --for=condition=ready pod -lapp.kubernetes.io/name=keda-operator
echo -e "\n\n\n pods:\n\n"
kubectl get pods -A
- name: Smoke test helm rendering and deployability (addon chart)
if: inputs.keda != 'true'
run: |
kubectl create ns keda
# addon depends on ScaledObject CRD that is not part of the helm chart so we install also KEDA first
helm template ./keda -nkeda | kubectl apply --server-side --force-conflicts -f -
kubectl scale deploy -nkeda keda-admission-webhooks --replicas=0
kubectl scale deploy -nkeda keda-operator-metrics-apiserver --replicas=0
kubectl scale deploy -nkeda keda-operator --replicas=0
helm template ./http-add-on \
-n keda \
--set interceptor.replicas.min=1 \
--set scaler.replicas=1 \
--set operator.replicas=1 \
--set crds.install=true | kubectl apply --server-side --force-conflicts -f -
sleep 10
kubectl get pods -A
kubectl wait --timeout=600s -nkeda --for=condition=ready pod -lapp.kubernetes.io/component=operator,app.kubernetes.io/part-of=keda-add-ons-http
kubectl wait --timeout=600s -nkeda --for=condition=ready pod -lapp.kubernetes.io/component=scaler,app.kubernetes.io/part-of=keda-add-ons-http
kubectl wait --timeout=600s -nkeda --for=condition=ready pod -lapp.kubernetes.io/component=interceptor,app.kubernetes.io/part-of=keda-add-ons-http
echo -e "\n\n\n pods:\n\n"
kubectl get pods -A
publish:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add the -N suffix to chart's version (keda)
if: inputs.keda == 'true'
run: |
sed -i keda/Chart.yaml -e 's;^version:.*;version: ${{ inputs.version }};'
- name: Add the -N suffix to chart's version (addon)
if: inputs.keda != 'true'
run: |
sed -i http-add-on/Chart.yaml -e 's;^version:.*;version: ${{ inputs.version }};'
- name: Publish Helm chart
if: inputs.keda != 'true'
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.PAT_TOKEN }}
charts_dir: "."
- name: Create k3s cluster
if: inputs.keda == 'true'
uses: AbsaOSS/k3d-action@v2
with:
cluster-name: "test-cluster"
k3d-version: v5.6.0
args: >-
--no-lb
--k3s-arg "--disable=traefik,servicelb,local-storage@server:*"
- name: Smoke test helm installation
if: inputs.keda == 'true'
run: |
# exp-backoff - we wait for pages to become available here
for i in $(seq 16)
do
_sec=$(echo "1.5^$i" | bc)
echo "Waiting ${_sec} seconds.."
sleep ${_sec}
helm repo add kedify https://kedify.github.io/charts || continue
helm repo update
set -x
helm upgrade -i keda kedify/keda \
-n keda \
--create-namespace \
--timeout 300s \
--wait \
--version ${{ inputs.version }} \
--set customManagedBy=kedify && break
set +x
[ "$i" = "16" ] && exit 1
done
kubectl wait --timeout=300s -nkeda --for=condition=ready pod -lapp.kubernetes.io/name=keda-admission-webhooks
kubectl wait --timeout=300s -nkeda --for=condition=ready pod -lapp.kubernetes.io/name=keda-operator-metrics-apiserver
kubectl wait --timeout=300s -nkeda --for=condition=ready pod -lapp.kubernetes.io/name=keda-operator
echo -e "\n\n\n pods:\n\n"
kubectl get pods -A
echo "::group::values.yaml"
helm get values -n keda keda
echo "::endgroup::"
echo "::group::resulting YAML manifests"
helm get manifest -n keda keda
echo "::endgroup::"
echo -e "\n\nthe following command is supposed to fail:\n\n"
helm template keda kedify/keda \
--version $${{ inputs.version }} \
--set crds.install=f4lse || true
97 changes: 97 additions & 0 deletions .github/workflows/gh-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Sync with upstream
on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
- cron: "* 7 * * *"
workflow_dispatch:
inputs:
upstreamRepo:
description: "Upstream Repo - Where we should get the changes from. If not specified, it's 'kedacore/charts'"
default: "kedacore/charts"
required: false
type: string
downstreamRepo:
description: "Downstream Repo - To what repo we are syncying. If not specified, it's 'kedify/charts' (this repo)"
default: "kedify/charts"
required: false
type: string

env:
UPSTREAM_REPO: ${{ github.event.inputs.upstreamRepo || 'kedacore/charts' }}
DOWNSTREAM_REPO: ${{ github.event.inputs.downstreamRepo || 'kedify/charts' }}

jobs:
repo-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0
- run: |
git config --global user.email "[email protected]"
git config --global user.name "Kedify Bot"
git remote add upstream https://github.com/${{ env.UPSTREAM_REPO }}.git
git pull -s recursive --rebase -X ours upstream main
git push origin +main
# - name: Open Pull Request
# id: cpr
# uses: peter-evans/create-pull-request@v6
# with:
# token: ${{ secrets.PAT_TOKEN }}
# push-to-fork: ${{ env.DOWNSTREAM_REPO }}
# commit-message: Syncing upstream helm charts
# title: Syncing upstream helm charts
# body: |
# :package: Syncing upstream helm chart :package:

# ### :shipit: Release?

# The sync mechanism doesn't deal with releases.

# ### :thinking: Rebase or merge?

# Although merging is obviously better :trollface:, let's use rebasing for this sync.
# This way we will see our custom tweaks nicely on the tip of the `main`.

# ### :hospital: Conflict?

# This could have happened only if the PR was opened for a long time and meanwhile there
# was a change to this repo. :adhesive_bandage: Just close this PR and wait for the next one.

# #### :bulb: Tip

# Ideally, this repo has only one commits with all the necessary tweaks in it (like this gh action for instance).
# So that we can keep adding the changes to this commit by `g commit --ammend` and ideally the changes should be in
# new files so that the risk of conflict with the upstream repo is minimal.

# ### :wrench: Important

# Once this is merged, please don't forget to run this command if our 'All our tweaks should go here' commit is not on
# top:

# ```
# GIT_SEQUENCE_EDITOR=\"sed -i -n 'h;1n;2p;g;p'\" git rebase -i HEAD~2
# ```

# To reorder last two commits.

# This automated PR was created by [this action][1].

# [1]: https://github.com/kedify/charts/actions/runs/${{ github.run_id }}
# branch: upstream-sync
# delete-branch: true
# signoff: true

# - name: Check PR
# run: |
# echo ":rocket:"
# echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | tee -a "${GITHUB_STEP_SUMMARY}"
# echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" | tee -a "${GITHUB_STEP_SUMMARY}"
5 changes: 5 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Teams:
* @kedify/all

# Individuals:

18 changes: 18 additions & 0 deletions http-add-on/templates/interceptor/service-kedify_proxy_sink.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: interceptor-proxy
{{- include "keda-http-add-on.labels" . | indent 4 }}
name: "{{ .Chart.Name }}-interceptor-kedify-proxy-metric-sink"
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
ports:
- name: proxy
port: {{ default 9901 .Values.interceptor.proxy.kedifyMetricsSinkPort }}
protocol: TCP
targetPort: {{ default 9901 .Values.interceptor.proxy.kedifyMetricsSinkPort }}
selector:
app.kubernetes.io/component: interceptor
{{- include "keda-http-add-on.matchLabels" . | indent 4 }}
Loading

0 comments on commit fa1fcca

Please sign in to comment.