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]>
  • Loading branch information
jkremser authored and Kedify Bot committed Jun 25, 2024
1 parent 650d761 commit 55b3cb5
Show file tree
Hide file tree
Showing 5 changed files with 1,837 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/gh-release-chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Helm Publish

on:
release:
types:
- published
workflow_dispatch:
permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add the -N suffix to chart's version
run: |
sed -i keda/Chart.yaml -e 's;^version:.*;version: ${{ github.ref_name }};'
- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.PAT_TOKEN }}
charts_dir: "."
- 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 installation
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 ${{ github.ref_name }} \
--set customManagedBy=kedify && break
set +x
[ "$i" = "16" ] && exit 1
done
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 ${{ github.ref_name }} \
--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:

64 changes: 64 additions & 0 deletions keda/templates/manager/kedify-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
{{- with .Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: "kedify-{{ .Values.operator.name }}-http-admin"
{{- include "keda.labels" . | indent 4 }}
name: kedify-{{ .Values.operator.name }}-http-admin
rules:
- apiGroups: ["http.keda.sh"]
resources: ["httpscaledobjects"]
verbs: ["create", "get", "list", "watch", "update", "patch", "delete"]
---
{{- if not .Values.watchNamespace }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
{{- with .Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: kedify-{{ .Values.operator.name }}-http-admin
{{- include "keda.labels" . | indent 4 }}
name: "kedify-{{ .Values.operator.name }}-http-admin"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: "kedify-{{ .Values.operator.name }}-http-admin"
subjects:
- kind: ServiceAccount
name: {{ (.Values.serviceAccount.operator).name | default .Values.serviceAccount.name }}
namespace: {{ .Release.Namespace }}
{{- else }}
{{- range ( split "," .Values.watchNamespace ) }}
# Role binding for namespace '{{ . }}'
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
{{- with $.Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: "kedify-{{ $.Values.operator.name }}-http-admin"
{{- include "keda.labels" $ | indent 4 }}
name: "kedify-{{ $.Values.operator.name }}-http-admin"
namespace: {{ . | trim }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: "kedify-{{ $.Values.operator.name }}-http-admin"
subjects:
- kind: ServiceAccount
name: {{ ($.Values.serviceAccount.operator).name | default $.Values.serviceAccount.name }}
namespace: {{ $.Release.Namespace }}
---
{{- end }}
{{- end }}
{{- end }}
Loading

0 comments on commit 55b3cb5

Please sign in to comment.