Skip to content
This repository was archived by the owner on Aug 12, 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
14 changes: 4 additions & 10 deletions api/v1alpha3/packetcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package v1alpha3

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

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
Expand All @@ -30,14 +31,10 @@ type PacketClusterSpec struct {

// Foo is an example field of PacketCluster. Edit PacketCluster_types.go to remove/update
ProjectID string `json:"projectID"`
}

// APIEndpoint represents a reachable Kubernetes API endpoint.
type APIEndpoint struct {
// The hostname on which the API server is serving.
Host string `json:"host"`
// The port on which the API server is serving.
Port int `json:"port"`
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
// +optional
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
}

// PacketClusterStatus defines the observed state of PacketCluster
Expand All @@ -48,9 +45,6 @@ type PacketClusterStatus struct {
// Ready denotes that the cluster (infrastructure) is ready.
// +optional
Ready bool `json:"ready"`
// APIEndpoints represents the endpoints to communicate with the control plane.
// +optional
APIEndpoints []APIEndpoint `json:"apiEndpoints,omitempty"`
}

// +kubebuilder:subresource:status
Expand Down
23 changes: 2 additions & 21 deletions api/v1alpha3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
name: packetclusters.infrastructure.cluster.x-k8s.io
spec:
Expand Down Expand Up @@ -36,6 +36,21 @@ spec:
spec:
description: PacketClusterSpec defines the desired state of PacketCluster
properties:
controlPlaneEndpoint:
description: ControlPlaneEndpoint represents the endpoint used to communicate
with the control plane.
properties:
host:
description: The hostname on which the API server is serving.
type: string
port:
description: The port on which the API server is serving.
format: int32
type: integer
required:
- host
- port
type: object
projectID:
description: Foo is an example field of PacketCluster. Edit PacketCluster_types.go
to remove/update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
name: packetmachines.infrastructure.cluster.x-k8s.io
spec:
Expand Down
8 changes: 3 additions & 5 deletions controllers/packetcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@ func (r *PacketClusterReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, re
logger.Error(err, "error getting a control plane ip")
return ctrl.Result{}, err
case err == nil:
clusterScope.PacketCluster.Status.APIEndpoints = []infrastructurev1alpha3.APIEndpoint{
{
Host: address,
Port: 6443,
},
clusterScope.PacketCluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{
Host: address,
Port: 6443,
}
}

Expand Down