Skip to content

Commit

Permalink
Rename project to cluster-api-provider-ironcore-metal (#57)
Browse files Browse the repository at this point in the history
* Rename project to cluster-api-provider-ironcore-metal

* Update image and namespace for tilt

* Change API from MetalMachine to IroncoreMetalMachine

* Change API from MetalCluster to IroncoreMetalCluster

* Autogenerate CRDs based on new APIs

* Change file names from metalmachine to ironcoremetalmachine

* Change file names from metalcluster to ironcoremetalcluster

* Autogenerate CRD bases

* Add samples file with naming

* Fix kustomize for shorter CR names
  • Loading branch information
hardikdr authored Feb 5, 2025
1 parent 6a64846 commit ad5f834
Show file tree
Hide file tree
Showing 58 changed files with 604 additions and 857 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
id: meta
with:
images: |
ghcr.io/${{ github.repository_owner }}/cluster-api-metal-controller
ghcr.io/${{ github.repository_owner }}/cluster-api-ironcore-metal-controller
tags: |
type=semver,pattern={{version}}
type=schedule
Expand Down
4 changes: 2 additions & 2 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: cluster-api-provider-metal
Upstream-Name: cluster-api-provider-ironcore-metal
Upstream-Contact: IronCore authors <[email protected]>
Source: https://github.com/ironcore-dev/cluster-api-provider-metal
Source: https://github.com/ironcore-dev/cluster-api-provider-ironcore-metal

# --------------------------------------------------
# source code
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot AS manager
LABEL source_repository="https://github.com/ironcore-dev/cluster-api-provider-metal"
LABEL source_repository="https://github.com/ironcore-dev/cluster-api-provider-ironcore-metal"
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
docker-buildx: ## Build and push docker image for the manager for cross-platform support
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- $(CONTAINER_TOOL) buildx create --name cluster-api-provider-metal-builder
$(CONTAINER_TOOL) buildx use cluster-api-provider-metal-builder
- $(CONTAINER_TOOL) buildx create --name cluster-api-provider-ironcore-metal-builder
$(CONTAINER_TOOL) buildx use cluster-api-provider-ironcore-metal-builder
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
- $(CONTAINER_TOOL) buildx rm cluster-api-provider-metal-builder
- $(CONTAINER_TOOL) buildx rm cluster-api-provider-ironcore-metal-builder
rm Dockerfile.cross

.PHONY: build-installer
Expand Down
16 changes: 8 additions & 8 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@
domain: cluster.x-k8s.io
layout:
- go.kubebuilder.io/v4
projectName: cluster-api-provider-metal
repo: github.com/ironcore-dev/cluster-api-provider-metal
projectName: cluster-api-provider-ironcore-metal
repo: github.com/ironcore-dev/cluster-api-provider-ironcore-metal
resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: cluster.x-k8s.io
group: infrastructure
kind: MetalCluster
path: github.com/ironcore-dev/cluster-api-provider-metal/api/v1alpha1
kind: IroncoreMetalCluster
path: github.com/ironcore-dev/cluster-api-provider-ironcore-metal/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: cluster.x-k8s.io
group: infrastructure
kind: MetalMachine
path: github.com/ironcore-dev/cluster-api-provider-metal/api/v1alpha1
kind: IroncoreMetalMachine
path: github.com/ironcore-dev/cluster-api-provider-ironcore-metal/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
domain: cluster.x-k8s.io
group: infrastructure
kind: MetalMachineTemplate
path: github.com/ironcore-dev/cluster-api-provider-metal/api/v1alpha1
kind: IroncoreMetalMachineTemplate
path: github.com/ironcore-dev/cluster-api-provider-ironcore-metal/api/v1alpha1
version: v1alpha1
version: "3"
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# cluster-api-provider-metal
# cluster-api-provider-ironcore-metal

[![REUSE status](https://api.reuse.software/badge/github.com/ironcore-dev/cluster-api-provider-metal)](https://api.reuse.software/info/github.com/ironcore-dev/cluster-api-provider-metal)
[![Go Report Card](https://goreportcard.com/badge/github.com/ironcore-dev/cluster-api-provider-metal)](https://goreportcard.com/report/github.com/ironcore-dev/cluster-api-provider-metal)
[![REUSE status](https://api.reuse.software/badge/github.com/ironcore-dev/cluster-api-provider-ironcore-metal)](https://api.reuse.software/info/github.com/ironcore-dev/cluster-api-provider-ironcore-metal)
[![Go Report Card](https://goreportcard.com/badge/github.com/ironcore-dev/cluster-api-provider-ironcore-metal)](https://goreportcard.com/report/github.com/ironcore-dev/cluster-api-provider-ironcore-metal)
[![GitHub License](https://img.shields.io/static/v1?label=License&message=Apache-2.0&color=blue)](LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)

The `cluster-api-provider-metal` is an infrastructure provider for [ClusterAPI](https://github.com/kubernetes-sigs/cluster-api), an open-source project that simplifies lifecycle management of Kubernetes clusters.
The `cluster-api-provider-ironcore-metal` is an infrastructure provider for [ClusterAPI](https://github.com/kubernetes-sigs/cluster-api), an open-source project that simplifies lifecycle management of Kubernetes clusters.
This provider allows ClusterAPI to manage clusters using the MetalAPI developed as part of the IronCore Project.

## Installation, Usage, and Development

For more details please refer to documentation folder [/docs](https://github.com/ironcore-dev/cluster-api-provider-metal/tree/main/docs)
For more details please refer to documentation folder [/docs](https://github.com/ironcore-dev/cluster-api-provider-ironcore-metal/tree/main/docs)

## Feedback and Support

Feedback and contributions are always welcome!

Please report bugs, suggestions or post questions by opening a [Github issue](https://github.com/ironcore-dev/cluster-api-provider-metal/issues).
Please report bugs, suggestions or post questions by opening a [Github issue](https://github.com/ironcore-dev/cluster-api-provider-ironcore-metal/issues).

## License

Expand Down
38 changes: 29 additions & 9 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def deploy_capi():
def deploy_metal():
version = settings.get("metal_version")
image = settings.get("metal_image")
metal_uri = "https://github.com/ironcore-dev/metal-operator//config/dev"
cmd = "{} build {} | {} | {} apply -f -".format(kustomize_cmd, metal_uri, envsubst_cmd, kubectl_cmd)
metal_uri = "https://github.com/ironcore-dev/metal-operator/config/dev"
cmd = "{} build {} | {} | {} apply -f - || true".format(kustomize_cmd, metal_uri, envsubst_cmd, kubectl_cmd)
local(cmd, quiet=True)

if settings.get("new_args"):
Expand All @@ -109,6 +109,26 @@ def deploy_metal():

patch_image("metal-operator-system", "metal-operator-controller-manager", image)

patch_env("metal-operator-system", "metal-operator-controller-manager", "ENABLE_WEBHOOKS", "false")

def patch_env(namespace, name, env_name, env_value):
patch = [{
"op": "add",
"path": "/spec/template/spec/containers/0/env",
"value": []
}, {
"op": "add",
"path": "/spec/template/spec/containers/0/env/-",
"value": {
"name": env_name,
"value": env_value
}
}]

local("kubectl patch deployment {} -n {} --type json -p='{}'".format(
name, namespace, str(encode_json(patch)).replace("\n", "")
))

def patch_image(namespace, name, image):
patch = [{
"op": "replace",
Expand Down Expand Up @@ -189,7 +209,7 @@ def capm():
extra_args = settings.get("extra_args").get("do")
if extra_args:
yaml_dict = decode_yaml_stream(yaml)
append_arg_for_container_in_deployment(yaml_dict, "capm-controller-manager", "capm-system", "cluster-api-metal-controller", extra_args)
append_arg_for_container_in_deployment(yaml_dict, "capm-controller-manager", "capm-system", "cluster-api-ironcore-metal-controller", extra_args)
yaml = str(encode_yaml_stream(yaml_dict))
yaml = fixup_yaml_empty_arrays(yaml)

Expand Down Expand Up @@ -282,18 +302,18 @@ k8s_resource(
auto_init=False
)

k8s_yaml('./config/samples/infrastructure_v1alpha1_metalcluster.yaml')
k8s_yaml('./config/samples/infrastructure_v1alpha1_ironcoremetalcluster.yaml')
k8s_resource(
objects=['metalcluster-sample:metalcluster'],
new_name='metalcluster-sample',
objects=['ironcoremetalcluster-sample:ironcoremetalcluster'],
new_name='ironcoremetalcluster-sample',
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False
)

k8s_yaml('./config/samples/infrastructure_v1alpha1_metalmachinetemplate.yaml')
k8s_yaml('./config/samples/infrastructure_v1alpha1_ironcoremetalmachinetemplate.yaml')
k8s_resource(
objects=['metalmachinetemplate-sample-control-plane:metalmachinetemplate'],
new_name='metalmachinetemplate-sample-control-plane',
objects=['ironcoremetalmachinetemplate-sample-control-plane:ironcoremetalmachinetemplate'],
new_name='ironcoremetalmachinetemplate-sample-control-plane',
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False
)
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/conditions_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ package v1alpha1
import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"

const (
// MetalClusterReady documents the status of MetalCluster and its underlying resources.
MetalClusterReady clusterv1.ConditionType = "ClusterReady"
// IroncoreMetalClusterReady documents the status of IroncoreMetalCluster and its underlying resources.
IroncoreMetalClusterReady clusterv1.ConditionType = "ClusterReady"
)
68 changes: 68 additions & 0 deletions api/v1alpha1/ironcoremetalcluster_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and IronCore contributors
// SPDX-License-Identifier: Apache-2.0

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
)

const (
// ClusterFinalizer allows IroncoreMetalClusterReconciler to clean up resources associated with IroncoreMetalCluster before
// removing it from the apiserver.
ClusterFinalizer = "ironcoremetalcluster.infrastructure.cluster.x-k8s.io"
)

// IroncoreMetalClusterSpec defines the desired state of IroncoreMetalCluster
type IroncoreMetalClusterSpec struct {
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
// +optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint,omitempty"`
}

// IroncoreMetalClusterStatus defines the observed state of IroncoreMetalCluster
type IroncoreMetalClusterStatus struct {
// Ready denotes that the cluster (infrastructure) is ready.
// +optional
Ready bool `json:"ready"`

// Conditions defines current service state of the IroncoreMetalCluster.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// IroncoreMetalCluster is the Schema for the ironcoremetalclusters API
type IroncoreMetalCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec IroncoreMetalClusterSpec `json:"spec,omitempty"`
Status IroncoreMetalClusterStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// IroncoreMetalClusterList contains a list of IroncoreMetalCluster
type IroncoreMetalClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []IroncoreMetalCluster `json:"items"`
}

// GetConditions returns the observations of the operational state of the IroncoreMetalCluster resource.
func (c *IroncoreMetalCluster) GetConditions() clusterv1.Conditions {
return c.Status.Conditions
}

// SetConditions sets the underlying service state of the IroncoreMetalCluster to the predescribed clusterv1.Conditions.
func (c *IroncoreMetalCluster) SetConditions(conditions clusterv1.Conditions) {
c.Status.Conditions = conditions
}

func init() {
SchemeBuilder.Register(&IroncoreMetalCluster{}, &IroncoreMetalClusterList{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import (
)

const (
// MachineFinalizer allows ReconcileMetalMachine to clean up resources associated with MetalMachine before
// MachineFinalizer allows ReconcileIroncoreMetalMachine to clean up resources associated with IroncoreMetalMachine before
// removing it from the apiserver.
MachineFinalizer = "metalmachine.infrastructure.cluster.x-k8s.io"
MachineFinalizer = "ironcoremetalmachine.infrastructure.cluster.x-k8s.io"

// DefaultReconcilerRequeue is the default value for the reconcile retry.
DefaultReconcilerRequeue = 5 * time.Second
)

// MetalMachineSpec defines the desired state of MetalMachine
type MetalMachineSpec struct {
// IroncoreMetalMachineSpec defines the desired state of IroncoreMetalMachine
type IroncoreMetalMachineSpec struct {
// ProviderID is the unique identifier as specified by the cloud provider.
// +optional
ProviderID *string `json:"providerID,omitempty"`
Expand All @@ -28,13 +28,13 @@ type MetalMachineSpec struct {
Image string `json:"image"`

// ServerSelector specifies matching criteria for labels on Servers.
// This is used to claim specific Server types for a MetalMachine.
// This is used to claim specific Server types for a IroncoreMetalMachine.
// +optional
ServerSelector *metav1.LabelSelector `json:"serverSelector,omitempty"`
}

// MetalMachineStatus defines the observed state of MetalMachine
type MetalMachineStatus struct {
// IroncoreMetalMachineStatus defines the observed state of IroncoreMetalMachine
type IroncoreMetalMachineStatus struct {
// Ready indicates the Machine infrastructure has been provisioned and is ready.
// +optional
Ready bool `json:"ready"`
Expand Down Expand Up @@ -81,24 +81,24 @@ type MetalMachineStatus struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// MetalMachine is the Schema for the metalmachines API
type MetalMachine struct {
// IroncoreMetalMachine is the Schema for the ironcoremetalmachines API
type IroncoreMetalMachine struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec MetalMachineSpec `json:"spec,omitempty"`
Status MetalMachineStatus `json:"status,omitempty"`
Spec IroncoreMetalMachineSpec `json:"spec,omitempty"`
Status IroncoreMetalMachineStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// MetalMachineList contains a list of MetalMachine
type MetalMachineList struct {
// IroncoreMetalMachineList contains a list of IroncoreMetalMachine
type IroncoreMetalMachineList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MetalMachine `json:"items"`
Items []IroncoreMetalMachine `json:"items"`
}

func init() {
SchemeBuilder.Register(&MetalMachine{}, &MetalMachineList{})
SchemeBuilder.Register(&IroncoreMetalMachine{}, &IroncoreMetalMachineList{})
}
46 changes: 46 additions & 0 deletions api/v1alpha1/ironcoremetalmachinetemplate_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and IronCore contributors
// SPDX-License-Identifier: Apache-2.0

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
)

// IroncoreMetalMachineTemplateSpec defines the desired state of IroncoreMetalMachineTemplate
type IroncoreMetalMachineTemplateSpec struct {
Template IroncoreMetalMachineTemplateResource `json:"template"`
}

// +kubebuilder:object:root=true

// IroncoreMetalMachineTemplate is the Schema for the ironcoremetalmachinetemplates API
type IroncoreMetalMachineTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec IroncoreMetalMachineTemplateSpec `json:"spec,omitempty"`
}

// IroncoreMetalMachineTemplateResource defines the spec and metadata for IroncoreMetalMachineTemplate supported by capi.
type IroncoreMetalMachineTemplateResource struct {
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
ObjectMeta clusterv1.ObjectMeta `json:"metadata,omitempty"`
Spec IroncoreMetalMachineSpec `json:"spec"`
}

// +kubebuilder:object:root=true

// IroncoreMetalMachineTemplateList contains a list of IroncoreMetalMachineTemplate
type IroncoreMetalMachineTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []IroncoreMetalMachineTemplate `json:"items"`
}

func init() {
SchemeBuilder.Register(&IroncoreMetalMachineTemplate{}, &IroncoreMetalMachineTemplateList{})
}
Loading

0 comments on commit ad5f834

Please sign in to comment.