Skip to content

Commit

Permalink
Merge pull request #83 from kubevirt-bot/cherry-pick-82-to-release-v0.5
Browse files Browse the repository at this point in the history
[release-v0.5] Restore alphav1 api for backwards compatibility.
  • Loading branch information
awels committed Jul 30, 2020
2 parents 1f5a4bd + 766ed46 commit abea0be
Show file tree
Hide file tree
Showing 9 changed files with 581 additions and 3 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ generate:
@test -n "$(OPERATOR_SDK)" || (echo "operator sdk not defined, install operator_sdk executable and define OPERATOR_SDK to point to it"; exit 1)
$(OPERATOR_SDK) generate k8s
@test -n "$(OPENAPI_GEN)" || (echo "openapi generator not defined, install openapi_gen executable and define OPENAPI_GEN to point to it"; exit 1)
$(OPENAPI_GEN) --logtostderr=true -o "" -i ./pkg/apis/hostpathprovisioner/v1alpha1 -O zz_generated.openapi -p ./pkg/apis/hostpathprovisioner/v1alpha1 -h ./hack/boilerplate.go.txt -r "-"
$(OPENAPI_GEN) --logtostderr=true -o "" -i ./pkg/apis/hostpathprovisioner/v1beta1 -O zz_generated.openapi -p ./pkg/apis/hostpathprovisioner/v1beta1 -h ./hack/boilerplate.go.txt -r "-"

clean:
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/addtoscheme_hostpathprovisioner_v1alpha1.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ package apis

import (
//secv1 "github.com/openshift/api/security/v1"
"kubevirt.io/hostpath-provisioner-operator/pkg/apis/hostpathprovisioner/v1alpha1"
"kubevirt.io/hostpath-provisioner-operator/pkg/apis/hostpathprovisioner/v1beta1"
)

func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes, v1beta1.SchemeBuilder.AddToScheme)
AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme)
}
20 changes: 20 additions & 0 deletions pkg/apis/hostpathprovisioner/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Copyright 2019 The hostpath provisioner operator 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 v1alpha1 contains API Schema definitions for the hostpathprovisioner v1alpha1 API group
// +k8s:deepcopy-gen=package,register
// +groupName=hostpathprovisioner.kubevirt.io
package v1alpha1
80 changes: 80 additions & 0 deletions pkg/apis/hostpathprovisioner/v1alpha1/hostpathprovisioner_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
Copyright 2019 The hostpath provisioner operator 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 v1alpha1

import (
conditions "github.com/openshift/custom-resource-status/conditions/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// HostPathProvisionerSpec defines the desired state of HostPathProvisioner
// +k8s:openapi-gen=true
type HostPathProvisionerSpec struct {
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty" valid:"required"`
// PathConfig describes the location and layout of PV storage on nodes
PathConfig PathConfig `json:"pathConfig" valid:"required"`
}

// HostPathProvisionerStatus defines the observed state of HostPathProvisioner
// +k8s:openapi-gen=true
type HostPathProvisionerStatus struct {
// Conditions contains the current conditions observed by the operator
// +listType=set
Conditions []conditions.Condition `json:"conditions,omitempty" optional:"true"`
// OperatorVersion The version of the HostPathProvisioner Operator
OperatorVersion string `json:"operatorVersion,omitempty" optional:"true"`
// TargetVersion The targeted version of the HostPathProvisioner deployment
TargetVersion string `json:"targetVersion,omitempty" optional:"true"`
// ObservedVersion The observed version of the HostPathProvisioner deployment
ObservedVersion string `json:"observedVersion,omitempty" optional:"true"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// HostPathProvisioner is the Schema for the hostpathprovisioners API
// +k8s:openapi-gen=true
// +kubebuilder:resource:path=hostpathprovisioners,scope=Cluster
type HostPathProvisioner struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec HostPathProvisionerSpec `json:"spec,omitempty"`
Status HostPathProvisionerStatus `json:"status,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// HostPathProvisionerList contains a list of HostPathProvisioner
type HostPathProvisionerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []HostPathProvisioner `json:"items"`
}

// PathConfig contains the information needed to build the path where the PVs will be created.
// +k8s:openapi-gen=true
type PathConfig struct {
// Path The path the directories for the PVs are created under
Path string `json:"path,omitempty" valid:"required"`
// UseNamingPrefix Use the name of the PVC requesting the PV as part of the directory created
UseNamingPrefix string `json:"useNamingPrefix,omitempty"`
}

func init() {
SchemeBuilder.Register(&HostPathProvisioner{}, &HostPathProvisionerList{})
}
19 changes: 19 additions & 0 deletions pkg/apis/hostpathprovisioner/v1alpha1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// NOTE: Boilerplate only. Ignore this file.

// Package v1alpha1 contains API Schema definitions for the hostpathprovisioner v1alpha1 API group
// +k8s:deepcopy-gen=package,register
// +groupName=hostpathprovisioner.kubevirt.io
package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "hostpathprovisioner.kubevirt.io", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
)
143 changes: 143 additions & 0 deletions pkg/apis/hostpathprovisioner/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit abea0be

Please sign in to comment.