-
Notifications
You must be signed in to change notification settings - Fork 1
Cleanup operator #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
monteiro-renato
wants to merge
14
commits into
main
Choose a base branch
from
cleanup-operator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Cleanup operator #280
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5cfa014
generate project
monteiro-renato 6165a5c
kubebuilder create api --group k6.io --version v1alpha1 --kind TestRu…
monteiro-renato 24f0abd
look for resources with specific labels
monteiro-renato 012a636
TestRun reconciler
monteiro-renato 39fcb8d
kubebuilder create api --group batch --version v1 --kind Job --contro…
monteiro-renato 75d21c5
Job Reconciler
monteiro-renato acf56d4
kubebuilder create api --group core --version v1 --kind Pod --control…
monteiro-renato d6dd63f
Pod Reconciler
monteiro-renato 2167b16
move workflow files to repo root
monteiro-renato 3ae0791
alphabetical
monteiro-renato e084eda
workflow file to build and push image
monteiro-renato 7336bca
use a predicate
monteiro-renato 2739a3c
add workflow permissions
monteiro-renato 6f3b93f
workflow file to deploy the operator
monteiro-renato File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,56 @@ | ||
| name: Build and Push Cleanup Operator | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| paths: | ||
| - "operators/cleaner/**" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| REGISTRY: altinnplatformvalidationtests.azurecr.io | ||
| IMAGE_NAME: cleanup-controller | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
| environment: test | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: ./operators/cleaner/go.mod | ||
|
|
||
| - name: Azure Login | ||
| uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 | ||
| with: | ||
| client-id: "${{ secrets.AZURE_CLIENT_ID }}" | ||
| tenant-id: "${{ secrets.AZURE_TENANT_ID }}" | ||
| subscription-id: "${{ secrets.AZURE_SUBSCRIPTION_ID }}" | ||
|
|
||
| - name: Login to ACR | ||
| run: | | ||
| az acr login --name ${{ env.REGISTRY }} | ||
|
|
||
| - name: Set image tag | ||
| id: vars | ||
| run: | | ||
| echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
| echo "img=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Build Docker image (Kubebuilder) | ||
| run: | | ||
| make docker-build IMG=${{ steps.vars.outputs.img }} | ||
| working-directory: ./operators/cleaner | ||
|
|
||
| - name: Push Docker image (Kubebuilder) | ||
| run: | | ||
| make docker-push IMG=${{ steps.vars.outputs.img }} | ||
| working-directory: ./operators/cleaner | ||
This file contains hidden or 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,41 @@ | ||
| name: Deploy Cleanup Operator | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| image_tag: | ||
| description: "Image tag to deploy (e.g. sha, semver, latest)" | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: "read" | ||
|
|
||
| env: | ||
| REGISTRY: altinnplatformvalidationtests.azurecr.io | ||
| IMAGE_NAME: cleanup-controller | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| environment: test | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup k8s client | ||
| uses: ./.github/actions/setup-k8s | ||
| with: | ||
| azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
| azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
| azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
|
|
||
| - name: Build full image reference | ||
| id: img | ||
| run: | | ||
| echo "image=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.image_tag }}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Deploy operator | ||
| run: | | ||
| make deploy IMG=${{ steps.img.outputs.image }} |
This file contains hidden or 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,33 @@ | ||
| name: Lint | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| lint: | ||
| permissions: | ||
| contents: read | ||
| name: Run on Ubuntu | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./operators/cleaner | ||
|
|
||
| steps: | ||
| - name: Clone the code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 | ||
| with: | ||
| go-version-file: ./operators/cleaner/go.mod | ||
|
|
||
| - name: Check linter configuration | ||
| run: make lint-config | ||
| - name: Run linter | ||
| run: make lint |
This file contains hidden or 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,42 @@ | ||
| name: E2E Tests | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| test-e2e: | ||
| permissions: | ||
| contents: read | ||
| name: Run on Ubuntu | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./operators/cleaner | ||
|
|
||
| steps: | ||
| - name: Clone the code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 | ||
| with: | ||
| go-version-file: operators/cleaner/go.mod | ||
|
|
||
| - name: Install the latest version of kind | ||
| run: | | ||
| curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-$(go env GOARCH) | ||
| chmod +x ./kind | ||
| sudo mv ./kind /usr/local/bin/kind | ||
|
|
||
| - name: Verify kind installation | ||
| run: kind version | ||
|
|
||
| - name: Running Test e2e | ||
| run: | | ||
| go mod tidy | ||
| make test-e2e |
This file contains hidden or 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,33 @@ | ||
| name: Tests | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| test: | ||
| permissions: | ||
| contents: read | ||
| name: Run on Ubuntu | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./operators/cleaner | ||
|
|
||
| steps: | ||
| - name: Clone the code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 | ||
| with: | ||
| go-version-file: operators/cleaner/go.mod | ||
|
|
||
| - name: Running Tests | ||
| run: | | ||
| go mod tidy | ||
| make test |
This file contains hidden or 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,11 @@ | ||
| # This file configures golangci-lint with module plugins. | ||
| # When you run 'make lint', it will automatically build a custom golangci-lint binary | ||
| # with all the plugins listed below. | ||
| # | ||
| # See: https://golangci-lint.run/plugins/module-plugins/ | ||
| version: v2.11.4 | ||
| plugins: | ||
| # logcheck validates structured logging calls and parameters (e.g., balanced key-value pairs) | ||
| - module: "sigs.k8s.io/logtools" | ||
| import: "sigs.k8s.io/logtools/logcheck/gclplugin" | ||
| version: latest |
This file contains hidden or 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,35 @@ | ||
| { | ||
| "name": "Kubebuilder DevContainer", | ||
| "image": "golang:1.25", | ||
| "features": { | ||
| "ghcr.io/devcontainers/features/docker-in-docker:2": { | ||
| "moby": false, | ||
| "dockerDefaultAddressPool": "base=172.30.0.0/16,size=24" | ||
| }, | ||
| "ghcr.io/devcontainers/features/git:1": {}, | ||
| "ghcr.io/devcontainers/features/common-utils:2": { | ||
| "upgradePackages": true | ||
| } | ||
| }, | ||
|
|
||
| "runArgs": ["--privileged", "--init"], | ||
|
|
||
| "customizations": { | ||
| "vscode": { | ||
| "settings": { | ||
| "terminal.integrated.shell.linux": "/bin/bash" | ||
| }, | ||
| "extensions": [ | ||
| "ms-kubernetes-tools.vscode-kubernetes-tools", | ||
| "ms-azuretools.vscode-docker" | ||
| ] | ||
| } | ||
| }, | ||
|
|
||
| "remoteEnv": { | ||
| "GO111MODULE": "on" | ||
| }, | ||
|
|
||
| "onCreateCommand": "bash .devcontainer/post-install.sh" | ||
| } | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.