diff --git a/.github/labels.yaml b/.github/labels.yaml index 3f5706ff..af7ac07f 100644 --- a/.github/labels.yaml +++ b/.github/labels.yaml @@ -29,8 +29,6 @@ color: "ffc300" - name: update/github-action color: "ffc300" -- name: update/helm - color: "ffc300" - name: update/go color: "ffc300" # Semantic Type diff --git a/.github/renovate/commitMessage.json5 b/.github/renovate/commitMessage.json5 index d6234c34..36d03b7d 100644 --- a/.github/renovate/commitMessage.json5 +++ b/.github/renovate/commitMessage.json5 @@ -5,10 +5,6 @@ "commitMessageSuffix": "", "group": { commitMessageTopic: "{{{groupName}}} group" }, "packageRules": [ - { - "matchDatasources": ["helm"], - "commitMessageTopic": "chart {{depName}}" - }, { "matchDatasources": ["docker"], "commitMessageTopic": "image {{depName}}", diff --git a/.github/renovate/labels.json5 b/.github/renovate/labels.json5 index 815dcebb..21dbd4cf 100644 --- a/.github/renovate/labels.json5 +++ b/.github/renovate/labels.json5 @@ -12,10 +12,6 @@ "matchUpdateTypes": ["patch"], "labels": ["type/patch"] }, - { - "matchDatasources": ["helm"], - "addLabels": ["update/helm"] - }, { "matchDatasources": ["docker"], "addLabels": ["update/container"] diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e3e0a7cc..12335b5a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index 9908a07d..1c1fe519 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ temp # Tilt files. .tiltbuild /tilt.d -tilt-settings.json +tilt-settings.yaml tilt_config.json baremetalhosts.yaml @@ -60,9 +60,6 @@ out _releasenotes templates/cluster-templates/cluster-template* -# Helm -.helm - # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -70,3 +67,8 @@ __pycache__/ /_output tmp_* +.cluster.yaml +.clusterstack.yaml +.cspotemplate.yaml +.secret.yaml +.release diff --git a/Makefile b/Makefile index 5609b04f..a83cf263 100644 --- a/Makefile +++ b/Makefile @@ -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): @@ -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/... diff --git a/README.md b/README.md index 546c60b8..e42343ae 100644 --- a/README.md +++ b/README.md @@ -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. @@ -165,7 +164,6 @@ CSPO currently exposes the following APIs: [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 diff --git a/Tiltfile b/Tiltfile index a7bd28da..69bd2c00 100644 --- a/Tiltfile +++ b/Tiltfile @@ -17,11 +17,12 @@ 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": { @@ -29,8 +30,8 @@ settings = { } # global settings -settings.update(read_json( - "tilt-settings.json", +settings.update(read_yaml( + "tilt-settings.yaml", default = {}, )) @@ -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 + 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) @@ -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 - -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 @@ -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( 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"], @@ -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"]) @@ -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() diff --git a/config/cspo/cluster.yaml b/config/cspo/cluster.yaml index d58f6d7e..93ebe35e 100644 --- a/config/cspo/cluster.yaml +++ b/config/cspo/cluster.yaml @@ -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 diff --git a/config/cspo/clusterstack.yaml b/config/cspo/clusterstack.yaml index 96a584bc..cb11c030 100644 --- a/config/cspo/clusterstack.yaml +++ b/config/cspo/clusterstack.yaml @@ -5,7 +5,7 @@ metadata: namespace: cluster spec: provider: openstack - name: ferrol + name: scs kubernetesVersion: "1.27" channel: stable autoSubscribe: false @@ -14,4 +14,4 @@ spec: kind: OpenStackClusterStackReleaseTemplate name: cspotemplate versions: - - v1 + - v2 diff --git a/docs/develop.md b/docs/develop.md index 2b765248..620ccf64 100644 --- a/docs/develop.md +++ b/docs/develop.md @@ -24,7 +24,7 @@ make tilt-up > To access the Tilt UI please go to: `http://localhost:10351` -You should make sure that everything in the UI looks green. If not, you can trigger the Tilt workflow again. +You should make sure that everything in the UI looks green. If not, you can trigger the Tilt workflow again. In the case of the `cspotemplate`, this might be necessary, as it cannot be applied right after the startup of the cluster and fails. Tilt unfortunately does not include a waiting period. If everything is green, then you can already check for your clusterstack that has been deployed. You can use a tool like k9s to have a look at the management cluster and its custom resources. @@ -50,3 +50,44 @@ make delete-bootstrap-cluster ``` If you have any trouble finding the right command, then you can use `make help` to get a list of all available make targets. + +## Toggle between local_mode and remote mode +We can retrieve cluster-stacks in two modes. One way is to let the controller fetch it from GitHub which is remote mode and other is we mount the cluster-stacks inside the container at `/tmp/downloads/cluster-stacks` directory. + +> [!NOTE] +> Using remote mode is the default behavior. + +Switching between both modes is relatively simple if you're using Tilt. There is a file at the root of the repo `tilt-settings.yaml.example` +Make a copy of that file with the name of `tilt-settings.yaml` +```bash +cp tilt-settings.yaml.example tilt-settings.yaml +``` +Now, open the file and set the `local_mode` to `true` to use cluster-stacks in local_mode. It should look the following content wise. +```yaml +local_mode: true +``` + +> [!NOTE] +> In this mode you need to have cluster-stacks present locally. + +Downloading cluster-stacks can be achieved by many ways but below is a simple way to download it quickly. +```bash +mkdir -p .release/openstack-scs-1-27-v1/ +cd .release/openstack-scs-1-27-v1 +gh release download --repo sovereigncloudstack/cluster-stacks openstack-scs-1-27-v1 +``` +Change the repo and tag as per the requirement. You can also download it directly from browser and move it to `.release` directory. + +Please make sure the directory structure remains the same otherwise you'll not be able to start the tilt setup. Here's an example of structuring `openstack-scs-1-27-v1` cluster-stack. +```bash +$ tree .release/openstack-scs-1-27-v1/ +.release/openstack-scs-1-27-v1/ +├── clusterstack.yaml +├── metadata.yaml +└── openstack-scs-1-27-cluster-class-v1.tgz +``` + +> [!IMPORTANT] +There's an alternative way to get clusterstacks using [csmctl](https://github.com/sovereigncloudstack/csmctl). You can follow the README of csmctl for specific instructions and a good quickstart. + +You can use `csmctl create` subcommand to create clusterstack locally. You'll need a csmctl.yaml file in the cluster-stack configuration directory. Please read more about creating configuration file for csmctl in the csmctl docs. \ No newline at end of file diff --git a/local_cso.yaml b/local_cso.yaml new file mode 100644 index 00000000..a1ce13bc --- /dev/null +++ b/local_cso.yaml @@ -0,0 +1,939 @@ +apiVersion: v1 +kind: Namespace +metadata: + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + control-plane: cso-controller-manager + name: cso-system +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.12.0 + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + cluster.x-k8s.io/v1beta1: v1beta1 + name: clusteraddons.clusterstack.x-k8s.io +spec: + group: clusterstack.x-k8s.io + names: + kind: ClusterAddon + listKind: ClusterAddonList + plural: clusteraddons + singular: clusteraddon + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.ownerReferences[?(@.kind=="Cluster")].name + name: Cluster + type: string + - jsonPath: .status.ready + name: Ready + type: boolean + - description: Time duration since creation of Cluster Addon + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .status.conditions[?(@.type=='Ready')].reason + name: Reason + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].message + name: Message + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: ClusterAddon is the schema for the clusteraddons API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ClusterAddonSpec defines the desired state of a ClusterAddon + object. + properties: + clusterRef: + description: ClusterRef is the reference to the clusterv1.Cluster + object that corresponds to the workload cluster where this controller + applies the cluster addons. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of + an entire object, this string should contain a valid JSON/Go + field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within + a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" + (container with index 2 in this pod). This syntax is chosen + only to have some well-defined way of referencing a part of + an object. TODO: this design is not final and this field is + subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic + clusterStack: + description: ClusterStack is the full string --- that will be filled with the cluster stack that + the respective cluster uses currently. It always matches cluster.spec.topology.class + if the work of this controller is done. + type: string + version: + description: Version is the version of the cluster addons that have + been applied in the workload cluster. + type: string + required: + - clusterRef + type: object + status: + description: ClusterAddonStatus defines the observed state of ClusterAddon. + properties: + conditions: + description: Conditions define the current service state of the ClusterAddon. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + ready: + default: false + type: boolean + resources: + description: Resources specifies the status of the resources that + this object administrates. + items: + description: Resource defines the status of a resource. + properties: + error: + description: Error specifies the error of the last time this + object has been applied. + type: string + group: + description: Group specifies the group of the object. + type: string + kind: + description: Kind specifies the kind of the object. + type: string + name: + description: Name specifies the name of the object. + type: string + namespace: + description: Namespace specifies the namespace of the object. + type: string + status: + description: Status specifies the status of the object being + applied. + type: string + version: + description: Version specifies the version of the object. + type: string + type: object + type: array + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.12.0 + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + cluster.x-k8s.io/v1beta1: v1beta1 + name: clusterstackreleases.clusterstack.x-k8s.io +spec: + group: clusterstack.x-k8s.io + names: + kind: ClusterStackRelease + listKind: ClusterStackReleaseList + plural: clusterstackreleases + singular: clusterstackrelease + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .status.kubernetesVersion + name: K8s Version + type: string + - jsonPath: .status.ready + name: Ready + type: boolean + - description: Time duration since creation of ClusterStackRelease + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .status.conditions[?(@.type=='Ready')].reason + name: Reason + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].message + name: Message + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: ClusterStackRelease is the Schema for the clusterstackreleases + API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ClusterStackReleaseSpec defines the desired state of ClusterStackRelease. + properties: + providerRef: + description: ProviderRef specifies the reference to the ProviderClusterStackRelease + object. It has to be set only if the object exists, i.e. if the + noProvider mode is turned off. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of + an entire object, this string should contain a valid JSON/Go + field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within + a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" + (container with index 2 in this pod). This syntax is chosen + only to have some well-defined way of referencing a part of + an object. TODO: this design is not final and this field is + subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic + type: object + status: + description: ClusterStackReleaseStatus defines the observed state of ClusterStackRelease. + properties: + conditions: + description: Conditions defines current service state of the ClusterAddon. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + kubernetesVersion: + description: KubernetesVersion is the Kubernetes version incl. patch + version, e.g. 1.26.6. The controller fetches the version from the + release assets of the cluster stack. + type: string + ready: + default: false + type: boolean + resources: + description: Resources specifies the status of the resources that + this object administrates. + items: + description: Resource defines the status of a resource. + properties: + error: + description: Error specifies the error of the last time this + object has been applied. + type: string + group: + description: Group specifies the group of the object. + type: string + kind: + description: Kind specifies the kind of the object. + type: string + name: + description: Name specifies the name of the object. + type: string + namespace: + description: Namespace specifies the namespace of the object. + type: string + status: + description: Status specifies the status of the object being + applied. + type: string + version: + description: Version specifies the version of the object. + type: string + type: object + type: array + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.12.0 + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + cluster.x-k8s.io/v1beta1: v1beta1 + name: clusterstacks.clusterstack.x-k8s.io +spec: + group: clusterstack.x-k8s.io + names: + kind: ClusterStack + listKind: ClusterStackList + plural: clusterstacks + singular: clusterstack + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.provider + name: Provider + type: string + - jsonPath: .spec.name + name: ClusterStack + type: string + - jsonPath: .spec.kubernetesVersion + name: K8s + type: string + - jsonPath: .spec.channel + name: Channel + type: string + - jsonPath: .spec.autoSubscribe + name: Autosubscribe + type: string + - jsonPath: .status.usableVersions + name: Usable + type: string + - jsonPath: .status.latestRelease + name: Latest + type: string + - description: Time duration since creation of ClusterStack + jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .status.conditions[?(@.type=='Ready')].reason + name: Reason + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].message + name: Message + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: ClusterStack is the Schema for the clusterstacks API. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ClusterStackSpec defines the desired state of ClusterStack. + properties: + autoSubscribe: + default: true + description: AutoSubscribe is a feature where the operator checks + automatically if there are new versions of this cluster stack available. + type: boolean + channel: + default: stable + description: Channel specifies the release channel of the cluster + stack. Defaults to 'stable'. + enum: + - stable + - custom + type: string + kubernetesVersion: + description: KubernetesVersion is the Kubernetes version in the format + '.', e.g. 1.26. + pattern: ^\d\.\d+$ + type: string + name: + description: Name is the name of the cluster stack. + minLength: 1 + type: string + noProvider: + default: false + description: NoProvider indicates if set on true that there is no + provider-specific implementation and operator. + type: boolean + provider: + description: Provider is the name of the cluster stack provider. + minLength: 1 + type: string + providerRef: + description: ProviderRef has to reference the ProviderClusterStackReleaseTemplate + that contains all provider-specific information. + properties: + apiVersion: + description: API version of the referent. + type: string + fieldPath: + description: 'If referring to a piece of an object instead of + an entire object, this string should contain a valid JSON/Go + field access statement, such as desiredState.manifest.containers[2]. + For example, if the object reference is to a container within + a pod, this would take on a value like: "spec.containers{name}" + (where "name" refers to the name of the container that triggered + the event) or if no container name is specified "spec.containers[2]" + (container with index 2 in this pod). This syntax is chosen + only to have some well-defined way of referencing a part of + an object. TODO: this design is not final and this field is + subject to change in the future.' + type: string + kind: + description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + resourceVersion: + description: 'Specific resourceVersion to which this reference + is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency' + type: string + uid: + description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' + type: string + type: object + x-kubernetes-map-type: atomic + versions: + description: Versions is a list of version of the cluster stack that + should be available in the management cluster. A version has to + have the format 'v', e.g. v1 for stable channel or, + v1-alpha.1 for alpha channel. The versions have to correspond to + the channel property. + items: + type: string + type: array + required: + - kubernetesVersion + - name + - provider + type: object + status: + description: ClusterStackStatus defines the observed state of ClusterStack. + properties: + conditions: + description: Conditions provide observations of the operational state + of a Cluster API resource. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + latestRelease: + type: string + summary: + items: + description: ClusterStackReleaseSummary gives the summary of the + status of a ClusterStackRelease object. + properties: + message: + type: string + name: + type: string + phase: + description: ClusterStackReleasePhase is the phase of a ClusterStackRelease + object. + type: string + ready: + type: boolean + required: + - name + - phase + - ready + type: object + type: array + usableVersions: + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + name: cso-controller-manager + namespace: cso-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + name: cso-leader-election-role + namespace: cso-system +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + name: cso-manager-role +rules: +- apiGroups: + - "" + resources: + - events + verbs: + - create + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - secrets + verbs: + - get + - list + - update + - watch +- apiGroups: + - bootstrap.cluster.x-k8s.io + - cluster.x-k8s.io + - controlplane.cluster.x-k8s.io + - infrastructure.cluster.x-k8s.io + resources: + - '*' + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - cluster.x-k8s.io + resources: + - clusters + verbs: + - get +- apiGroups: + - clusterstack.x-k8s.io + resources: + - clusteraddons + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - clusterstack.x-k8s.io + resources: + - clusteraddons/finalizers + verbs: + - update +- apiGroups: + - clusterstack.x-k8s.io + resources: + - clusteraddons/status + verbs: + - get + - patch + - update +- apiGroups: + - clusterstack.x-k8s.io + resources: + - clusterstackreleases + verbs: + - create + - delete + - get + - list + - patch + - watch +- apiGroups: + - clusterstack.x-k8s.io + resources: + - clusterstackreleases/finalizers + verbs: + - update +- apiGroups: + - clusterstack.x-k8s.io + resources: + - clusterstackreleases/status + verbs: + - get + - patch + - update +- apiGroups: + - clusterstack.x-k8s.io + resources: + - clusterstacks + verbs: + - get + - list + - patch + - update + - watch +- apiGroups: + - clusterstack.x-k8s.io + resources: + - clusterstacks/finalizers + verbs: + - delete + - update +- apiGroups: + - clusterstack.x-k8s.io + resources: + - clusterstacks/status + verbs: + - get + - patch + - update +- apiGroups: + - infrastructure.clusterstack.x-k8s.io + resources: + - '*' + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + name: cso-leader-election-rolebinding + namespace: cso-system +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: cso-leader-election-role +subjects: +- kind: ServiceAccount + name: cso-controller-manager + namespace: cso-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + name: cso-manager-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cso-manager-role +subjects: +- kind: ServiceAccount + name: cso-controller-manager + namespace: cso-system +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + control-plane: cso-controller-manager + name: cso-controller-manager + namespace: cso-system +spec: + replicas: 1 + selector: + matchLabels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + control-plane: cso-controller-manager + template: + metadata: + annotations: + kubectl.kubernetes.io/default-container: manager + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + control-plane: cso-controller-manager + spec: + containers: + - args: + - --leader-elect=true + - --local=true + command: + - /manager + image: ghcr.io/sovereigncloudstack/cso-test:v0.1.0-alpha.3 + imagePullPolicy: Always + livenessProbe: + failureThreshold: 3 + httpGet: + path: /healthz + port: healthz + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + name: manager + ports: + - containerPort: 9440 + name: healthz + protocol: TCP + readinessProbe: + failureThreshold: 3 + httpGet: + path: /readyz + port: healthz + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + resources: + limits: + cpu: 250m + memory: 250Mi + requests: + cpu: 200m + memory: 250Mi + serviceAccountName: cso-controller-manager + terminationGracePeriodSeconds: 10 + tolerations: + - effect: NoSchedule + key: node-role.kubernetes.io/control-plane +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + name: cso-serving-cert + namespace: cso-system +spec: + dnsNames: + - $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc + - $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local + issuerRef: + kind: Issuer + name: cso-selfsigned-issuer + secretName: cso-webhook-server-cert + subject: + organizations: + - k8s-sig-cluster-lifecycle +--- +apiVersion: cert-manager.io/v1 +kind: Issuer +metadata: + labels: + cluster.x-k8s.io/provider: infrastructure-cluster-stack-operator + name: cso-selfsigned-issuer + namespace: cso-system +spec: + selfSigned: {} diff --git a/tilt-settings.yaml.example b/tilt-settings.yaml.example new file mode 100644 index 00000000..3ed79017 --- /dev/null +++ b/tilt-settings.yaml.example @@ -0,0 +1,11 @@ +--- +allowed_contexts: +- kind-cspo +local_mode: false +deploy_cert_manager: true +preload_images_for_kind: true +kind_cluster_name: cspo +capi_version: v1.6.0 +cso_version: v0.1.0-alpha.3 +capo_version: v0.8.0 +cert_manager_version: v1.13.1