Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Commit b349c02

Browse files
add scaffolding code
1 parent 00ca26f commit b349c02

File tree

111 files changed

+3694
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+3694
-7
lines changed

PROJECT

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1-
version: "2"
21
domain: x-k8s.io
2+
layout: go.kubebuilder.io/v2
3+
projectName: cluster-api-provider-nested
34
repo: sigs.k8s.io/cluster-api-provider-nested
5+
resources:
6+
- group: infrastructure
7+
kind: NestedControlPlane
8+
version: v1alpha1
9+
- group: infrastructure
10+
kind: NestedAPIServer
11+
version: v1alpha1
12+
- group: infrastructure
13+
kind: NestedEtcd
14+
version: v1alpha1
15+
- group: infrastructure
16+
kind: NestedControllerManager
17+
version: v1alpha1
18+
version: 3-alpha

api/v1alpha1/groupversion_info.go

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Copyright 2020.
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 v1alpha1 contains API Schema definitions for the infrastructure v1alpha1 API group
18+
// +kubebuilder:object:generate=true
19+
// +groupName=infrastructure.x-k8s.io
20+
package v1alpha1
21+
22+
import (
23+
"k8s.io/apimachinery/pkg/runtime/schema"
24+
"sigs.k8s.io/controller-runtime/pkg/scheme"
25+
)
26+
27+
var (
28+
// GroupVersion is group version used to register these objects
29+
GroupVersion = schema.GroupVersion{Group: "infrastructure.x-k8s.io", Version: "v1alpha1"}
30+
31+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
32+
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
33+
34+
// AddToScheme adds the types in this group-version to the given scheme.
35+
AddToScheme = SchemeBuilder.AddToScheme
36+
)

api/v1alpha1/nestedapiserver_types.go

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
Copyright 2020.
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 v1alpha1
18+
19+
import (
20+
corev1 "k8s.io/api/core/v1"
21+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
addonv1alpha1 "sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/addon/pkg/apis/v1alpha1"
23+
)
24+
25+
// NestedAPIServerSpec defines the desired state of NestedAPIServer
26+
type NestedAPIServerSpec struct {
27+
// NestedComponentSpec contains the common and user-specified information that are
28+
// required for creating the component
29+
// +optional
30+
NestedComponentSpec `json:",inline"`
31+
}
32+
33+
// NestedAPIServerStatus defines the observed state of NestedAPIServer
34+
type NestedAPIServerStatus struct {
35+
// Ready is set if all resources have been created
36+
// +kubebuilder:default=false
37+
Ready bool `json:"ready,omitempty"`
38+
39+
// APIServerService is the reference to the service that expose the APIServer
40+
// +optional
41+
APIServerService *corev1.ObjectReference `json:"apiserverService,omitempty"`
42+
43+
// CommonStatus allows addons status monitoring
44+
addonv1alpha1.CommonStatus `json:",inline"`
45+
}
46+
47+
// +kubebuilder:object:root=true
48+
// +kubebuilder:subresource:status
49+
50+
// NestedAPIServer is the Schema for the nestedapiservers API
51+
type NestedAPIServer struct {
52+
metav1.TypeMeta `json:",inline"`
53+
metav1.ObjectMeta `json:"metadata,omitempty"`
54+
55+
Spec NestedAPIServerSpec `json:"spec,omitempty"`
56+
Status NestedAPIServerStatus `json:"status,omitempty"`
57+
}
58+
59+
// +kubebuilder:object:root=true
60+
61+
// NestedAPIServerList contains a list of NestedAPIServer
62+
type NestedAPIServerList struct {
63+
metav1.TypeMeta `json:",inline"`
64+
metav1.ListMeta `json:"metadata,omitempty"`
65+
Items []NestedAPIServer `json:"items"`
66+
}
67+
68+
func init() {
69+
SchemeBuilder.Register(&NestedAPIServer{}, &NestedAPIServerList{})
70+
}

api/v1alpha1/nestedcomponentspec.go

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
Copyright 2020.
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 v1alpha1
18+
19+
import (
20+
corev1 "k8s.io/api/core/v1"
21+
addonv1alpha1 "sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/addon/pkg/apis/v1alpha1"
22+
)
23+
24+
type NestedComponentSpec struct {
25+
// NestedComponentSpec defines the common information for creating the component
26+
// +optional
27+
addonv1alpha1.CommonSpec `json:",inline"`
28+
29+
// PatchSpecs includes the user specifed settings
30+
// +optional
31+
addonv1alpha1.PatchSpec `json:",inline"`
32+
33+
// Resources defines the amount of computing resources that will be used by this component
34+
// +optional
35+
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
36+
37+
// Replicas defines the number of replicas in the component's workload
38+
// +optional
39+
Replicas int32 `json:"replicas,omitempty"`
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
Copyright 2020.
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 v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
addonv1alpha1 "sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/addon/pkg/apis/v1alpha1"
22+
)
23+
24+
// NestedControllerManagerSpec defines the desired state of NestedControllerManager
25+
type NestedControllerManagerSpec struct {
26+
// NestedComponentSpec contains the common and user-specified information that are
27+
// required for creating the component
28+
// +optional
29+
NestedComponentSpec `json:",inline"`
30+
}
31+
32+
// NestedControllerManagerStatus defines the observed state of NestedControllerManager
33+
type NestedControllerManagerStatus struct {
34+
// Ready is set if all resources have been created
35+
Ready bool `json:"ready,omitempty"`
36+
37+
// CommonStatus allows addons status monitoring
38+
addonv1alpha1.CommonStatus `json:",inline"`
39+
}
40+
41+
// +kubebuilder:object:root=true
42+
// +kubebuilder:subresource:status
43+
44+
// NestedControllerManager is the Schema for the nestedcontrollermanagers API
45+
type NestedControllerManager struct {
46+
metav1.TypeMeta `json:",inline"`
47+
metav1.ObjectMeta `json:"metadata,omitempty"`
48+
49+
Spec NestedControllerManagerSpec `json:"spec,omitempty"`
50+
Status NestedControllerManagerStatus `json:"status,omitempty"`
51+
}
52+
53+
// +kubebuilder:object:root=true
54+
55+
// NestedControllerManagerList contains a list of NestedControllerManager
56+
type NestedControllerManagerList struct {
57+
metav1.TypeMeta `json:",inline"`
58+
metav1.ListMeta `json:"metadata,omitempty"`
59+
Items []NestedControllerManager `json:"items"`
60+
}
61+
62+
func init() {
63+
SchemeBuilder.Register(&NestedControllerManager{}, &NestedControllerManagerList{})
64+
}
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
Copyright 2020.
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 v1alpha1
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+
// NestedControlPlaneSpec defines the desired state of NestedControlPlane
27+
type NestedControlPlaneSpec struct {
28+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
29+
// Important: Run "make" to regenerate code after modifying this file
30+
31+
// Foo is an example field of NestedControlPlane. Edit NestedControlPlane_types.go to remove/update
32+
Foo string `json:"foo,omitempty"`
33+
}
34+
35+
// NestedControlPlaneStatus defines the observed state of NestedControlPlane
36+
type NestedControlPlaneStatus 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+
// +kubebuilder:subresource:status
43+
44+
// NestedControlPlane is the Schema for the nestedcontrolplanes API
45+
type NestedControlPlane struct {
46+
metav1.TypeMeta `json:",inline"`
47+
metav1.ObjectMeta `json:"metadata,omitempty"`
48+
49+
Spec NestedControlPlaneSpec `json:"spec,omitempty"`
50+
Status NestedControlPlaneStatus `json:"status,omitempty"`
51+
}
52+
53+
// +kubebuilder:object:root=true
54+
55+
// NestedControlPlaneList contains a list of NestedControlPlane
56+
type NestedControlPlaneList struct {
57+
metav1.TypeMeta `json:",inline"`
58+
metav1.ListMeta `json:"metadata,omitempty"`
59+
Items []NestedControlPlane `json:"items"`
60+
}
61+
62+
func init() {
63+
SchemeBuilder.Register(&NestedControlPlane{}, &NestedControlPlaneList{})
64+
}

api/v1alpha1/nestedetcd_types.go

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
Copyright 2020.
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 v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
addonv1alpha1 "sigs.k8s.io/kubebuilder-declarative-pattern/pkg/patterns/addon/pkg/apis/v1alpha1"
22+
)
23+
24+
// NestedEtcdSpec defines the desired state of NestedEtcd
25+
type NestedEtcdSpec struct {
26+
// NestedComponentSpec contains the common and user-specified information that are
27+
// required for creating the component
28+
// +optional
29+
NestedComponentSpec `json:",inline"`
30+
}
31+
32+
// NestedEtcdStatus defines the observed state of NestedEtcd
33+
type NestedEtcdStatus struct {
34+
// Ready is set if all resources have been created
35+
Ready bool `json:"ready,omitempty"`
36+
37+
// EtcdDomain defines how to address the etcd instance
38+
Addresses []NestedEtcdAddress `json:"addresses,omitempty"`
39+
40+
// CommonStatus allows addons status monitoring
41+
addonv1alpha1.CommonStatus `json:",inline"`
42+
}
43+
44+
// EtcdAddress defines the observed addresses for etcd
45+
type NestedEtcdAddress struct {
46+
// IP Address of the etcd instance.
47+
// +optional
48+
IP string `json:"ip,omitempty"`
49+
50+
// Hostname of the etcd instance
51+
Hostname string `json:"hostname,omitempty"`
52+
53+
// Port of the etcd instance
54+
// +optional
55+
Port int32 `json:"port"`
56+
}
57+
58+
// +kubebuilder:object:root=true
59+
// +kubebuilder:subresource:status
60+
61+
// NestedEtcd is the Schema for the nestedetcds API
62+
type NestedEtcd struct {
63+
metav1.TypeMeta `json:",inline"`
64+
metav1.ObjectMeta `json:"metadata,omitempty"`
65+
66+
Spec NestedEtcdSpec `json:"spec,omitempty"`
67+
Status NestedEtcdStatus `json:"status,omitempty"`
68+
}
69+
70+
// +kubebuilder:object:root=true
71+
72+
// NestedEtcdList contains a list of NestedEtcd
73+
type NestedEtcdList struct {
74+
metav1.TypeMeta `json:",inline"`
75+
metav1.ListMeta `json:"metadata,omitempty"`
76+
Items []NestedEtcd `json:"items"`
77+
}
78+
79+
func init() {
80+
SchemeBuilder.Register(&NestedEtcd{}, &NestedEtcdList{})
81+
}

0 commit comments

Comments
 (0)