diff --git a/Makefile b/Makefile index b1155c41a..0eb62bd1f 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ TESTS ?= . TEST_FLAGS ?= COVER_FLAGS ?= COVER_PROFILE ?= cover.out +COVER_EXCLUDE ?= (zz_generated) # proxy options PROXY ?= http://proxy.foo.com:8000 @@ -77,8 +78,9 @@ unit-tests: @echo "All unit tests passed" .PHONY: cover -cover: COVER_FLAGS = -covermode=atomic -coverprofile=$(COVER_PROFILE) +cover: COVER_FLAGS = -covermode=atomic -coverprofile=fullcover.out cover: unit-tests + @grep -vE "$(COVER_EXCLUDE)" fullcover.out > $(COVER_PROFILE) @./tools/coverage_check $(COVER_PROFILE) .PHONY: fmt diff --git a/pkg/api/v1alpha1/clusterctl_types.go b/pkg/api/v1alpha1/clusterctl_types.go index 1242175ed..a9a50e6d5 100644 --- a/pkg/api/v1alpha1/clusterctl_types.go +++ b/pkg/api/v1alpha1/clusterctl_types.go @@ -20,13 +20,13 @@ import ( clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3" ) -// TODO (kkalynovskyi) add generators for deepcopy methods, so we can use kubernetes schema - var ( // GroupVersionKind is group version used to register these objects GroupVersionKind = schema.GroupVersionKind{Group: "airshipit.org", Version: "v1alpha1", Kind: "Clusterctl"} ) +// +kubebuilder:object:root=true + // Clusterctl provides information about clusterctl components type Clusterctl struct { metav1.TypeMeta `json:",inline"` diff --git a/pkg/api/v1alpha1/groupversion_info.go b/pkg/api/v1alpha1/groupversion_info.go new file mode 100644 index 000000000..60c9f9501 --- /dev/null +++ b/pkg/api/v1alpha1/groupversion_info.go @@ -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 + + https://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 v1alpha1 contains API Schema definitions for airshipctl +// +kubebuilder:object:generate=true +// +groupName=airshipit.org +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register objects + GroupVersion = schema.GroupVersion{Group: "airshipit.org", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme + + // Scheme contains mappings from Gvk to Go API + Scheme *runtime.Scheme +) + +func init() { + Scheme = runtime.NewScheme() + // NOTE add all api objects to scheme here + SchemeBuilder.Register(&Clusterctl{}) + _ = AddToScheme(Scheme) //nolint:errcheck +} diff --git a/pkg/api/v1alpha1/zz_generated.deepcopy.go b/pkg/api/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..c1d21a2a6 --- /dev/null +++ b/pkg/api/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,122 @@ +// +build !ignore_autogenerated + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Clusterctl) DeepCopyInto(out *Clusterctl) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Providers != nil { + in, out := &in.Providers, &out.Providers + *out = make([]*Provider, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Provider) + (*in).DeepCopyInto(*out) + } + } + } + if in.InitOptions != nil { + in, out := &in.InitOptions, &out.InitOptions + *out = new(InitOptions) + (*in).DeepCopyInto(*out) + } + if in.MoveOptions != nil { + in, out := &in.MoveOptions, &out.MoveOptions + *out = new(MoveOptions) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Clusterctl. +func (in *Clusterctl) DeepCopy() *Clusterctl { + if in == nil { + return nil + } + out := new(Clusterctl) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Clusterctl) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InitOptions) DeepCopyInto(out *InitOptions) { + *out = *in + if in.BootstrapProviders != nil { + in, out := &in.BootstrapProviders, &out.BootstrapProviders + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.InfrastructureProviders != nil { + in, out := &in.InfrastructureProviders, &out.InfrastructureProviders + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ControlPlaneProviders != nil { + in, out := &in.ControlPlaneProviders, &out.ControlPlaneProviders + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InitOptions. +func (in *InitOptions) DeepCopy() *InitOptions { + if in == nil { + return nil + } + out := new(InitOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MoveOptions) DeepCopyInto(out *MoveOptions) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MoveOptions. +func (in *MoveOptions) DeepCopy() *MoveOptions { + if in == nil { + return nil + } + out := new(MoveOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Provider) DeepCopyInto(out *Provider) { + *out = *in + if in.Versions != nil { + in, out := &in.Versions, &out.Versions + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Provider. +func (in *Provider) DeepCopy() *Provider { + if in == nil { + return nil + } + out := new(Provider) + in.DeepCopyInto(out) + return out +} diff --git a/tools/check_copyright b/tools/check_copyright index eb99ca89f..04d7b1e3a 100755 --- a/tools/check_copyright +++ b/tools/check_copyright @@ -18,7 +18,7 @@ declare FILES_MISSING_COPYRIGHT=() check_license() { ext=$1 # skipping license for testdata and manifests folders - FILES=$(find -L . -name "*.${ext}" | grep -v "testdata" | grep -v "manifests") + FILES=$(find -L . -name "*.${ext}" | grep -vE "(testdata|manifests|zz_generated)") for each in $FILES do