Skip to content

Commit 956ac71

Browse files
committed
add NetworkConfigurations, VMTemplate
1 parent 6e8e237 commit 956ac71

12 files changed

+593
-51
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
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 v1alpha3
18+
19+
import (
20+
conversion "k8s.io/apimachinery/pkg/conversion"
21+
v1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
22+
)
23+
24+
func Convert_v1beta1_Topology_To_v1alpha3_Topology(in *v1beta1.Topology, out *Topology, s conversion.Scope) error {
25+
if len(in.NetworkConfigurations) > 0 {
26+
networks := make([]string, len(in.NetworkConfigurations))
27+
for i := range in.NetworkConfigurations {
28+
networks[i] = in.NetworkConfigurations[i].NetworkName
29+
}
30+
out.Networks = networks
31+
}
32+
return nil
33+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
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 v1alpha3
18+
19+
import (
20+
conversion "k8s.io/apimachinery/pkg/conversion"
21+
v1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
22+
)
23+
24+
func Convert_v1beta1_VSphereFailureDomainSpec_To_v1alpha3_VSphereFailureDomainSpec(in *v1beta1.VSphereFailureDomainSpec, out *VSphereFailureDomainSpec, s conversion.Scope) error {
25+
if err := Convert_v1beta1_FailureDomain_To_v1alpha3_FailureDomain(&in.Region, &out.Region, s); err != nil {
26+
return err
27+
}
28+
if err := Convert_v1beta1_FailureDomain_To_v1alpha3_FailureDomain(&in.Zone, &out.Zone, s); err != nil {
29+
return err
30+
}
31+
if err := Convert_v1beta1_Topology_To_v1alpha3_Topology(&in.Topology, &out.Topology, s); err != nil {
32+
return err
33+
}
34+
return nil
35+
}

apis/v1alpha3/zz_generated.conversion.go

Lines changed: 34 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
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+
conversion "k8s.io/apimachinery/pkg/conversion"
21+
v1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
22+
)
23+
24+
func Convert_v1beta1_Topology_To_v1alpha4_Topology(in *v1beta1.Topology, out *Topology, s conversion.Scope) error {
25+
if len(in.NetworkConfigurations) > 0 {
26+
networks := make([]string, len(in.NetworkConfigurations))
27+
for i := range in.NetworkConfigurations {
28+
networks[i] = in.NetworkConfigurations[i].NetworkName
29+
}
30+
out.Networks = networks
31+
}
32+
return nil
33+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
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+
conversion "k8s.io/apimachinery/pkg/conversion"
21+
v1beta1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
22+
)
23+
24+
func Convert_v1beta1_VSphereFailureDomainSpec_To_v1alpha4_VSphereFailureDomainSpec(in *v1beta1.VSphereFailureDomainSpec, out *VSphereFailureDomainSpec, s conversion.Scope) error {
25+
if err := Convert_v1beta1_FailureDomain_To_v1alpha4_FailureDomain(&in.Region, &out.Region, s); err != nil {
26+
return err
27+
}
28+
if err := Convert_v1beta1_FailureDomain_To_v1alpha4_FailureDomain(&in.Zone, &out.Zone, s); err != nil {
29+
return err
30+
}
31+
if err := Convert_v1beta1_Topology_To_v1alpha4_Topology(&in.Topology, &out.Topology, s); err != nil {
32+
return err
33+
}
34+
return nil
35+
}

apis/v1alpha4/zz_generated.conversion.go

Lines changed: 34 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)