Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
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
2 changes: 0 additions & 2 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
color: "ffc300"
- name: update/github-action
color: "ffc300"
- name: update/helm
color: "ffc300"
- name: update/go
color: "ffc300"
# Semantic Type
Expand Down
4 changes: 0 additions & 4 deletions .github/renovate/commitMessage.json5
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"commitMessageSuffix": "",
"group": { commitMessageTopic: "{{{groupName}}} group" },
"packageRules": [
{
"matchDatasources": ["helm"],
"commitMessageTopic": "chart {{depName}}"
},
{
"matchDatasources": ["docker"],
"commitMessageTopic": "image {{depName}}",
Expand Down
4 changes: 0 additions & 4 deletions .github/renovate/labels.json5
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
"matchUpdateTypes": ["patch"],
"labels": ["type/patch"]
},
{
"matchDatasources": ["helm"],
"addLabels": ["update/helm"]
},
{
"matchDatasources": ["docker"],
"addLabels": ["update/container"]
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: ./.github/actions/setup-go

- name: Install dependencies
run: make gotestsum go-cover-treemap setup-envtest helm
run: make gotestsum go-cover-treemap setup-envtest

- name: Install go modules for test
shell: bash
Expand All @@ -64,17 +64,17 @@ jobs:
ENCODED_CLOUDS_YAML: ${{ secrets.ENCODED_CLOUDS_YAML }}
run: make test-integration

# - name: Create Report
# run: make report-cover-html report-cover-treemap
# - name: Create Report
# run: make report-cover-html report-cover-treemap

# - name: Test Summary
# uses: test-summary/action@62bc5c68de2a6a0d02039763b8c754569df99e3f # v2.1
# with:
# paths: ".coverage/junit.xml"
# - name: Test Summary
# uses: test-summary/action@62bc5c68de2a6a0d02039763b8c754569df99e3f # v2.1
# with:
# paths: ".coverage/junit.xml"

# - name: Upload Report
# uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
# with:
# name: reports-${{ steps.name.outputs.name }}
# path: .reports
# retention-days: 30
# - name: Upload Report
# uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
# with:
# name: reports-${{ steps.name.outputs.name }}
# path: .reports
# retention-days: 30
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ temp
# Tilt files.
.tiltbuild
/tilt.d
tilt-settings.json
tilt-settings.yaml
tilt_config.json
baremetalhosts.yaml

Expand Down Expand Up @@ -60,13 +60,15 @@ out
_releasenotes
templates/cluster-templates/cluster-template*

# Helm
.helm

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
/_output
tmp_*

.cluster.yaml
.clusterstack.yaml
.cspotemplate.yaml
.secret.yaml
.release
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ $(TRIVY):
curl -sSL https://github.com/aquasecurity/trivy/releases/download/v0.45.1/trivy_0.45.1_Linux-64bit.tar.gz | tar xz -C $(TOOLS_BIN_DIR) trivy
chmod a+rx $(TRIVY)

HELM := $(abspath $(TOOLS_BIN_DIR)/helm)
helm: $(HELM) ## Build a local copy of helm
$(HELM):
curl -sSL https://get.helm.sh/helm-v3.12.2-linux-amd64.tar.gz | tar xz -C $(TOOLS_BIN_DIR) --strip-components=1 linux-amd64/helm
chmod a+rx $(HELM)

go-binsize-treemap := $(abspath $(TOOLS_BIN_DIR)/go-binsize-treemap)
go-binsize-treemap: $(go-binsize-treemap) # Build go-binsize-treemap from tools folder.
$(go-binsize-treemap):
Expand Down Expand Up @@ -537,7 +531,7 @@ test-unit: test-unit-openstack ## Run unit tests
echo done

.PHONY: test-unit-openstack
test-unit-openstack: $(SETUP_ENVTEST) $(GOTESTSUM) $(HELM)
test-unit-openstack: $(SETUP_ENVTEST) $(GOTESTSUM)
@mkdir -p $(shell pwd)/.coverage
KUBEBUILDER_ASSETS="$(KUBEBUILDER_ASSETS)" $(GOTESTSUM) --junitfile=.coverage/junit.xml --format testname -- -mod=vendor \
-covermode=atomic -coverprofile=.coverage/cover.out -p=4 ./internal/controller/...
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Note that it is a common practice to create a temporary, local [bootstrap cluste

- Install [Docker] and [kind]
- Install [kubectl]
- Install [Helm]
- Install [clusterctl]
- Install [go] # installation of the Go package `envsubst` is required to enable the expansion of variables specified in CSPO and CSO manifests.

Expand Down Expand Up @@ -165,7 +164,6 @@ CSPO currently exposes the following APIs:

<!-- links -->
[Docker]: https://www.docker.com/
[Helm]: https://helm.sh/docs/intro/install/
[kind]: https://kind.sigs.k8s.io/
[kubectl]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
[clusterctl]: https://cluster-api.sigs.k8s.io/user/quick-start.html#install-clusterctl
Expand Down
137 changes: 103 additions & 34 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@ settings = {
"allowed_contexts": [
"kind-cspo",
],
"local_mode": False,
"deploy_cert_manager": True,
"preload_images_for_kind": True,
"kind_cluster_name": "cspo",
"capi_version": "v1.5.2",
"cso_version": "v0.1.0-alpha.2",
"capi_version": "v1.6.0",
"cso_version": "v0.1.0-alpha.3",
"capo_version": "v0.8.0",
"cert_manager_version": "v1.13.1",
"kustomize_substitutions": {
},
}

# global settings
settings.update(read_json(
"tilt-settings.json",
settings.update(read_yaml(
"tilt-settings.yaml",
Comment thread
kranurag7 marked this conversation as resolved.
default = {},
))

Expand Down Expand Up @@ -61,12 +62,62 @@ def deploy_capi():
if kb_extra_args:
patch_args_with_extra_args("capi-kubeadm-bootstrap-system", "capi-kubeadm-bootstrap-controller-manager", kb_extra_args)

tilt_dockerfile_header_cso = """
FROM ghcr.io/sovereigncloudstack/cso:{} as builder

FROM docker.io/library/alpine:3.18.0 as tilt
WORKDIR /
COPY --from=builder /usr/local/bin/helm /usr/local/bin/helm
COPY --from=builder /manager /manager
COPY .release/ /tmp/downloads/cluster-stacks/
COPY local_cso.yaml /local_cso.yaml
""".format(settings.get("cso_version"))

def deploy_cso():
version = settings.get("cso_version")
cso_uri = "https://github.com/sovereignCloudStack/cluster-stack-operator/releases/download/{}/cso-infrastructure-components.yaml".format(version)
cmd = "curl -sSL {} | {} | kubectl apply -f -".format(cso_uri, envsubst_cmd)
local(cmd, quiet = True)

def deploy_local_cso():
yaml_cso = './local_cso.yaml'

entrypoint = ["/manager"]
extra_args = settings.get("extra_args")
if extra_args:
entrypoint.extend(extra_args)

docker_build_with_restart(
ref = "ghcr.io/sovereigncloudstack/cso-test",
context = ".",
dockerfile_contents = tilt_dockerfile_header_cso,
target = "tilt",
entrypoint = entrypoint,
live_update = [
sync("./local_cso.yaml", "/local_cso.yaml"), # reload when we change the manifest
Comment thread
chess-knight marked this conversation as resolved.
sync("./.release", "/tmp/downloads/cluster-stacks"),
],
)
k8s_yaml(yaml_cso)
k8s_resource(workload = "cso-controller-manager", labels = ["CSO"])
k8s_resource(
objects = [
"cso-system:namespace",
"clusteraddons.clusterstack.x-k8s.io:customresourcedefinition",
"clusterstackreleases.clusterstack.x-k8s.io:customresourcedefinition",
"clusterstacks.clusterstack.x-k8s.io:customresourcedefinition",
"cso-controller-manager:serviceaccount",
"cso-leader-election-role:role",
"cso-manager-role:clusterrole",
"cso-leader-election-rolebinding:rolebinding",
"cso-manager-rolebinding:clusterrolebinding",
"cso-serving-cert:certificate",
"cso-selfsigned-issuer:issuer",
],
new_name = "cso-misc",
labels = ["CSO"],
)

def deploy_capo():
version = settings.get("capo_version")
capo_uri = "https://github.com/kubernetes-sigs/cluster-api-provider-openstack/releases/download/{}/infrastructure-components.yaml".format(version)
Expand Down Expand Up @@ -124,14 +175,19 @@ def fixup_yaml_empty_arrays(yaml_str):
return yaml_str.replace("storedVersions: null", "storedVersions: []")

## This should have the same versions as the Dockerfile
tilt_dockerfile_header_cspo = """
FROM docker.io/alpine/helm:3.12.2 as helm
Comment thread
chess-knight marked this conversation as resolved.

FROM docker.io/library/alpine:3.18.0 as tilt
WORKDIR /
COPY --from=helm --chown=root:root --chmod=755 /usr/bin/helm /usr/local/bin/helm
COPY manager .
"""
if settings.get("local_mode"):
tilt_dockerfile_header_cspo = """
FROM docker.io/library/alpine:3.18.0 as tilt
WORKDIR /
COPY .tiltbuild/manager .
COPY .release/ /tmp/downloads/cluster-stacks/
"""
else:
tilt_dockerfile_header_cspo = """
FROM docker.io/library/alpine:3.18.0 as tilt
WORKDIR /
COPY manager .
"""


# Build cspo and add feature gates
Expand Down Expand Up @@ -164,36 +220,47 @@ def deploy_cspo():
if extra_args:
entrypoint.extend(extra_args)

# Set up an image build for the provider. The live update configuration syncs the output from the local_resource
# build into the container.
docker_build_with_restart(
ref = "ghcr.io/sovereigncloudstack/cspo-staging",
context = "./.tiltbuild/",
dockerfile_contents = tilt_dockerfile_header_cspo,
target = "tilt",
entrypoint = entrypoint,
only = "manager",
live_update = [
sync(".tiltbuild/manager", "/manager"),
],
ignore = ["templates"],
)
if settings.get("local_mode"):
docker_build_with_restart(
ref = "ghcr.io/sovereigncloudstack/cspo-staging",
context = ".",
dockerfile_contents = tilt_dockerfile_header_cspo,
target = "tilt",
entrypoint = entrypoint,
live_update = [
sync(".tiltbuild/manager", "/manager"),
sync(".release", "/tmp/downloads/cluster-stacks"),
],
ignore = ["templates"],
)
else:
docker_build_with_restart(
ref = "ghcr.io/sovereigncloudstack/cspo-staging",
context = "./.tiltbuild/",
dockerfile_contents = tilt_dockerfile_header_cspo,
target = "tilt",
entrypoint = entrypoint,
live_update = [
sync(".tiltbuild/manager", "/manager"),
],
ignore = ["templates"],
)
k8s_yaml(blob(yaml))
k8s_resource(workload = "cspo-controller-manager", labels = ["cspo"])
k8s_resource(
Comment thread
chess-knight marked this conversation as resolved.
objects = [
"cspo-system:namespace",
#"clusterstackreleases.clusterstack.x-k8s.io:customresourcedefinition",
#"clusterstacks.clusterstack.x-k8s.io:customresourcedefinition",
"cspo-controller-manager:serviceaccount",
"cspo-leader-election-role:role",
"cspo-manager-role:clusterrole",
"cspo-leader-election-rolebinding:rolebinding",
"cspo-manager-rolebinding:clusterrolebinding",
#"cspo-serving-cert:certificate",
"cspo-cluster-stack-variables:secret",
#"cspo-selfsigned-issuer:issuer",
#"cspo-validating-webhook-configuration:validatingwebhookconfiguration",
"openstackclusterstackreleases.infrastructure.clusterstack.x-k8s.io:customresourcedefinition",
"openstackclusterstackreleasetemplates.infrastructure.clusterstack.x-k8s.io:customresourcedefinition",
"openstacknodeimagereleases.infrastructure.clusterstack.x-k8s.io:customresourcedefinition",
# "cspo-serving-cert:certificate",
# "cspo-selfsigned-issuer:issuer", # uncomment when you add webhook code.
],
new_name = "cspo-misc",
labels = ["cspo"],
Expand All @@ -208,8 +275,7 @@ def cspo_template():
cspo_yaml = local(cmd, quiet=True)
k8s_yaml(cspo_yaml)
k8s_resource(objects = ["cspotemplate:openstackclusterstackreleasetemplate"], new_name = "cspotemplate", labels = ["cspo-template"])



def clusterstack():
k8s_resource(objects = ["clusterstack:clusterstack"], new_name = "clusterstack", labels = ["clusterstack"])
Comment thread
chess-knight marked this conversation as resolved.

Expand Down Expand Up @@ -272,7 +338,10 @@ if settings.get("deploy_observability"):

deploy_capi()

deploy_cso()
if settings.get("local_mode"):
deploy_local_cso()
else:
deploy_cso()

deploy_cspo()

Expand Down
2 changes: 1 addition & 1 deletion config/cspo/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
cidrBlocks: ["192.168.0.0/16"]
serviceDomain: "cluster.local"
topology:
class: openstack-ferrol-1-27-v1
class: openstack-scs-1-27-v2
controlPlane:
metadata: {}
replicas: 1
Expand Down
4 changes: 2 additions & 2 deletions config/cspo/clusterstack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: cluster
spec:
provider: openstack
name: ferrol
name: scs
kubernetesVersion: "1.27"
channel: stable
autoSubscribe: false
Expand All @@ -14,4 +14,4 @@ spec:
kind: OpenStackClusterStackReleaseTemplate
name: cspotemplate
versions:
- v1
- v2
Loading