Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Capi machines #31

Merged
merged 4 commits into from
Jan 11, 2021
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ tools/bin

config/example-cluster/ssh-key
config/example-cluster/pull-secret
config/example-cluster/aws-creds
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ $ make uninstall
First, create the following files containing secrets used by the example cluster:

- `config/example-cluster/pull-secret` a valid pull secret for image pulls.
- `config/example-cluster/ssh-key` an SSH public key for guest node access
- `config/example-cluster/ssh-key` an SSH public key for guest node access.
- `config/example-cluster/aws-creds` an [aws credentials file](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html).

Install the example cluster:

Expand All @@ -44,7 +45,7 @@ $ make example-cluster
When the cluster is available, get the guest kubeconfig using:

```bash
$ oc get secret --namespace example admin-kubeconfig --template={{.data.kubeconfig}} | base64 -D
$ oc get secret --namespace hypershift example-kubeconfig --template={{.data.value}} | base64 -D
```

To create additional node pools, create a resource like:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ import (
)

func init() {
SchemeBuilder.Register(&GuestCluster{})
SchemeBuilder.Register(&GuestClusterList{})
SchemeBuilder.Register(&ExternalInfraCluster{})
SchemeBuilder.Register(&ExternalInfraClusterList{})
}

// +kubebuilder:resource:path=guestclusters,shortName=gc;gcs,scope=Namespaced,categories=cluster-api
// +kubebuilder:resource:path=externalinfraclusters,shortName=eic;eics,scope=Namespaced,categories=cluster-api
// +kubebuilder:storageversion
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// GuestCluster is the Schema for the GuestCluster API
type GuestCluster struct {
// ExternalInfraCluster is the Schema for the ExternalInfraCluster API
type ExternalInfraCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec GuestClusterSpec `json:"spec,omitempty"`
Status GuestClusterStatus `json:"status,omitempty"`
Spec ExternalInfraClusterSpec `json:"spec,omitempty"`
Status ExternalInfraClusterStatus `json:"status,omitempty"`
}

// GuestClusterSpec defines the desired state of GuestCluster
type GuestClusterSpec struct {
// ExternalInfraClusterSpec defines the desired state of ExternalInfraCluster
type ExternalInfraClusterSpec struct {
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
// +optional
ControlPlaneEndpoint APIEndpoint `json:"controlPlaneEndpoint,omitempty"`
Expand All @@ -33,6 +33,7 @@ type GuestClusterSpec struct {

// TODO (alberto): populate the API and create/consume infrastructure via aws sdk
// role profile, sg, vpc, subnets.
Region string `json:"region"`
}

type APIEndpoint struct {
Expand All @@ -43,16 +44,16 @@ type APIEndpoint struct {
Port int32 `json:"port"`
}

// GuestClusterStatus defines the observed state of GuestCluster
type GuestClusterStatus struct {
// ExternalInfraClusterStatus defines the observed state of ExternalInfraCluster
type ExternalInfraClusterStatus struct {
// +optional
Ready bool `json:"ready,omitempty"`
}

// +kubebuilder:object:root=true
// GuestClusterList contains a list of GuestClusters.
type GuestClusterList struct {
// ExternalInfraClusterList contains a list of ExternalInfraClusters.
type ExternalInfraClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []GuestCluster `json:"items"`
Items []ExternalInfraCluster `json:"items"`
}
11 changes: 6 additions & 5 deletions api/v1alpha1/hosted_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ type HostedControlPlane struct {

// HostedControlPlaneSpec defines the desired state of HostedControlPlane
type HostedControlPlaneSpec struct {
ReleaseImage string `json:"releaseImage"`
PullSecret corev1.LocalObjectReference `json:"pullSecret"`
ServiceCIDR string `json:"serviceCIDR"`
PodCIDR string `json:"podCIDR"`
SSHKey corev1.LocalObjectReference `json:"sshKey"`
ReleaseImage string `json:"releaseImage"`
PullSecret corev1.LocalObjectReference `json:"pullSecret"`
ServiceCIDR string `json:"serviceCIDR"`
PodCIDR string `json:"podCIDR"`
SSHKey corev1.LocalObjectReference `json:"sshKey"`
ProviderCreds corev1.LocalObjectReference `json:"providerCreds"`
}

// HostedControlPlaneStatus defines the observed state of HostedControlPlane
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/nodepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func init() {
// +kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:scale:specpath=.spec.nodeCount,statuspath=.status.nodeCount
// +kubebuilder:printcolumn:name="NodeCount",type="integer",JSONPath=".status.NodeCount",description="Available Nodes"
// +kubebuilder:printcolumn:name="NodeCount",type="integer",JSONPath=".status.nodeCount",description="Available Nodes"
type NodePool struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/openshiftcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ type OpenShiftClusterSpec struct {

SSHKey corev1.LocalObjectReference `json:"sshKey"`

ProviderCreds corev1.LocalObjectReference `json:"providerCreds"`

ServiceCIDR string `json:"serviceCIDR"`
PodCIDR string `json:"podCIDR"`
}
Expand Down
40 changes: 21 additions & 19 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Loading