Skip to content

Commit 77979fb

Browse files
authored
powervs support (#331)
1 parent 2c09fb3 commit 77979fb

35 files changed

+2253
-6
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ COPY main.go main.go
1515
COPY api/ api/
1616
COPY controllers/ controllers/
1717
COPY cloud/ cloud/
18+
COPY pkg/ pkg/
1819

1920
# Build
2021
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go

PROJECT

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
version: "1"
2-
domain: cluster.k8s.io
3-
repo: sigs.k8s.io/cluster-api-provider-ibmcloud
1+
domain: cluster.x-k8s.io
2+
repo: github.com/kubernetes-sigs/cluster-api-provider-ibmcloud
3+
resources:
4+
- group: infrastructure
5+
kind: IBMPowerVSCluster
6+
version: v1alpha4
7+
- group: infrastructure
8+
kind: IBMPowerVSMachine
9+
version: v1alpha4
10+
- group: infrastructure
11+
kind: IBMPowerVSMachineTemplate
12+
version: v1alpha4
13+
version: "2"
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha4
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
22+
)
23+
24+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
25+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
26+
27+
const (
28+
// IBMPowerVSClusterFinalizer allows IBMPowerVSClusterReconciler to clean up resources associated with IBMPowerVSCluster before
29+
// removing it from the apiserver.
30+
IBMPowerVSClusterFinalizer = "ibmpowervscluster.infrastructure.cluster.x-k8s.io"
31+
)
32+
33+
// IBMPowerVSClusterSpec defines the desired state of IBMPowerVSCluster
34+
type IBMPowerVSClusterSpec struct {
35+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
36+
// Important: Run "make" to regenerate code after modifying this file
37+
38+
// ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed
39+
ServiceInstanceID string `json:"serviceInstanceID"`
40+
41+
// Network is network ID used for the VSI
42+
NetworkID string `json:"networkID"`
43+
44+
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
45+
// +optional
46+
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
47+
}
48+
49+
// IBMPowerVSClusterStatus defines the observed state of IBMPowerVSCluster
50+
type IBMPowerVSClusterStatus struct {
51+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
52+
// Important: Run "make" to regenerate code after modifying this file
53+
Ready bool `json:"ready"`
54+
}
55+
56+
// +kubebuilder:subresource:status
57+
// +kubebuilder:object:root=true
58+
59+
// IBMPowerVSCluster is the Schema for the ibmpowervsclusters API
60+
type IBMPowerVSCluster struct {
61+
metav1.TypeMeta `json:",inline"`
62+
metav1.ObjectMeta `json:"metadata,omitempty"`
63+
64+
Spec IBMPowerVSClusterSpec `json:"spec,omitempty"`
65+
Status IBMPowerVSClusterStatus `json:"status,omitempty"`
66+
}
67+
68+
// +kubebuilder:object:root=true
69+
70+
// IBMPowerVSClusterList contains a list of IBMPowerVSCluster
71+
type IBMPowerVSClusterList struct {
72+
metav1.TypeMeta `json:",inline"`
73+
metav1.ListMeta `json:"metadata,omitempty"`
74+
Items []IBMPowerVSCluster `json:"items"`
75+
}
76+
77+
func init() {
78+
SchemeBuilder.Register(&IBMPowerVSCluster{}, &IBMPowerVSClusterList{})
79+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*
2+
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha4
18+
19+
import (
20+
v1 "k8s.io/api/core/v1"
21+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
)
23+
24+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
25+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
26+
27+
const (
28+
// IBMPowerVSMachineFinalizer allows IBMPowerVSMachineReconciler to clean up resources associated with IBMPowerVSMachine before
29+
// removing it from the apiserver.
30+
IBMPowerVSMachineFinalizer = "ibmpowervsmachine.infrastructure.cluster.x-k8s.io"
31+
)
32+
33+
// IBMPowerVSMachineSpec defines the desired state of IBMPowerVSMachine
34+
type IBMPowerVSMachineSpec struct {
35+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
36+
// Important: Run "make" to regenerate code after modifying this file
37+
38+
// ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed
39+
ServiceInstanceID string `json:"serviceInstanceID"`
40+
41+
// SSHKey is the name of the SSH key pair provided to the vsi for authenticating users
42+
SSHKey string `json:"sshKey,omitempty"`
43+
44+
// ImageID is the id of OS image which would be install on the instance.
45+
// Example: c57eef35-ea0b-45d7-b864-4b0d4893425b
46+
ImageID string `json:"imageID"`
47+
48+
// SysType is the System type used to host the vsi
49+
SysType string `json:"sysType"`
50+
51+
// ProcType is the processor type, e.g: dedicated, shared, capped
52+
ProcType string `json:"procType"`
53+
54+
// Processors is Number of processors allocated
55+
Processors string `json:"processors"`
56+
57+
// Memory is Amount of memory allocated (in GB)
58+
Memory string `json:"memory"`
59+
60+
// NetworkID is network ID used for the VSI
61+
NetworkID string `json:"networkID"`
62+
63+
// ProviderID is the unique identifier as specified by the cloud provider.
64+
// +optional
65+
ProviderID *string `json:"providerID,omitempty"`
66+
}
67+
68+
// IBMPowerVSMachineStatus defines the observed state of IBMPowerVSMachine
69+
type IBMPowerVSMachineStatus struct {
70+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
71+
// Important: Run "make" to regenerate code after modifying this file
72+
73+
InstanceID string `json:"instanceID,omitempty"`
74+
75+
// Ready is true when the provider resource is ready.
76+
// +optional
77+
Ready bool `json:"ready"`
78+
79+
// Addresses contains the vsi associated addresses.
80+
Addresses []v1.NodeAddress `json:"addresses,omitempty"`
81+
82+
// Health is the health of the vsi
83+
// +optional
84+
Health string `json:"health,omitempty"`
85+
86+
// InstanceState is the status of the vsi
87+
InstanceState string `json:"instanceState"`
88+
89+
// Fault will report if any fault messages for the vsi
90+
// +optional
91+
Fault string `json:"fault,omitempty"`
92+
}
93+
94+
// +kubebuilder:subresource:status
95+
// +kubebuilder:object:root=true
96+
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this IBMPowerVSMachine belongs"
97+
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Cluster infrastructure is ready for IBM PowerVS instances"
98+
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.instanceState",description="PowerVS instance state"
99+
// +kubebuilder:printcolumn:name="Health",type="string",JSONPath=".status.health",description="PowerVS instance health"
100+
101+
// IBMPowerVSMachine is the Schema for the ibmpowervsmachines API
102+
type IBMPowerVSMachine struct {
103+
metav1.TypeMeta `json:",inline"`
104+
metav1.ObjectMeta `json:"metadata,omitempty"`
105+
106+
Spec IBMPowerVSMachineSpec `json:"spec,omitempty"`
107+
Status IBMPowerVSMachineStatus `json:"status,omitempty"`
108+
}
109+
110+
// +kubebuilder:object:root=true
111+
112+
// IBMPowerVSMachineList contains a list of IBMPowerVSMachine
113+
type IBMPowerVSMachineList struct {
114+
metav1.TypeMeta `json:",inline"`
115+
metav1.ListMeta `json:"metadata,omitempty"`
116+
Items []IBMPowerVSMachine `json:"items"`
117+
}
118+
119+
func init() {
120+
SchemeBuilder.Register(&IBMPowerVSMachine{}, &IBMPowerVSMachineList{})
121+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha4
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25+
26+
// IBMPowerVSMachineTemplateSpec defines the desired state of IBMPowerVSMachineTemplate
27+
type IBMPowerVSMachineTemplateSpec struct {
28+
Template IBMPowerVSMachineTemplateResource `json:"template"`
29+
}
30+
31+
type IBMPowerVSMachineTemplateResource struct {
32+
Spec IBMPowerVSMachineSpec `json:"spec"`
33+
}
34+
35+
// IBMPowerVSMachineTemplateStatus defines the observed state of IBMPowerVSMachineTemplate
36+
type IBMPowerVSMachineTemplateStatus struct {
37+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
38+
// Important: Run "make" to regenerate code after modifying this file
39+
}
40+
41+
// +kubebuilder:object:root=true
42+
43+
// IBMPowerVSMachineTemplate is the Schema for the ibmpowervsmachinetemplates API
44+
type IBMPowerVSMachineTemplate struct {
45+
metav1.TypeMeta `json:",inline"`
46+
metav1.ObjectMeta `json:"metadata,omitempty"`
47+
48+
Spec IBMPowerVSMachineTemplateSpec `json:"spec,omitempty"`
49+
Status IBMPowerVSMachineTemplateStatus `json:"status,omitempty"`
50+
}
51+
52+
// +kubebuilder:object:root=true
53+
54+
// IBMPowerVSMachineTemplateList contains a list of IBMPowerVSMachineTemplate
55+
type IBMPowerVSMachineTemplateList struct {
56+
metav1.TypeMeta `json:",inline"`
57+
metav1.ListMeta `json:"metadata,omitempty"`
58+
Items []IBMPowerVSMachineTemplate `json:"items"`
59+
}
60+
61+
func init() {
62+
SchemeBuilder.Register(&IBMPowerVSMachineTemplate{}, &IBMPowerVSMachineTemplateList{})
63+
}

0 commit comments

Comments
 (0)