Skip to content

Commit

Permalink
feat(client): add optional in-memory cache to client (#9521)
Browse files Browse the repository at this point in the history
* initial api cache implementation

* use single cache

* add token exchange

* add args validation

* add a lock mechanism

* add arg for cache refresh

* add more logging

* go mod tidy and add more logging

* hash cache keys

* refactor client cache and replace print with klog in the api module

* make key fields private

* add error handler

* cache secrets

* fix secret kind

* cache nodes

* cache namespaces

* cache persistent volumes

* cache persistent volume claims

* move cache out of core package

* fix import cycle

* fix sha generation and token exchange error handling

* fix build

* fix dependencies

* update log messages

* add pprof/prometheus metrics handlers and synced load optimization

* tiny refactor

* build and push API image from PR

* ignore chart version bump check

* update ci helm action

* store load locks in a map

* do not return nils

* fix nil pointer when user has no permissions to cache

* small refactor

* add license headers

* remove unused function

* refactor

* cleanup logging levels

* update args documentation

* update proxy mode arg doc

* add cache design documentation template

* cache design doc: add motivation paragraph

* update docs

* update docs

* cache design doc: initial draft

* add goals

* merge goals

* ide suggestions

* merge goals

* add cache sequence diagram

* update proposal section

* small changes

* add second sequence diagram

* start describing implementation

* update implementation paragraph

---------

Co-authored-by: Marcin Maciaszczyk <[email protected]>
  • Loading branch information
floreks and maciaszczykm authored Oct 22, 2024
1 parent 7411227 commit 9d28815
Show file tree
Hide file tree
Showing 112 changed files with 1,876 additions and 274 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/ci-helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,31 @@ jobs:
name: Lint and test
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- uses: azure/[email protected]
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.12.1
- uses: helm/[email protected]
- id: list-changed
- name: Set up Chart Testing CLI
uses: helm/[email protected]
- name: Change Detection
id: list-changed
run: |
changed=$(ct list-changed --config=.ct.yml --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- if: steps.list-changed.outputs.changed == 'true'
run: ct lint --config=.ct.yml --target-branch ${{ github.event.repository.default_branch }}
- if: steps.list-changed.outputs.changed == 'true'
- name: Lint Chart
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --config=.ct.yml --target-branch ${{ github.event.repository.default_branch }} --check-version-increment=false
- name: Set up Kind
if: steps.list-changed.outputs.changed == 'true'
uses: helm/[email protected]
with:
node_image: kindest/node:v1.30.2
- if: steps.list-changed.outputs.changed == 'true'
- name: Install Chart
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }}
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,62 @@ jobs:
fetch-depth: 0
- run: make image

publish:
name: Build and push API container
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Docket meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/kubernetes/dashboard-api
docker.io/kubernetesui/dashboard-api
tags: |
type=sha
type=ref,event=pr
type=ref,event=branch
type=semver,pattern={{version}},value=${{ needs.prepare.outputs.new_release_version }}
- name: Set up QEMU
uses: docker/[email protected]
- name: set up Docker Buildx
uses: docker/[email protected]
with:
config: .github/buildkitd.toml
- name: Login to Docker
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_RELEASE_USER }}
password: ${{ secrets.DOCKER_RELEASE_PASS }}
- name: Login to GHCR
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: push
uses: docker/build-push-action@v6
with:
context: modules
file: modules/api/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ steps.meta.outputs.version || 'latest' }}
unit-tests:
name: Unit tests with coverage
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions charts/kubernetes-dashboard/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Congratulations! You have just installed Kubernetes Dashboard in your cluster.
{{ if not (.Values.nginx.enabled) }}
To access Dashboard run:
kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-kong-proxy 8443:443
kubectl -n {{ .Release.Namespace }} port-forward svc/{{ .Release.Name }}-kong-proxy 8443:443

NOTE: In case port-forward command does not work, make sure that kong service name is correct.
Check the services in Kubernetes Dashboard namespace using:
Expand All @@ -17,7 +17,7 @@ Dashboard will be available at:

{{ if and (has "localhost" .Values.app.ingress.hosts) (eq .Values.app.ingress.ingressClassName "internal-nginx") (.Values.nginx.enabled) }}
To access Dashboard run:
kubectl -n kubernetes-dashboard port-forward svc/kubernetes-dashboard-nginx-controller 8443:443
kubectl -n {{ .Release.Namespace }} port-forward svc/{{ .Release.Name }}-nginx-controller 8443:443

NOTE: In case port-forward command does not work, make sure that nginx service name is correct.
Check the services in Kubernetes Dashboard namespace using:
Expand Down
Loading

0 comments on commit 9d28815

Please sign in to comment.