Skip to content

Commit 710dc19

Browse files
committed
refactor: bump k8s & vnodemachines
1 parent 9f667b1 commit 710dc19

File tree

2,944 files changed

+247340
-161166
lines changed

Some content is hidden

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

2,944 files changed

+247340
-161166
lines changed

.github/workflows/e2e.yaml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,20 @@ jobs:
5858
run: |
5959
6060
# Install clusterctl
61-
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.9.3/clusterctl-linux-amd64 -o clusterctl
61+
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.11.2/clusterctl-linux-amd64 -o clusterctl
6262
chmod +x clusterctl
6363
sudo mv clusterctl /usr/local/bin/
6464
6565
#Install Kind
66-
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.26.0/kind-linux-amd64
66+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.30.0/kind-linux-amd64
6767
chmod +x ./kind
6868
sudo mv ./kind /usr/local/bin/kind
6969
7070
# Install envsubst
7171
GOBIN="$(pwd)/bin" go install -tags tools github.com/drone/envsubst/v2/cmd/[email protected]
7272
7373
# Install kubectl
74-
curl -LO "https://dl.k8s.io/release/v1.31.4/bin/linux/amd64/kubectl"
74+
curl -LO "https://dl.k8s.io/release/v1.33.2/bin/linux/amd64/kubectl"
7575
chmod +x ./kubectl
7676
sudo mv ./kubectl /usr/local/bin/kubectl
7777
@@ -87,7 +87,7 @@ jobs:
8787
8888
- name: Create and Start Kind Cluster
8989
run: |
90-
kind create cluster --image=kindest/node:v1.31.4@sha256:2cb39f7295fe7eafee0842b1052a599a4fb0f8bcf3f83d96c7f4864c357c6c30
90+
kind create cluster --image=kindest/node:v1.33.2
9191
echo "=== cluster-info ==="
9292
kubectl cluster-info --context kind-kind
9393
@@ -114,32 +114,12 @@ jobs:
114114
echo "=== Test get crd ==="
115115
kubectl get crd
116116
117-
- name: Create Vcluster Custom Resource K3S
118-
run: |
119-
export CLUSTER_NAME=vcluster-k3s
120-
export CLUSTER_NAMESPACE=vcluster-k3s
121-
export VCLUSTER_YAML=$(cat ./test/e2e/k3s-values.yaml | sed -z 's/\n/\\n/g')
122-
kubectl create namespace ${CLUSTER_NAMESPACE}
123-
cat templates/cluster-template.yaml | ./bin/envsubst | kubectl apply -n ${CLUSTER_NAMESPACE} -f -
124-
125-
- name: Validate Resource Ready K3S
126-
run: |
127-
kubectl wait --for=condition=ready vcluster.infrastructure.cluster.x-k8s.io -n vcluster-k3s vcluster-k3s --timeout=100s
128-
129-
- name: Connect to vcluster and install nginx
130-
run: |
131-
vcluster -n vcluster-k3s connect vcluster-k3s --background-proxy=true
132-
kubectl create namespace demo-nginx
133-
kubectl -n demo-nginx create deployment nginx-deployment --image=nginx
134-
kubectl -n demo-nginx rollout status deployment/nginx-deployment --timeout=100s
135-
vcluster disconnect
136-
137-
- name: Create Vcluster Custom Resource K8S
117+
- name: Create VCluster Custom Resource K8S
138118
run: |
139119
export CLUSTER_NAME=vcluster-k8s
140120
export CLUSTER_NAMESPACE=vcluster-k8s
141121
export CHART_NAME=vcluster
142-
export VCLUSTER_YAML=$(cat ./test/e2e/k8s-values.yaml | sed -z 's/\n/\\n/g')
122+
export VCLUSTER_YAML=$(cat ./test/e2e/values.yaml | sed -z 's/\n/\\n/g')
143123
kubectl create namespace ${CLUSTER_NAMESPACE}
144124
cat templates/cluster-template.yaml | ./bin/envsubst | kubectl apply -n ${CLUSTER_NAMESPACE} -f -
145125

.golangci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ linters:
2525
- misspell
2626
- nakedret
2727
- nilnil
28-
- prealloc
2928
- promlinter
3029
- revive
3130
- staticcheck

api/infrastructure/v1alpha1/vcluster_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package v1alpha1
1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
"k8s.io/apimachinery/pkg/runtime"
22-
clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
22+
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
2323
)
2424

2525
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
@@ -30,7 +30,7 @@ type VClusterSpec struct {
3030

3131
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
3232
// +optional
33-
ControlPlaneEndpoint clusterv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
33+
ControlPlaneEndpoint *clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
3434

3535
// The helm release configuration for the virtual cluster. This is optional, but
3636
// when filled, specified chart will be deployed.
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/*
2+
Copyright 2022.
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+
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
22+
)
23+
24+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25+
26+
// VNodeClusterSpec defines the desired state of VCluster
27+
type VNodeClusterSpec struct {
28+
// Important: Run "make" to regenerate code after modifying this file
29+
30+
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
31+
// +optional
32+
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
33+
}
34+
35+
// VNodeClusterStatus defines the observed state of VCluster
36+
type VNodeClusterStatus struct {
37+
// Important: Run "make" to regenerate code after modifying this file
38+
39+
// Ready defines if the virtual cluster control plane is ready.
40+
// +optional
41+
// +kubebuilder:default=false
42+
Ready bool `json:"ready"`
43+
44+
// Reason describes the reason in machine readable form why the cluster is in the current
45+
// phase
46+
// +optional
47+
Reason string `json:"reason,omitempty"`
48+
49+
// Message describes the reason in human readable form why the cluster is in the currrent
50+
// phase
51+
// +optional
52+
Message string `json:"message,omitempty"`
53+
54+
// Conditions holds several conditions the vcluster might be in
55+
// +optional
56+
Conditions Conditions `json:"conditions,omitempty"`
57+
58+
// ObservedGeneration is the latest generation observed by the controller.
59+
// +optional
60+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
61+
62+
// ExternalManagedControlPlane is required by Cluster API to indicate that the control plane
63+
// is externally managed.
64+
// +optional
65+
ExternalManagedControlPlane *bool `json:"externalManagedControlPlane,omitempty"`
66+
}
67+
68+
// GetConditions returns the set of conditions for this object.
69+
func (v *VNodeCluster) GetConditions() Conditions {
70+
return v.Status.Conditions
71+
}
72+
73+
// SetConditions sets the conditions on this object.
74+
func (v *VNodeCluster) SetConditions(conditions Conditions) {
75+
v.Status.Conditions = conditions
76+
}
77+
78+
//+kubebuilder:object:root=true
79+
//+kubebuilder:subresource:status
80+
//+kubebuilder:printcolumn:name="Ready",type="boolean",JSONPath=".status.ready"
81+
//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message"
82+
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
83+
84+
// VNodeCluster is the Schema for the vnodeclusters API
85+
type VNodeCluster struct {
86+
metav1.TypeMeta `json:",inline"`
87+
metav1.ObjectMeta `json:"metadata,omitempty"`
88+
89+
Spec VNodeClusterSpec `json:"spec,omitempty"`
90+
Status VNodeClusterStatus `json:"status,omitempty"`
91+
}
92+
93+
func (v *VNodeCluster) GetSpec() *VNodeClusterSpec {
94+
return &v.Spec
95+
}
96+
97+
func (v *VNodeCluster) GetStatus() *VNodeClusterStatus {
98+
return &v.Status
99+
}
100+
101+
//+kubebuilder:object:root=true
102+
103+
// VNodeClusterList contains a list of VNodeCluster
104+
type VNodeClusterList struct {
105+
metav1.TypeMeta `json:",inline"`
106+
metav1.ListMeta `json:"metadata,omitempty"`
107+
Items []VNodeCluster `json:"items"`
108+
}
109+
110+
func init() {
111+
SchemeBuilder.Register(&VNodeCluster{}, &VNodeClusterList{})
112+
}
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
package v1alpha1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
"k8s.io/apimachinery/pkg/runtime"
6+
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
7+
)
8+
9+
// Common ConditionTypes used by Cluster API objects.
10+
const (
11+
PodProvisionedCondition ConditionType = "PodProvisioned"
12+
)
13+
14+
const (
15+
// MachineFinalizer allows ReconcileKubevirtMachine to clean up resources associated with machine before
16+
// removing it from the apiserver.
17+
MachineFinalizer = "vnodemachine.infrastructure.cluster.x-k8s.io"
18+
)
19+
20+
// VNodeMachineSpec defines the desired state of VNodeMachine.
21+
type VNodeMachineSpec struct {
22+
// ProviderID TBD what to use for VNode
23+
// +optional
24+
ProviderID *string `json:"providerID,omitempty"`
25+
26+
// PodTemplate contains the pod template to use for the machine.
27+
PodTemplate PodTemplate `json:"podTemplate,omitempty"`
28+
}
29+
30+
// VNodeMachineStatus defines the observed state of VNodeMachine.
31+
type VNodeMachineStatus struct {
32+
// Ready denotes that the machine is ready
33+
// +kubebuilder:default=false
34+
Ready bool `json:"ready"`
35+
36+
// Addresses contains the associated addresses for the machine.
37+
// +optional
38+
Addresses []clusterv1.MachineAddress `json:"addresses,omitempty"`
39+
40+
// Conditions defines current service state of the KubevirtMachine.
41+
// +optional
42+
Conditions Conditions `json:"conditions,omitempty"`
43+
44+
// NodeUpdated denotes that the ProviderID is updated on Node of this KubevirtMachine
45+
// +optional
46+
NodeUpdated bool `json:"nodeupdated"`
47+
48+
// FailureReason will be set in the event that there is a terminal problem
49+
// reconciling the Machine and will contain a succinct value suitable
50+
// for machine interpretation.
51+
//
52+
// This field should not be set for transitive errors that a controller
53+
// faces that are expected to be fixed automatically over
54+
// time (like service outages), but instead indicate that something is
55+
// fundamentally wrong with the Machine's spec or the configuration of
56+
// the controller, and that manual intervention is required. Examples
57+
// of terminal errors would be invalid combinations of settings in the
58+
// spec, values that are unsupported by the controller, or the
59+
// responsible controller itself being critically misconfigured.
60+
//
61+
// Any transient errors that occur during the reconciliation of Machines
62+
// can be added as events to the Machine object and/or logged in the
63+
// controller's output.
64+
// +optional
65+
FailureReason string `json:"failureReason,omitempty"`
66+
67+
// FailureMessage will be set in the event that there is a terminal problem
68+
// reconciling the Machine and will contain a more verbose string suitable
69+
// for logging and human consumption.
70+
//
71+
// This field should not be set for transitive errors that a controller
72+
// faces that are expected to be fixed automatically over
73+
// time (like service outages), but instead indicate that something is
74+
// fundamentally wrong with the Machine's spec or the configuration of
75+
// the controller, and that manual intervention is required. Examples
76+
// of terminal errors would be invalid combinations of settings in the
77+
// spec, values that are unsupported by the controller, or the
78+
// responsible controller itself being critically misconfigured.
79+
//
80+
// Any transient errors that occur during the reconciliation of Machines
81+
// can be added as events to the Machine object and/or logged in the
82+
// controller's output.
83+
// +optional
84+
FailureMessage *string `json:"failureMessage,omitempty"`
85+
}
86+
87+
type PodTemplate struct {
88+
// Standard object's metadata.
89+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
90+
// +optional
91+
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
92+
93+
// Specification of the desired behavior of the pod.
94+
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
95+
// +optional
96+
Spec runtime.RawExtension `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
97+
}
98+
99+
// +kubebuilder:resource:path=vnodemachines,scope=Namespaced,categories=cluster-api
100+
// +kubebuilder:object:root=true
101+
// +kubebuilder:storageversion
102+
// +kubebuilder:subresource:status
103+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
104+
// +kubebuilder:printcolumn:name="Ready",type="boolean",JSONPath=".status.ready",description="Is machine ready"
105+
106+
// VNodeMachine is the Schema for the vnodemachines API.
107+
type VNodeMachine struct {
108+
metav1.TypeMeta `json:",inline"`
109+
metav1.ObjectMeta `json:"metadata,omitempty"`
110+
111+
Spec VNodeMachineSpec `json:"spec,omitempty"`
112+
Status VNodeMachineStatus `json:"status,omitempty"`
113+
}
114+
115+
func (c *VNodeMachine) GetConditions() Conditions {
116+
return c.Status.Conditions
117+
}
118+
119+
func (c *VNodeMachine) SetConditions(conditions Conditions) {
120+
c.Status.Conditions = conditions
121+
}
122+
123+
// +kubebuilder:object:root=true
124+
125+
// VNodeMachineList contains a list of VNodeMachine.
126+
type VNodeMachineList struct {
127+
metav1.TypeMeta `json:",inline"`
128+
metav1.ListMeta `json:"metadata,omitempty"`
129+
Items []VNodeMachine `json:"items"`
130+
}
131+
132+
func init() {
133+
SchemeBuilder.Register(&VNodeMachine{}, &VNodeMachineList{})
134+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package v1alpha1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
)
6+
7+
// VNodeMachineTemplateSpec defines the desired state of VNodeMachineTemplate.
8+
type VNodeMachineTemplateSpec struct {
9+
Template VNodeMachineTemplateResource `json:"template"`
10+
}
11+
12+
// +kubebuilder:object:root=true
13+
// +kubebuilder:resource:path=vnodemachinetemplates,scope=Namespaced,categories=cluster-api
14+
// +kubebuilder:storageversion
15+
16+
// VNodeMachineTemplate is the Schema for the vnodemachinetemplates API.
17+
type VNodeMachineTemplate struct {
18+
metav1.TypeMeta `json:",inline"`
19+
metav1.ObjectMeta `json:"metadata,omitempty"`
20+
21+
Spec VNodeMachineTemplateSpec `json:"spec,omitempty"`
22+
}
23+
24+
// +kubebuilder:object:root=true
25+
26+
// VNodeMachineTemplateList contains a list of VNodeMachineTemplate.
27+
type VNodeMachineTemplateList struct {
28+
metav1.TypeMeta `json:",inline"`
29+
metav1.ListMeta `json:"metadata,omitempty"`
30+
Items []VNodeMachineTemplate `json:"items"`
31+
}
32+
33+
func init() {
34+
SchemeBuilder.Register(&VNodeMachineTemplate{}, &VNodeMachineTemplateList{})
35+
}
36+
37+
// VNodeMachineTemplateResource describes the data needed to create a VNodeMachine from a template.
38+
type VNodeMachineTemplateResource struct {
39+
// Spec is the specification of the desired behavior of the machine.
40+
Spec VNodeMachineSpec `json:"spec"`
41+
}

0 commit comments

Comments
 (0)