Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/push-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get all changed dist/chart Chart.yaml files
id: changed-chart-yaml-files-dist
- name: Get all changed helm/library/cortex Chart.yaml files
id: changed-chart-yaml-files-core
uses: tj-actions/changed-files@v47
with:
files: |
dist/chart/Chart.yaml
- name: Push dist charts to registry
if: steps.changed-chart-yaml-files-dist.outputs.all_changed_files != ''
helm/library/cortex/Chart.yaml
- name: Push cortex core charts to registry
if: steps.changed-chart-yaml-files-core.outputs.all_changed_files != ''
shell: bash
env:
ALL_CHANGED_FILES: ${{ steps.changed-chart-yaml-files-dist.outputs.all_changed_files }}
ALL_CHANGED_FILES: ${{ steps.changed-chart-yaml-files-core.outputs.all_changed_files }}
run: |
for CHART_FILE in ${ALL_CHANGED_FILES}; do
CHART_DIR=$(dirname $CHART_FILE)
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/update-appversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ jobs:
git commit -m "Bump cortex-postgres chart appVersions to ${{ steps.vars.outputs.sha }} [skip ci]" || echo "No changes to commit"
git push origin HEAD:main

- name: Update appVersion in dist/chart/Chart.yaml
- name: Update appVersion in helm/library/cortex/Chart.yaml
run: |
sed -i 's/^\([ ]*appVersion:[ ]*\).*/\1"${{ steps.vars.outputs.sha }}"/' dist/chart/Chart.yaml
sed -i 's/^\([ ]*appVersion:[ ]*\).*/\1"${{ steps.vars.outputs.sha }}"/' helm/library/cortex/Chart.yaml
- name: Commit and push changes for cortex
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add dist/chart/Chart.yaml
git add helm/library/cortex/Chart.yaml
git commit -m "Bump cortex chart appVersions to ${{ steps.vars.outputs.sha }} [skip ci]" || echo "No changes to commit"
git push origin HEAD:main
92 changes: 35 additions & 57 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,75 +1,56 @@
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif

.PHONY: all
all: build
all: lint test crds deepcopy

.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:allowDangerousTypes=true webhook paths="./..." output:crd:artifacts:config=config/crd/bases
.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
"$(GOLANGCI_LINT)" run

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) crd:allowDangerousTypes=true object:headerFile="hack/boilerplate.go.txt" paths="./..."
.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
"$(GOLANGCI_LINT)" run --fix

.PHONY: dekustomize
dekustomize:
@echo "Backing up stuff that shouldn't be overridden by kubebuilder-helm..."
@TEMP_DIR=$$(mktemp -d); \
if [ -d "dist/chart/templates/rbac" ]; then \
cp -r dist/chart/templates/rbac "$$TEMP_DIR/rbac"; \
fi; \
if [ -d "dist/chart/templates/prometheus" ]; then \
cp -r dist/chart/templates/prometheus "$$TEMP_DIR/prometheus"; \
fi; \
if [ -d "dist/chart/templates/metrics" ]; then \
cp -r dist/chart/templates/metrics "$$TEMP_DIR/metrics"; \
fi; \
if [ -d ".github" ]; then \
cp -r .github "$$TEMP_DIR/github"; \
fi; \
echo "Generating helm chart..."; \
kubebuilder edit --plugins=helm/v1-alpha; \
echo "Restoring stuff that shouldn't be overridden by kubebuilder-helm..."; \
if [ -d "$$TEMP_DIR/rbac" ]; then \
rm -rf dist/chart/templates/rbac; \
cp -r "$$TEMP_DIR/rbac" dist/chart/templates/rbac; \
fi; \
if [ -d "$$TEMP_DIR/prometheus" ]; then \
rm -rf dist/chart/templates/prometheus; \
cp -r "$$TEMP_DIR/prometheus" dist/chart/templates/prometheus; \
fi; \
if [ -d "$$TEMP_DIR/metrics" ]; then \
rm -rf dist/chart/templates/metrics; \
cp -r "$$TEMP_DIR/metrics" dist/chart/templates/metrics; \
fi; \
if [ -d "$$TEMP_DIR/github" ]; then \
rm -rf .github; \
cp -r "$$TEMP_DIR/github" .github; \
fi; \
rm -rf "$$TEMP_DIR"; \
echo "Directories restored successfully."
.PHONY: test
test: ## Run all tests.
go test ./...

##@ Build
.PHONY: crds
crds: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:allowDangerousTypes=true webhook paths="./..." output:crd:artifacts:config=helm/library/cortex/files/crds

.PHONY: build
build: manifests generate dekustomize
.PHONY: deepcopy
deepcopy: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) crd:allowDangerousTypes=true object:headerFile="hack/boilerplate.go.txt" paths="./..." output:crd:artifacts:config=helm/library/cortex/files/crds

LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)

CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint

CONTROLLER_TOOLS_VERSION ?= v0.17.2
CONTROLLER_TOOLS_VERSION ?= v0.20.0
GOLANGCI_LINT_VERSION ?= v2.8.0

.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
Expand All @@ -86,6 +67,3 @@ mv $(1) $(1)-$(3) ;\
} ;\
ln -sf $(1)-$(3) $(1)
endef

lint:
golangci-lint run --config .golangci.yaml
14 changes: 7 additions & 7 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ docker_build('ghcr.io/cobaltcore-dev/cortex', '.',
dockerfile='Dockerfile',
only=['internal/', 'cmd/', 'api/', 'pkg', 'go.mod', 'go.sum', 'Dockerfile'],
)
local('sh helm/sync.sh dist/chart')
local('sh helm/sync.sh helm/library/cortex')

########### Cortex Bundles
docker_build('ghcr.io/cobaltcore-dev/cortex-postgres', 'postgres')
Expand All @@ -58,27 +58,27 @@ bundle_charts = [
]
dep_charts = {
'cortex-crds': [
('dist/chart', 'cortex'),
('helm/library/cortex', 'cortex'),
],
'cortex-nova': [
('helm/library/cortex-postgres', 'cortex-postgres'),
('dist/chart', 'cortex'),
('helm/library/cortex', 'cortex'),
],
'cortex-manila': [
('helm/library/cortex-postgres', 'cortex-postgres'),
('dist/chart', 'cortex'),
('helm/library/cortex', 'cortex'),
],
'cortex-cinder': [
('helm/library/cortex-postgres', 'cortex-postgres'),
('dist/chart', 'cortex'),
('helm/library/cortex', 'cortex'),
],
'cortex-ironcore': [
('helm/library/cortex-postgres', 'cortex-postgres'),
('dist/chart', 'cortex'),
('helm/library/cortex', 'cortex'),
],
'cortex-pods': [
('helm/library/cortex-postgres', 'cortex-postgres'),
('dist/chart', 'cortex'),
('helm/library/cortex', 'cortex'),
],
}

Expand Down
150 changes: 0 additions & 150 deletions config/crd/bases/cortex.cloud_deschedulings.yaml

This file was deleted.

Loading
Loading