-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add v1beta2 version and implement KThreesControlPlaneTemplate (#88)
Signed-off-by: Andrea Mazzotti <[email protected]>
- Loading branch information
1 parent
ae3b216
commit 7d52020
Showing
85 changed files
with
6,006 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package v1beta1 | ||
|
||
import ( | ||
"fmt" | ||
|
||
"sigs.k8s.io/controller-runtime/pkg/conversion" | ||
|
||
cabp3v1 "github.com/k3s-io/cluster-api-k3s/bootstrap/api/v1beta2" | ||
) | ||
|
||
// ConvertTo converts the v1beta1 KThreesConfig receiver to a v1beta2 KThreesConfig. | ||
func (c *KThreesConfig) ConvertTo(dstRaw conversion.Hub) error { | ||
dst := dstRaw.(*cabp3v1.KThreesConfig) | ||
if err := autoConvert_v1beta1_KThreesConfig_To_v1beta2_KThreesConfig(c, dst, nil); err != nil { | ||
return fmt.Errorf("converting KThreesConfig v1beta1 to v1beta2: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
// ConvertFrom converts the v1beta1 KThreesConfig receiver from a v1beta2 KThreesConfig. | ||
func (c *KThreesConfig) ConvertFrom(srcRaw conversion.Hub) error { | ||
src := srcRaw.(*cabp3v1.KThreesConfig) | ||
if err := autoConvert_v1beta2_KThreesConfig_To_v1beta1_KThreesConfig(src, c, nil); err != nil { | ||
return fmt.Errorf("converting KThreesConfig v1beta1 from v1beta2: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
// ConvertTo converts the v1beta1 KThreesConfigList receiver to a v1beta2 KThreesConfigList. | ||
func (c *KThreesConfigList) ConvertTo(dstRaw conversion.Hub) error { | ||
dst := dstRaw.(*cabp3v1.KThreesConfigList) | ||
if err := autoConvert_v1beta1_KThreesConfigList_To_v1beta2_KThreesConfigList(c, dst, nil); err != nil { | ||
return fmt.Errorf("converting KThreesConfigList v1beta1 to v1beta2: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
// ConvertFrom converts the v1beta1 KThreesConfigList receiver from a v1beta2 KThreesConfigList. | ||
func (c *KThreesConfigList) ConvertFrom(srcRaw conversion.Hub) error { | ||
src := srcRaw.(*cabp3v1.KThreesConfigList) | ||
if err := autoConvert_v1beta2_KThreesConfigList_To_v1beta1_KThreesConfigList(src, c, nil); err != nil { | ||
return fmt.Errorf("converting KThreesConfigList v1beta1 from v1beta2: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
// ConvertTo converts the v1beta1 KThreesConfigTemplate receiver to a v1beta2 KThreesConfigTemplate. | ||
func (r *KThreesConfigTemplate) ConvertTo(dstRaw conversion.Hub) error { | ||
dst := dstRaw.(*cabp3v1.KThreesConfigTemplate) | ||
if err := autoConvert_v1beta1_KThreesConfigTemplate_To_v1beta2_KThreesConfigTemplate(r, dst, nil); err != nil { | ||
return fmt.Errorf("converting KThreesConfigTemplate v1beta1 to v1beta2: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
// ConvertFrom converts the v1beta1 KThreesConfigTemplate receiver from a v1beta2 KThreesConfigTemplate. | ||
func (r *KThreesConfigTemplate) ConvertFrom(srcRaw conversion.Hub) error { | ||
src := srcRaw.(*cabp3v1.KThreesConfigTemplate) | ||
if err := autoConvert_v1beta2_KThreesConfigTemplate_To_v1beta1_KThreesConfigTemplate(src, r, nil); err != nil { | ||
return fmt.Errorf("converting KThreesConfigTemplate v1beta1 from v1beta2: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
// ConvertTo converts the v1beta1 KThreesConfigTemplateList receiver to a v1beta2 KThreesConfigTemplateList. | ||
func (r *KThreesConfigTemplateList) ConvertTo(dstRaw conversion.Hub) error { | ||
dst := dstRaw.(*cabp3v1.KThreesConfigTemplateList) | ||
if err := autoConvert_v1beta1_KThreesConfigTemplateList_To_v1beta2_KThreesConfigTemplateList(r, dst, nil); err != nil { | ||
return fmt.Errorf("converting KThreesConfigTemplateList v1beta1 to v1beta2: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
// ConvertFrom converts the v1beta1 KThreesConfigTemplateList receiver from a v1beta2 KThreesConfigTemplateList. | ||
func (r *KThreesConfigTemplateList) ConvertFrom(srcRaw conversion.Hub) error { | ||
src := srcRaw.(*cabp3v1.KThreesConfigTemplateList) | ||
if err := autoConvert_v1beta2_KThreesConfigTemplateList_To_v1beta1_KThreesConfigTemplateList(src, r, nil); err != nil { | ||
return fmt.Errorf("converting KThreesConfigTemplateList v1beta1 from v1beta2: %w", err) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package v1beta1 | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/gomega" | ||
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
utilconversion "sigs.k8s.io/cluster-api/util/conversion" | ||
|
||
cabp3v1 "github.com/k3s-io/cluster-api-k3s/bootstrap/api/v1beta2" | ||
) | ||
|
||
func TestFuzzyConversion(t *testing.T) { | ||
g := NewWithT(t) | ||
scheme := runtime.NewScheme() | ||
g.Expect(AddToScheme(scheme)).To(Succeed()) | ||
g.Expect(cabp3v1.AddToScheme(scheme)).To(Succeed()) | ||
|
||
t.Run("for KThreesConfig", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ | ||
Scheme: scheme, | ||
Hub: &cabp3v1.KThreesConfig{}, | ||
Spoke: &KThreesConfig{}, | ||
FuzzerFuncs: []fuzzer.FuzzerFuncs{}, | ||
})) | ||
t.Run("for KThreesConfigTemplate", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ | ||
Scheme: scheme, | ||
Hub: &cabp3v1.KThreesConfigTemplate{}, | ||
Spoke: &KThreesConfigTemplate{}, | ||
FuzzerFuncs: []fuzzer.FuzzerFuncs{}, | ||
})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package v1beta1 contains API Schema definitions for the bootstrap v1beta1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=bootstrap.cluster.x-k8s.io | ||
// +k8s:defaulter-gen=TypeMeta | ||
// +k8s:conversion-gen=github.com/k3s-io/cluster-api-k3s/bootstrap/api/v1beta2 | ||
package v1beta1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.