Skip to content

Commit bdee878

Browse files
Merge pull request #12 from scality/feature/migate-to-new-operator-sdk-version
Rework the operator to bump the version and images
2 parents 1c96417 + a995660 commit bdee878

File tree

101 files changed

+4284
-3134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+4284
-3134
lines changed

.devcontainer/Dockerfile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
FROM mcr.microsoft.com/devcontainers/go:1.24-trixie
2+
3+
RUN export DEBIAN_FRONTEND=noninteractive && \
4+
apt-get update && \
5+
apt-get install --no-install-recommends -y \
6+
bash-completion \
7+
build-essential \
8+
curl \
9+
docker.io \
10+
genisoimage \
11+
gh \
12+
git \
13+
isomd5sum \
14+
libgpgme-dev \
15+
make \
16+
shellcheck \
17+
vim \
18+
yq \
19+
&& \
20+
apt-get clean
21+
22+
USER vscode
23+
24+
ARG OPERATOR_SDK_VERSION=1.42.0
25+
26+
RUN curl -sSfLO https://github.com/operator-framework/operator-sdk/releases/download/v${OPERATOR_SDK_VERSION}/operator-sdk_linux_amd64 && \
27+
chmod +x operator-sdk_linux_amd64 && \
28+
sudo mv operator-sdk_linux_amd64 /usr/local/bin/operator-sdk
29+
30+
ARG GOLANGCI_VERSION=2.5.0
31+
32+
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sudo sh -s -- v${GOLANGCI_VERSION}
33+
34+
ARG KIND_VERSION=0.31.0
35+
36+
RUN curl -sSfLO https://kind.sigs.k8s.io/dl/v${KIND_VERSION}/kind-linux-amd64 && \
37+
chmod +x kind-linux-amd64 && \
38+
sudo mv kind-linux-amd64 /usr/local/bin/kind
39+
40+
ARG KUBECTL_VERSION=1.35.2
41+
42+
RUN curl -sSfLO https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
43+
chmod +x kubectl && \
44+
sudo mv kubectl /usr/local/bin/kubectl
45+
46+
ARG KUSTOMIZE_VERSION=5.8.1
47+
48+
RUN curl -sSfL -o /tmp/kustomize.tar.gz https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \
49+
sudo tar -xzf /tmp/kustomize.tar.gz -C /usr/local/bin/ kustomize && \
50+
rm -rf /tmp/kustomize.tar.gz
51+
52+
ARG SKOPEO_VERSION=1.22.0
53+
54+
RUN curl -sSfL -o /tmp/skopeo.tar.gz https://github.com/containers/skopeo/archive/refs/tags/v${SKOPEO_VERSION}.tar.gz && \
55+
tar -zxvf /tmp/skopeo.tar.gz -C /tmp && \
56+
cd /tmp/skopeo-${SKOPEO_VERSION} && \
57+
sudo PATH=$PATH make bin/skopeo && \
58+
sudo mv bin/skopeo /usr/local/bin/ && \
59+
cd && \
60+
rm -rf /tmp/skopeo.tar.gz /tmp/skopeo-${SKOPEO_VERSION}

.devcontainer/devcontainer.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "Example Solution Operator",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"options": [
6+
"--platform=linux/amd64"
7+
]
8+
},
9+
"features": {
10+
"ghcr.io/devcontainers/features/sshd:1": {},
11+
"ghcr.io/devcontainers/features/github-cli:1": {},
12+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
13+
"dockerDashComposeVersion": "none",
14+
"moby": false
15+
}
16+
},
17+
"customizations": {
18+
"vscode": {
19+
"extensions": [
20+
//Create TODO and FIXME tree
21+
"Gruntfuggly.todo-tree",
22+
//Go support
23+
"golang.go",
24+
//Remote container support
25+
"ms-vscode-remote.remote-containers",
26+
//YAML support
27+
"redhat.vscode-yaml",
28+
//Github Action helper
29+
"github.vscode-github-actions",
30+
//Docker helper
31+
"ms-azuretools.vscode-docker",
32+
//Gherkin support and helper
33+
"CucumberOpen.cucumber-official",
34+
//Mardown support
35+
"yzhang.markdown-all-in-one",
36+
//Compare text selections
37+
"ryu1kn.partial-diff",
38+
//Ginko support
39+
"joselitofilho.ginkgotestexplorer"
40+
],
41+
"settings": {
42+
"telemetry.telemetryLevel": "off",
43+
"redhat.telemetry.enabled": false,
44+
"editor.renderWhitespace": "all",
45+
"terminal.integrated.profiles.linux": {
46+
"zsh": {
47+
"path": "/usr/bin/zsh"
48+
}
49+
},
50+
"terminal.integrated.defaultProfile.linux": "zsh",
51+
"python.terminal.activateEnvironment": false
52+
}
53+
}
54+
},
55+
"remoteUser": "vscode"
56+
}

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @scality/metalk8s

.github/workflows/build.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "Build"
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-24.04
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v6
12+
- name: Install dependencies
13+
run: |
14+
export DEBIAN_FRONTEND=noninteractive &&
15+
sudo apt-get update &&
16+
sudo apt-get install -y yq genisoimage make
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v3
19+
- name: Build ISO
20+
run: make iso
21+
- name: copy files to artifacts
22+
run: |
23+
mkdir -p artifacts
24+
cp -r _build/example-solution-*.iso _build/SHA256SUM artifacts
25+
- uses: scality/action-artifacts@v4
26+
with:
27+
url: https://artifacts.scality.net
28+
user: ${{ secrets.ARTIFACTS_USER }}
29+
password: ${{ secrets.ARTIFACTS_PASSWORD }}
30+
source: artifacts
31+
method: upload
32+
33+
write-final-status:
34+
runs-on: ubuntu-24.04
35+
needs:
36+
- build
37+
if: always()
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v6
41+
- name: Upload final status
42+
if: always()
43+
uses: scality/actions/upload_final_status@1.17.0
44+
with:
45+
ARTIFACTS_USER: ${{ secrets.ARTIFACTS_USER }}
46+
ARTIFACTS_PASSWORD: ${{ secrets.ARTIFACTS_PASSWORD }}
47+
JOBS_RESULTS: ${{ join(needs.*.result) }}

.github/workflows/pre-merge.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "Pre Merge"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
pull_request:
7+
branches:
8+
- "main"
9+
10+
jobs:
11+
build:
12+
uses: ./.github/workflows/build.yaml
13+
secrets: inherit
14+
15+
generate:
16+
runs-on: ubuntu-24.04
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
- name: Setup go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: operator/go.mod
24+
cache-dependency-path: operator/go.sum
25+
- name: Run code generation
26+
working-directory: operator
27+
# We run code generation to ensure that the generated code is up to date
28+
run: |
29+
go generate ./... &&
30+
make generate manifests &&
31+
git diff --quiet
32+
33+
lint:
34+
runs-on: ubuntu-24.04
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v6
38+
- name: Setup go
39+
uses: actions/setup-go@v5
40+
with:
41+
go-version-file: operator/go.mod
42+
cache-dependency-path: operator/go.sum
43+
- name: Run linters
44+
uses: golangci/golangci-lint-action@v8
45+
with:
46+
version: v2.5.0
47+
working-directory: operator

.github/workflows/promote.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Promote
2+
run-name: "Promote ${{ github.ref_name }}"
3+
4+
on:
5+
push:
6+
tags:
7+
- "*"
8+
9+
jobs:
10+
build:
11+
uses: ./.github/workflows/build.yaml
12+
secrets: inherit
13+
14+
promote-artifacts:
15+
needs: build
16+
runs-on: ubuntu-24.04
17+
outputs:
18+
artifact-link: ${{ steps.promote.outputs.link }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v6
22+
- name: Promote artifacts
23+
id: promote
24+
uses: scality/action-artifacts@v4
25+
with:
26+
method: promote
27+
url: https://artifacts.scality.net
28+
tag: ${{ github.ref_name }}
29+
user: ${{ secrets.ARTIFACTS_USER }}
30+
password: ${{ secrets.ARTIFACTS_PASSWORD }}
31+
32+
create-release:
33+
needs: promote-artifacts
34+
runs-on: ubuntu-24.04
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v6
38+
with:
39+
# NOTE: We explicitly set the refs otherwise the tag
40+
# annotations content is not fetched
41+
# See: https://github.com/actions/checkout/issues/882
42+
ref: ${{ github.ref }}
43+
- name: Retrieve ISO from artifacts
44+
run: >
45+
curl --fail -LO -u ${{ secrets.ARTIFACTS_USER }}:${{ secrets.ARTIFACTS_PASSWORD }}
46+
${{ needs.promote-artifacts.outputs.artifact-link }}/example-solution-${{ github.ref_name }}.iso
47+
${{ needs.promote-artifacts.outputs.artifact-link }}/SHA256SUM
48+
- uses: softprops/action-gh-release@v2
49+
with:
50+
name: MetalK8s Example Solution ${{ github.ref_name }}
51+
files: |
52+
example-solution-${{ github.ref_name }}.iso
53+
SHA256SUM
54+
tag_name: ${{ github.ref_name }}
55+
generate_release_notes: true
56+
# We consider pre-releases if the tag contains a hyphen
57+
# e.g. v1.2.3-alpha.0
58+
prerelease: ${{ contains(github.ref_name, '-') }}
59+
draft: false
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yaml

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)