diff --git a/pkg/apis/cloudcredential/v1/register.go b/pkg/apis/cloudcredential/v1/register.go index 53a8cb101..43fed0494 100644 --- a/pkg/apis/cloudcredential/v1/register.go +++ b/pkg/apis/cloudcredential/v1/register.go @@ -58,6 +58,7 @@ func addKnownTypes(scheme *runtime.Scheme) error { &AzureProviderStatus{}, &AzureProviderSpec{}, &GCPProviderStatus{}, &GCPProviderSpec{}, &VSphereProviderStatus{}, &VSphereProviderSpec{}, + &KubevirtProviderStatus{}, &KubevirtProviderSpec{}, ) return nil diff --git a/pkg/apis/cloudcredential/v1/types_kubevirt.go b/pkg/apis/cloudcredential/v1/types_kubevirt.go new file mode 100644 index 000000000..42cac102b --- /dev/null +++ b/pkg/apis/cloudcredential/v1/types_kubevirt.go @@ -0,0 +1,36 @@ +/* +Copyright 2019 The OpenShift Authors. + +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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// TODO: these types should eventually be broken out, along with the actuator, +// to a separate repo. + +// KubevirtProviderSpec the specification of the credentials request in Kubevirt. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type KubevirtProviderSpec struct { + metav1.TypeMeta `json:",inline"` +} + +// KubevirtProviderSpec contains the status of the credentials request in Kubevirt. +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type KubevirtProviderStatus struct { + metav1.TypeMeta `json:",inline"` +} diff --git a/pkg/apis/cloudcredential/v1/zz_generated.deepcopy.go b/pkg/apis/cloudcredential/v1/zz_generated.deepcopy.go index 6c2c5eaa2..4cc0306d0 100644 --- a/pkg/apis/cloudcredential/v1/zz_generated.deepcopy.go +++ b/pkg/apis/cloudcredential/v1/zz_generated.deepcopy.go @@ -308,6 +308,56 @@ func (in *GCPProviderStatus) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubevirtProviderSpec) DeepCopyInto(out *KubevirtProviderSpec) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubevirtProviderSpec. +func (in *KubevirtProviderSpec) DeepCopy() *KubevirtProviderSpec { + if in == nil { + return nil + } + out := new(KubevirtProviderSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KubevirtProviderSpec) 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 *KubevirtProviderStatus) DeepCopyInto(out *KubevirtProviderStatus) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubevirtProviderStatus. +func (in *KubevirtProviderStatus) DeepCopy() *KubevirtProviderStatus { + if in == nil { + return nil + } + out := new(KubevirtProviderStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KubevirtProviderStatus) 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 *OpenStackProviderSpec) DeepCopyInto(out *OpenStackProviderSpec) { *out = *in diff --git a/pkg/operator/credentialsrequest/credentialsrequest_controller.go b/pkg/operator/credentialsrequest/credentialsrequest_controller.go index d2dd97f2a..e3cbbd42c 100644 --- a/pkg/operator/credentialsrequest/credentialsrequest_controller.go +++ b/pkg/operator/credentialsrequest/credentialsrequest_controller.go @@ -835,6 +835,8 @@ func crInfraMatches(cr *minterv1.CredentialsRequest, clusterCloudPlatform config return cloudType == reflect.TypeOf(minterv1.OvirtProviderSpec{}).Name(), nil case configv1.VSpherePlatformType: return cloudType == reflect.TypeOf(minterv1.VSphereProviderSpec{}).Name(), nil + case configv1.KubevirtPlatformType: + return cloudType == reflect.TypeOf(minterv1.KubevirtProviderSpec{}).Name(), nil default: return false, fmt.Errorf("unsupported platorm type: %v", clusterCloudPlatform) } diff --git a/pkg/operator/metrics/metrics.go b/pkg/operator/metrics/metrics.go index afe8c1ced..8469a6911 100644 --- a/pkg/operator/metrics/metrics.go +++ b/pkg/operator/metrics/metrics.go @@ -193,6 +193,8 @@ func cloudProviderSpecToMetricsKey(cloud string) string { return "ovirt" case "VsphereProviderSpec": return "vsphere" + case "KubevirtProviderSpec": + return "kubevirt" default: return "unknown" }