Skip to content

Commit 4b8a694

Browse files
Release manager bundles v0.0.55 (core v0.0.42, postgres v0.5.14) and shim bundle v0.0.1 (core v0.0.1) (#705)
2 parents ce02ffe + ae216a0 commit 4b8a694

113 files changed

Lines changed: 5411 additions & 292 deletions

File tree

Some content is hidden

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

.github/renovate.json

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,57 @@
2222
"gomodTidy",
2323
"gomodUpdateImportPaths"
2424
],
25+
"regexManagers": [
26+
{
27+
"fileMatch": ["^Makefile$"],
28+
"matchStrings": ["CONTROLLER_TOOLS_VERSION \\?= (?<currentValue>v[\\d.]+)"],
29+
"depNameTemplate": "sigs.k8s.io/controller-tools",
30+
"datasourceTemplate": "go"
31+
},
32+
{
33+
"fileMatch": ["^Makefile$"],
34+
"matchStrings": ["GOLANGCI_LINT_VERSION \\?= (?<currentValue>v[\\d.]+)"],
35+
"depNameTemplate": "github.com/golangci/golangci-lint/v2",
36+
"datasourceTemplate": "go"
37+
},
38+
{
39+
"fileMatch": ["^Makefile$"],
40+
"matchStrings": ["GOTESTSUM_VERSION \\?= (?<currentValue>v[\\d.]+)"],
41+
"depNameTemplate": "gotest.tools/gotestsum",
42+
"datasourceTemplate": "go"
43+
},
44+
{
45+
"fileMatch": ["^postgres/Dockerfile$"],
46+
"matchStrings": ["FROM (?<depName>[^:\\n]+):(?<currentValue>[^@\\n]+)@sha256:(?<currentDigest>[a-f0-9]+)"],
47+
"datasourceTemplate": "docker"
48+
},
49+
{
50+
"fileMatch": ["^postgres/Dockerfile$"],
51+
"matchStrings": ["ENV PG_VERSION (?<currentValue>[\\d]+\\.[\\d]+)-[^\\n]+"],
52+
"depNameTemplate": "postgres",
53+
"datasourceTemplate": "docker",
54+
"versioningTemplate": "semver-coerced",
55+
"autoReplaceStringTemplate": "ENV PG_VERSION {{{newValue}}}-1.pgdg13+1"
56+
}
57+
],
2558
"packageRules": [
2659
{
2760
"matchPackageNames": [
2861
"golang"
2962
],
3063
"allowedVersions": "1.26.x"
3164
},
65+
{
66+
"matchPackageNames": [
67+
"postgres"
68+
],
69+
"matchFileNames": [
70+
"postgres/Dockerfile"
71+
],
72+
"allowedVersions": "17.x",
73+
"automerge": true,
74+
"groupName": "postgres Dockerfile"
75+
},
3276
{
3377
"matchPackageNames": [
3478
"/^github\\.com\\/sapcc\\/.*/"
@@ -39,6 +83,7 @@
3983
{
4084
"matchPackageNames": [
4185
"!/^github\\.com\\/sapcc\\/.*/",
86+
"!postgres",
4287
"/.*/"
4388
],
4489
"matchUpdateTypes": [
@@ -60,4 +105,4 @@
60105
"before 8am on Friday"
61106
],
62107
"semanticCommits": "disabled"
63-
}
108+
}

.github/workflows/push-charts.yaml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,6 @@ jobs:
2727
username: ${{ github.actor }}
2828
password: ${{ secrets.GITHUB_TOKEN }}
2929

30-
- name: Get all changed helm/library/cortex Chart.yaml files
31-
id: changed-chart-yaml-files-core
32-
uses: tj-actions/changed-files@v47
33-
with:
34-
files: |
35-
helm/library/cortex/Chart.yaml
36-
- name: Push cortex core charts to registry
37-
if: steps.changed-chart-yaml-files-core.outputs.all_changed_files != ''
38-
shell: bash
39-
env:
40-
ALL_CHANGED_FILES: ${{ steps.changed-chart-yaml-files-core.outputs.all_changed_files }}
41-
run: |
42-
for CHART_FILE in ${ALL_CHANGED_FILES}; do
43-
CHART_DIR=$(dirname $CHART_FILE)
44-
helm package $CHART_DIR --dependency-update --destination $CHART_DIR
45-
CHART_PACKAGE=$(ls $CHART_DIR/*.tgz)
46-
helm push $CHART_PACKAGE oci://${{ env.REGISTRY }}/${{ github.repository }}/charts/
47-
done
48-
4930
- name: Get all changed library Chart.yaml files
5031
id: changed-chart-yaml-files-library
5132
uses: tj-actions/changed-files@v47

.github/workflows/push-images.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,55 @@ jobs:
7272
subject-digest: ${{ steps.push_cortex_postgres.outputs.digest }}
7373
push-to-registry: true
7474

75+
# Only build and push the cortex-shim image if there are changes related
76+
# to the cortex shims (e.g., in cmd/shim or internal/shim).
77+
- name: Get all changed shim/ files
78+
id: changed_shim_files
79+
uses: tj-actions/changed-files@v47
80+
with:
81+
files: |
82+
cmd/shim/**
83+
internal/shim/**
84+
api/**
85+
pkg/**
86+
go.mod
87+
go.sum
88+
Dockerfile
89+
- name: Docker Meta (Cortex Shim)
90+
if: steps.changed_shim_files.outputs.all_changed_files != ''
91+
id: meta_cortex_shim
92+
uses: docker/metadata-action@v6
93+
with:
94+
images: ${{ env.REGISTRY }}/${{ github.repository }}-shim
95+
tags: |
96+
type=semver,pattern={{version}}
97+
type=semver,pattern={{major}}.{{minor}}
98+
type=sha
99+
latest
100+
env:
101+
DOCKER_METADATA_SHORT_SHA_LENGTH: 8
102+
- name: Build and Push Cortex Shim
103+
if: steps.changed_shim_files.outputs.all_changed_files != ''
104+
id: push_cortex_shim
105+
uses: docker/build-push-action@v7
106+
with:
107+
context: .
108+
platforms: linux/amd64,linux/arm64
109+
push: true
110+
tags: ${{ steps.meta_cortex_shim.outputs.tags }}
111+
labels: ${{ steps.meta_cortex_shim.outputs.labels }}
112+
build-args: |
113+
GIT_TAG=${{ github.ref_name }}
114+
GIT_COMMIT=${{ github.sha }}
115+
GOMAIN=cmd/shim/main.go
116+
- name: Generate Artifact Attestation for Cortex Shim
117+
if: steps.changed_shim_files.outputs.all_changed_files != ''
118+
uses: actions/attest-build-provenance@v4
119+
with:
120+
subject-name: ${{ env.REGISTRY }}/${{ github.repository }}-shim
121+
subject-digest: ${{ steps.push_cortex_shim.outputs.digest }}
122+
push-to-registry: true
123+
75124
# Build & push new cortex image
76125
- name: Docker Meta (Cortex)
77126
id: meta_cortex
@@ -98,6 +147,7 @@ jobs:
98147
build-args: |
99148
GIT_TAG=${{ github.ref_name }}
100149
GIT_COMMIT=${{ github.sha }}
150+
GOMAIN=cmd/manager/main.go
101151
- name: Generate Artifact Attestation for Cortex
102152
uses: actions/attest-build-provenance@v4
103153
with:

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
# Steps below are only executed if the workflow is triggered by a pull request
6161
- name: Delete old coverage comments (PR only)
6262
if: ${{ github.event_name == 'pull_request' }}
63-
uses: actions/github-script@v8
63+
uses: actions/github-script@v9
6464
with:
6565
script: |
6666
const { data: comments } = await github.rest.issues.listComments({
@@ -86,7 +86,7 @@ jobs:
8686
path: .
8787
- name: Post coverage comment (PR only)
8888
if: ${{ github.event_name == 'pull_request' }}
89-
uses: actions/github-script@v8
89+
uses: actions/github-script@v9
9090
# For external contributors, posting comments fail due to permission issues.
9191
continue-on-error: true
9292
with:

.github/workflows/update-appversion.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,27 @@ jobs:
4444
git commit -m "Bump cortex-postgres chart appVersions to ${{ steps.vars.outputs.sha }} [skip ci]" || echo "No changes to commit"
4545
git push origin HEAD:main
4646
47+
# Only bumped if there are changes in shim-related directories
48+
- name: Get all changed shim files
49+
id: changed_shim_files
50+
uses: tj-actions/changed-files@v47
51+
with:
52+
files: |
53+
internal/shim/**
54+
cmd/shim/**
55+
- name: Update appVersion in cortex-shim Chart.yaml
56+
if: steps.changed_shim_files.outputs.all_changed_files != ''
57+
run: |
58+
sed -i 's/^\([ ]*appVersion:[ ]*\).*/\1"${{ steps.vars.outputs.sha }}"/' helm/library/cortex-shim/Chart.yaml
59+
- name: Commit and push changes for cortex-shim
60+
if: steps.changed_shim_files.outputs.all_changed_files != ''
61+
run: |
62+
git config user.name "github-actions[bot]"
63+
git config user.email "github-actions[bot]@users.noreply.github.com"
64+
git add helm/library/cortex-shim/Chart.yaml
65+
git commit -m "Bump cortex-shim chart appVersions to ${{ steps.vars.outputs.sha }} [skip ci]" || echo "No changes to commit"
66+
git push origin HEAD:main
67+
4768
- name: Update appVersion in helm/library/cortex/Chart.yaml
4869
run: |
4970
sed -i 's/^\([ ]*appVersion:[ ]*\).*/\1"${{ steps.vars.outputs.sha }}"/' helm/library/cortex/Chart.yaml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ cortex.secrets.yaml
3434
!.editorconfig
3535
!.gitignore
3636
!.github
37+
!.gitkeep
3738
!.golangci.yaml
3839
!.license-scan-overrides.jsonl
3940
!.license-scan-rules.json

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ Helm charts:
5050
## Repository Structure
5151

5252
Code:
53-
- `cmd/main.go` is the entry point for the manager, which starts the controllers and webhooks
53+
- `cmd/manager/main.go` is the entry point for the manager, which starts the controllers and webhooks
54+
- `cmd/shim/main.go` is the entry point for cortex shims exposing cortex capabilities over REST endpoints
5455
- `api/v1alpha1` is where the CRD specs of cortex lives
5556
- `api/external` contains messages sent to cortex via http from external openstack services
5657
- `internal/scheduling` contains the logic for scheduling in different cloud domains

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ ARG TARGETARCH
66
ARG GO_MOD_PATH=.
77
ARG GOCACHE=/root/.cache/go-build
88
ENV GOCACHE=${GOCACHE}
9+
ARG GOMAIN=cmd/manager/main.go
10+
ENV GOMAIN=${GOMAIN}
911

1012
# Note: avoid using COPY to /lib which will lead to docker build errors.
1113
WORKDIR /workspace/${GO_MOD_PATH}
@@ -29,13 +31,13 @@ ENV GOOS=${TARGETOS:-linux}
2931
ENV GOARCH=${TARGETARCH}
3032
RUN --mount=type=cache,target=/go/pkg/mod/ \
3133
--mount=type=cache,target=${GOCACHE} \
32-
go build -a -o /manager cmd/main.go
34+
go build -a -o /main ${GOMAIN}
3335

3436
# Use distroless as minimal base image to package the manager binary
3537
# Refer to https://github.com/GoogleContainerTools/distroless for more details
3638
FROM gcr.io/distroless/static:nonroot
3739
WORKDIR /
38-
COPY --from=builder /manager .
40+
COPY --from=builder /main .
3941
USER 65532:65532
4042

41-
ENTRYPOINT ["/manager"]
43+
ENTRYPOINT ["/main"]

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
5858
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
5959
GOTESTSUM = $(LOCALBIN)/gotestsum
6060

61-
CONTROLLER_TOOLS_VERSION ?= v0.20.0
62-
GOLANGCI_LINT_VERSION ?= v2.9.0
61+
CONTROLLER_TOOLS_VERSION ?= v0.20.1
62+
GOLANGCI_LINT_VERSION ?= v2.11.4
6363
GOTESTSUM_VERSION ?= v1.13.0
6464

6565
.PHONY: controller-gen

Tiltfile

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
analytics_settings(False)
88

99
# Use the ACTIVE_DEPLOYMENTS env var to select which Cortex bundles to deploy.
10-
ACTIVE_DEPLOYMENTS_ENV = os.getenv('ACTIVE_DEPLOYMENTS', 'nova,manila,cinder,ironcore,pods')
10+
ACTIVE_DEPLOYMENTS_ENV = os.getenv(
11+
'ACTIVE_DEPLOYMENTS',
12+
'nova,manila,cinder,ironcore,pods,placement',
13+
)
1114
if ACTIVE_DEPLOYMENTS_ENV == "":
1215
ACTIVE_DEPLOYMENTS = [] # Catch "".split(",") = [""]
1316
else:
@@ -50,6 +53,11 @@ helm_repo(
5053
'https://prometheus-community.github.io/helm-charts',
5154
labels=['Repositories'],
5255
)
56+
helm_repo(
57+
'perses',
58+
'https://perses.github.io/helm-charts',
59+
labels=['Repositories'],
60+
)
5361

5462
########### Certmanager
5563
# Certmanager is required for the validating webhooks in the cortex bundles, so
@@ -78,13 +86,22 @@ local('kubectl wait --namespace cert-manager --for=condition=available deploymen
7886
url = 'https://raw.githubusercontent.com/cobaltcore-dev/openstack-hypervisor-operator/refs/heads/main/charts/openstack-hypervisor-operator/crds/kvm.cloud.sap_hypervisors.yaml'
7987
local('curl -L ' + url + ' | kubectl apply -f -')
8088

81-
########### Cortex Operator & CRDs
89+
########### Cortex Manager & CRDs
8290
docker_build('ghcr.io/cobaltcore-dev/cortex', '.',
8391
dockerfile='Dockerfile',
92+
build_args={'GOMAIN': 'cmd/manager/main.go'},
8493
only=['internal/', 'cmd/', 'api/', 'pkg', 'go.mod', 'go.sum', 'Dockerfile'],
8594
)
8695
local('sh helm/sync.sh helm/library/cortex')
8796

97+
########### Cortex Shim
98+
docker_build('ghcr.io/cobaltcore-dev/cortex-shim', '.',
99+
dockerfile='Dockerfile',
100+
build_args={'GOMAIN': 'cmd/shim/main.go'},
101+
only=['internal/', 'cmd/', 'api/', 'pkg', 'go.mod', 'go.sum', 'Dockerfile'],
102+
)
103+
local('sh helm/sync.sh helm/library/cortex-shim')
104+
88105
########### Cortex Bundles
89106
docker_build('ghcr.io/cobaltcore-dev/cortex-postgres', 'postgres')
90107

@@ -98,6 +115,7 @@ bundle_charts = [
98115
('helm/bundles/cortex-cinder', 'cortex-cinder'),
99116
('helm/bundles/cortex-ironcore', 'cortex-ironcore'),
100117
('helm/bundles/cortex-pods', 'cortex-pods'),
118+
('helm/bundles/cortex-placement-shim', 'cortex-placement-shim'),
101119
]
102120
dep_charts = {
103121
'cortex-crds': [
@@ -123,6 +141,9 @@ dep_charts = {
123141
('helm/library/cortex-postgres', 'cortex-postgres'),
124142
('helm/library/cortex', 'cortex'),
125143
],
144+
'cortex-placement-shim': [
145+
('helm/library/cortex-shim', 'cortex-shim'),
146+
],
126147
}
127148

128149
for (bundle_chart_path, bundle_chart_name) in bundle_charts:
@@ -184,14 +205,14 @@ if 'nova' in ACTIVE_DEPLOYMENTS:
184205
k8s_resource('cortex-nova-knowledge-controller-manager', labels=['Cortex-Nova'])
185206
local_resource(
186207
'Scheduler E2E Tests (Nova)',
187-
'/bin/sh -c "kubectl exec deploy/cortex-nova-scheduling-controller-manager -- /manager e2e-nova"',
208+
'/bin/sh -c "kubectl exec deploy/cortex-nova-scheduling-controller-manager -- /main e2e-nova"',
188209
labels=['Cortex-Nova'],
189210
trigger_mode=TRIGGER_MODE_MANUAL,
190211
auto_init=False,
191212
)
192213
local_resource(
193214
'Commitments E2E Tests',
194-
'/bin/sh -c "kubectl exec deploy/cortex-nova-scheduling-controller-manager -- /manager e2e-commitments"',
215+
'/bin/sh -c "kubectl exec deploy/cortex-nova-scheduling-controller-manager -- /main e2e-commitments"',
195216
labels=['Cortex-Nova'],
196217
trigger_mode=TRIGGER_MODE_MANUAL,
197218
auto_init=False,
@@ -209,7 +230,7 @@ if 'manila' in ACTIVE_DEPLOYMENTS:
209230
k8s_resource('cortex-manila-knowledge-controller-manager', labels=['Cortex-Manila'])
210231
local_resource(
211232
'Scheduler E2E Tests (Manila)',
212-
'/bin/sh -c "kubectl exec deploy/cortex-manila-scheduling-controller-manager -- /manager e2e-manila"',
233+
'/bin/sh -c "kubectl exec deploy/cortex-manila-scheduling-controller-manager -- /main e2e-manila"',
213234
labels=['Cortex-Manila'],
214235
trigger_mode=TRIGGER_MODE_MANUAL,
215236
auto_init=False,
@@ -226,7 +247,7 @@ if 'cinder' in ACTIVE_DEPLOYMENTS:
226247
k8s_resource('cortex-cinder-knowledge-controller-manager', labels=['Cortex-Cinder'])
227248
local_resource(
228249
'Scheduler E2E Tests (Cinder)',
229-
'/bin/sh -c "kubectl exec deploy/cortex-cinder-scheduling-controller-manager -- /manager e2e-cinder"',
250+
'/bin/sh -c "kubectl exec deploy/cortex-cinder-scheduling-controller-manager -- /main e2e-cinder"',
230251
labels=['Cortex-Cinder'],
231252
trigger_mode=TRIGGER_MODE_MANUAL,
232253
auto_init=False,
@@ -255,6 +276,10 @@ if 'pods' in ACTIVE_DEPLOYMENTS:
255276
k8s_yaml('samples/pods/pod.yaml')
256277
k8s_resource('test-pod', labels=['Cortex-Pods'])
257278

279+
if 'placement' in ACTIVE_DEPLOYMENTS:
280+
print("Activating Cortex Placement Shim bundle")
281+
k8s_yaml(helm('./helm/bundles/cortex-placement-shim', name='cortex-placement-shim', values=tilt_values, set=env_set_overrides))
282+
258283
########### Dev Dependencies
259284
local('sh helm/sync.sh helm/dev/cortex-prometheus-operator')
260285
k8s_yaml(helm('./helm/dev/cortex-prometheus-operator', name='cortex-prometheus-operator')) # Operator
@@ -282,3 +307,20 @@ k8s_resource('cortex-plutono', port_forwards=[
282307
], links=[
283308
link('http://localhost:5000/d/cortex/cortex?orgId=1', 'cortex dashboard'),
284309
], labels=['Monitoring'])
310+
311+
helm_resource(
312+
'cortex-perses',
313+
'perses/perses',
314+
flags=['--values=./tools/perses/values.yaml'],
315+
port_forwards=[port_forward(5080, 8080, name='perses')],
316+
links=[link('http://localhost:5080', 'perses dashboard')],
317+
labels=['Monitoring'],
318+
resource_deps=['perses'],
319+
)
320+
watch_file('./tools/perses/dashboards')
321+
k8s_yaml(local(' '.join([
322+
'kubectl create configmap cortex-perses-dashboards',
323+
'--from-file=./tools/perses/dashboards/',
324+
'--dry-run=client -o yaml |',
325+
'kubectl label --local -f - perses.dev/resource=true --dry-run=client -o yaml',
326+
])))

0 commit comments

Comments
 (0)