Skip to content
Open
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
52 changes: 51 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ CONVERSION_GEN_BIN := conversion-gen
CONVERSION_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN))
CONVERSION_GEN_PKG := k8s.io/code-generator/cmd/conversion-gen

CLIENT_GEN_VER := v0.35.0
CLIENT_GEN_BIN := client-gen
CLIENT_GEN := $(abspath $(TOOLS_BIN_DIR)/$(CLIENT_GEN_BIN))
CLIENT_GEN_PKG := k8s.io/code-generator/cmd/client-gen

APPLYCONFIGURATION_GEN_VER := v0.35.0
APPLYCONFIGURATION_GEN_BIN := applyconfiguration-gen
APPLYCONFIGURATION_GEN := $(abspath $(TOOLS_BIN_DIR)/$(APPLYCONFIGURATION_GEN_BIN))
APPLYCONFIGURATION_GEN_PKG := k8s.io/code-generator/cmd/applyconfiguration-gen

GO_APIDIFF_VER := v0.8.3
GO_APIDIFF_BIN := go-apidiff
GO_APIDIFF := $(abspath $(TOOLS_BIN_DIR)/$(GO_APIDIFF_BIN)-$(GO_APIDIFF_VER))
Expand Down Expand Up @@ -276,7 +286,7 @@ ALL_GENERATE_MODULES = core kubeadm-bootstrap kubeadm-control-plane docker-infra

.PHONY: generate
generate: ## Run all generate-manifests-*, generate-go-deepcopy-*, generate-go-conversions-* and generate-go-openapi targets
$(MAKE) generate-modules generate-manifests generate-go-deepcopy generate-go-conversions generate-go-openapi
$(MAKE) generate-modules generate-manifests generate-go-deepcopy generate-go-conversions generate-go-openapi generate-go-applyconfigurations generate-go-client

.PHONY: generate-manifests
generate-manifests: $(addprefix generate-manifests-,$(ALL_GENERATE_MODULES)) ## Run all generate-manifests-* targets
Expand Down Expand Up @@ -538,6 +548,30 @@ generate-go-openapi: $(OPENAPI_GEN) ## Generate openapi go code for runtime SDK
done; \
rm sigs.k8s.io/cluster-api

.PHONY: generate-go-applyconfigurations
generate-go-applyconfigurations: $(APPLYCONFIGURATION_GEN) ## Generate apply configurations for Cluster API types
@echo "** Generating apply configurations **"
$(APPLYCONFIGURATION_GEN) \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
--output-pkg=sigs.k8s.io/cluster-api/pkg/generated/applyconfiguration \
--output-dir=./pkg/generated/applyconfiguration \
sigs.k8s.io/cluster-api/api/core/v1beta2 \
sigs.k8s.io/cluster-api/api/addons/v1beta2 \
sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta2 \
sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta2

.PHONY: generate-go-client
generate-go-client: generate-go-applyconfigurations $(CLIENT_GEN) ## Generate typed client for Cluster API types
@echo "** Generating typed client **"
$(CLIENT_GEN) \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt \
--input=core/v1beta2,addons/v1beta2,bootstrap/kubeadm/v1beta2,controlplane/kubeadm/v1beta2 \
--input-base=sigs.k8s.io/cluster-api/api \
--apply-configuration-package=sigs.k8s.io/cluster-api/pkg/generated/applyconfiguration \
--clientset-name=clientset \
--output-pkg=sigs.k8s.io/cluster-api/pkg/generated/client \
--output-dir=./pkg/generated/client

.PHONY: generate-modules
generate-modules: ## Run go mod tidy to ensure modules are up to date
go mod tidy
Expand Down Expand Up @@ -1355,6 +1389,14 @@ clean-generated-conversions: ## Remove files generated by conversion-gen from th
clean-generated-openapi-definitions: ## Remove files generated by openapi-gen from the mentioned dirs. Example SRC_DIRS="./api/v1alpha4"
(IFS=','; for i in $(SRC_DIRS); do find $$i -type f -name 'zz_generated.openapi*' -exec rm -f {} \;; done)

.PHONY: clean-generated-applyconfigurations
clean-generated-applyconfigurations: ## Remove generated applyconfiguration files
rm -rf ./pkg/generated/applyconfiguration

.PHONY: clean-generated-client
clean-generated-client: ## Remove generated client files
rm -rf ./pkg/generated/client

## --------------------------------------
## Hack / Tools
## --------------------------------------
Expand Down Expand Up @@ -1424,6 +1466,14 @@ $(CONTROLLER_GEN): # Build controller-gen from tools folder.
$(CONVERSION_GEN): # Build conversion-gen from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(CONVERSION_GEN_PKG) $(CONVERSION_GEN_BIN) $(CONVERSION_GEN_VER)

.PHONY: $(CLIENT_GEN)
$(CLIENT_GEN): # Build client-gen from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(CLIENT_GEN_PKG) $(CLIENT_GEN_BIN) $(CLIENT_GEN_VER)

.PHONY: $(APPLYCONFIGURATION_GEN)
$(APPLYCONFIGURATION_GEN): # Build applyconfiguration-gen from tools folder.
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) $(APPLYCONFIGURATION_GEN_PKG) $(APPLYCONFIGURATION_GEN_BIN) $(APPLYCONFIGURATION_GEN_VER)

$(CONVERSION_VERIFIER): $(TOOLS_DIR)/go.mod # Build conversion-verifier from tools folder.
cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/$(CONVERSION_VERIFIER_BIN) sigs.k8s.io/cluster-api/hack/tools/conversion-verifier

Expand Down
2 changes: 2 additions & 0 deletions api/addons/v1beta2/clusterresourceset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ func (m *ClusterResourceSet) SetConditions(conditions []metav1.Condition) {
// +kubebuilder:printcolumn:name="Applied",type="string",JSONPath=`.status.conditions[?(@.type=="ResourcesApplied")].status`,description="Resource applied"
// +kubebuilder:printcolumn:name="Paused",type="string",JSONPath=`.status.conditions[?(@.type=="Paused")].status`,description="Reconciliation paused",priority=10
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of ClusterResourceSet"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ClusterResourceSet is the Schema for the clusterresourcesets API.
// For advanced use cases an add-on provider should be used instead.
Expand Down
2 changes: 2 additions & 0 deletions api/addons/v1beta2/clusterresourcesetbinding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ func (c *ClusterResourceSetBinding) RemoveBinding(clusterResourceSet *ClusterRes
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".spec.clusterName",description="Cluster"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of ClusterResourceSetBinding"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ClusterResourceSetBinding lists all matching ClusterResourceSets with the cluster it belongs to.
type ClusterResourceSetBinding struct {
Expand Down
2 changes: 2 additions & 0 deletions api/bootstrap/kubeadm/v1beta2/kubeadmconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@ type KubeadmConfigV1Beta1DeprecatedStatus struct {
// +kubebuilder:printcolumn:name="Paused",type="string",JSONPath=`.status.conditions[?(@.type=="Paused")].status`,description="Reconciliation paused",priority=10
// +kubebuilder:printcolumn:name="Data secret created",type="string",JSONPath=`.status.initialization.dataSecretCreated`,description="Boostrap secret is created"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of KubeadmConfig"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// KubeadmConfig is the Schema for the kubeadmconfigs API.
type KubeadmConfig struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,8 @@ type LastRemediationStatus struct {
// +kubebuilder:printcolumn:name="Initialized",type=boolean,JSONPath=".status.initialization.controlPlaneInitialized",description="This denotes whether or not the control plane can accept requests"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of KubeadmControlPlane"
// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=".spec.version",description="Kubernetes version associated with this control plane"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// KubeadmControlPlane is the Schema for the KubeadmControlPlane API.
type KubeadmControlPlane struct {
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1beta2/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,8 @@ func (v APIEndpoint) String() string {
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Cluster status such as Pending/Provisioning/Provisioned/Deleting/Failed"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of Cluster"
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.topology.version",description="Kubernetes version associated with this Cluster"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Cluster is the Schema for the clusters API.
type Cluster struct {
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1beta2/clusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ const (
// +kubebuilder:printcolumn:name="Paused",type="string",JSONPath=`.status.conditions[?(@.type=="Paused")].status`,description="Reconciliation paused",priority=10
// +kubebuilder:printcolumn:name="Variables Ready",type="string",JSONPath=`.status.conditions[?(@.type=="VariablesReady")].status`,description="Variables ready"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of ClusterClass"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ClusterClass is a template which can be used to create managed topologies.
// NOTE: This CRD can only be used if the ClusterTopology feature gate is enabled.
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1beta2/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,8 @@ type Bootstrap struct {
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Machine status such as Terminating/Pending/Running/Failed etc"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of Machine"
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version",description="Kubernetes version associated with this Machine"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Machine is the Schema for the machines API.
type Machine struct {
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1beta2/machinedeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,8 @@ func (md *MachineDeploymentStatus) GetTypedPhase() MachineDeploymentPhase {
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="MachineDeployment status such as ScalingUp/ScalingDown/Running/Failed/Unknown"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of MachineDeployment"
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.template.spec.version",description="Kubernetes version associated with this MachineDeployment"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// MachineDeployment is the Schema for the machinedeployments API.
type MachineDeployment struct {
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1beta2/machinehealthcheck_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ type MachineHealthCheckV1Beta1DeprecatedStatus struct {
// +kubebuilder:printcolumn:name="Healthy",type="integer",JSONPath=".status.currentHealthy",description="Current observed healthy machines"
// +kubebuilder:printcolumn:name="Paused",type="string",JSONPath=`.status.conditions[?(@.type=="Paused")].status`,description="Reconciliation paused",priority=10
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of MachineHealthCheck"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// MachineHealthCheck is the Schema for the machinehealthchecks API.
type MachineHealthCheck struct {
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1beta2/machinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ func (m *MachinePoolStatus) GetTypedPhase() MachinePoolPhase {
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of MachinePool"
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.template.spec.version",description="Kubernetes version associated with this MachinePool"
// +k8s:conversion-gen=false
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// MachinePool is the Schema for the machinepools API.
// NOTE: This CRD can only be used if the MachinePool feature gate is enabled.
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1beta2/machineset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ func (m *MachineSet) Validate() field.ErrorList {
// +kubebuilder:printcolumn:name="Paused",type="string",JSONPath=`.status.conditions[?(@.type=="Paused")].status`,description="Reconciliation paused",priority=10
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of MachineSet"
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.template.spec.version",description="Kubernetes version associated with this MachineSet"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// MachineSet is the Schema for the machinesets API.
type MachineSet struct {
Expand Down
1 change: 1 addition & 0 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
- [Developing "core" Cluster API](developer/core/overview.md)
- [Rapid iterative development with Tilt](developer/core/tilt.md)
- [Repository Layout](developer/core/repository-layout.md)
- [Using ApplyConfigurations for Server-Side Apply](./developer/architecture/apply-configurations.md)
- [Controllers](./developer/core/controllers/overview.md)
- [Cluster](./developer/core/controllers/cluster.md)
- [ClusterTopology](./developer/core/controllers/cluster-topology.md)
Expand Down
Loading