Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ limitations under the License.
// +k8s:deepcopy-gen=package
// +groupName=populator.storage.k8s.io

package v1alpha1
package v1beta1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -28,7 +28,7 @@ var (
// AddToScheme adds to scheme
AddToScheme = SchemeBuilder.AddToScheme
// SchemeGroupVersion is the group version used to register these objects.
SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
)

// Resource takes an unqualified resource and returns a Group-qualified GroupResource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

// +kubebuilder:object:generate=true
package v1alpha1
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
singular: volumepopulator
scope: Namespaced
versions:
- name: v1alpha1
- name: v1beta1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should line 8 be updated?

api-approved.kubernetes.io: https://github.com/kubernetes/enhancements/pull/2056

schema:
openAPIV3Schema:
description: VolumePopulator represents the registration for a volume populator
Expand Down
8 changes: 4 additions & 4 deletions client/hack/update-crd-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set -o pipefail
SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)

# find or download controller-gen
CONTROLLER_GEN=$(which controller-gen)
CONTROLLER_GEN=$(which controller-gen || true)

if [ "$CONTROLLER_GEN" = "" ]
then
Expand All @@ -30,7 +30,7 @@ then
go mod init tmp;
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.5.0;
rm -rf $TMP_DIR;
CONTROLLER_GEN=$(which controller-gen)
CONTROLLER_GEN=$(which controller-gen || true)
fi

if [ "$CONTROLLER_GEN" = "" ]
Expand All @@ -39,7 +39,7 @@ then
exit 1;
fi

$CONTROLLER_GEN crd:crdVersions=v1,trivialVersions=true paths=${SCRIPT_ROOT}/apis/volumepopulator/v1alpha1
$CONTROLLER_GEN crd:crdVersions=v1,trivialVersions=true paths=${SCRIPT_ROOT}/apis/volumepopulator/v1beta1

$CONTROLLER_GEN object:headerFile=./hack/boilerplate.go.txt,year=$(date +%Y) \
paths=${SCRIPT_ROOT}/apis/volumepopulator/v1alpha1/types.go
paths=${SCRIPT_ROOT}/apis/volumepopulator/v1beta1/types.go
5 changes: 3 additions & 2 deletions cmd/volume-data-source-validator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import (

"github.com/kubernetes-csi/csi-lib-utils/leaderelection"

popv1alpha1 "github.com/kubernetes-csi/volume-data-source-validator/client/apis/volumepopulator/v1alpha1"
popv1beta1 "github.com/kubernetes-csi/volume-data-source-validator/client/apis/volumepopulator/v1beta1"

popcontroller "github.com/kubernetes-csi/volume-data-source-validator/pkg/data-source-validator"
"github.com/kubernetes-csi/volume-data-source-validator/pkg/metrics"
)
Expand Down Expand Up @@ -109,7 +110,7 @@ func main() {
}
klog.Infof("Metrics path successfully registered at %s", *metricsPath)
}
popv1alpha1.AddToScheme(scheme.Scheme)
popv1beta1.AddToScheme(scheme.Scheme)

klog.V(2).Infof("Start NewDataSourceValidator with kubeconfig [%s] resyncPeriod [%+v]", *kubeconfig, *resyncPeriod)

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ require (
github.com/kubernetes-csi/volume-data-source-validator/client v0.0.0-00010101000000-000000000000
github.com/onsi/ginkgo v1.14.1 // indirect
github.com/onsi/gomega v1.10.2 // indirect
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.10.0
github.com/prometheus/common v0.26.0
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5 // indirect
google.golang.org/appengine v1.6.7 // indirect
k8s.io/api v0.22.0
k8s.io/apimachinery v0.22.0
k8s.io/client-go v0.22.0
k8s.io/component-base v0.19.0
k8s.io/component-base v0.22.0
k8s.io/klog/v2 v2.9.0
)

Expand Down
168 changes: 163 additions & 5 deletions go.sum

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pkg/data-source-validator/data_source_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import (

volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"

popv1alpha1 "github.com/kubernetes-csi/volume-data-source-validator/client/apis/volumepopulator/v1alpha1"
popv1beta1 "github.com/kubernetes-csi/volume-data-source-validator/client/apis/volumepopulator/v1beta1"
"github.com/kubernetes-csi/volume-data-source-validator/pkg/metrics"
)

Expand All @@ -65,7 +65,7 @@ var (
pvcGK = metav1.GroupKind{Group: v1.GroupName, Kind: "PersistentVolumeClaim"}
volumeSnapshotGK = metav1.GroupKind{Group: volumesnapshotv1.GroupName, Kind: "VolumeSnapshot"}

PopulatorResource = popv1alpha1.SchemeGroupVersion.WithResource("volumepopulators")
PopulatorResource = popv1beta1.SchemeGroupVersion.WithResource("volumepopulators")
)

func NewDataSourceValidator(
Expand Down Expand Up @@ -233,7 +233,7 @@ func (ctrl *populatorController) validateGroupKind(gk metav1.GroupKind) (bool, e
return false, err
}
for _, unstPopulator := range unstPopulators {
var populator popv1alpha1.VolumePopulator
var populator popv1beta1.VolumePopulator
err = runtime.DefaultUnstructuredConverter.FromUnstructured(unstPopulator.UnstructuredContent(), &populator)
if nil != err {
ctrl.metrics.IncrementCount(metrics.DataSourceErrorResultName)
Expand Down
8 changes: 4 additions & 4 deletions pkg/data-source-validator/data_source_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (

volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"

popv1alpha1 "github.com/kubernetes-csi/volume-data-source-validator/client/apis/volumepopulator/v1alpha1"
popv1beta1 "github.com/kubernetes-csi/volume-data-source-validator/client/apis/volumepopulator/v1beta1"
)

type FakeMetricsManager struct{}
Expand All @@ -45,9 +45,9 @@ func (*FakeMetricsManager) PrepareMetricsPath(mux *http.ServeMux, pattern string
func (*FakeMetricsManager) IncrementCount(result string) {}
func (*FakeMetricsManager) GetRegistry() k8smetrics.KubeRegistry { return nil }

func makeFakeLister(populators ...*popv1alpha1.VolumePopulator) dynamiclister.Lister {
func makeFakeLister(populators ...*popv1beta1.VolumePopulator) dynamiclister.Lister {
scheme := runtime.NewScheme()
popv1alpha1.AddToScheme(scheme)
popv1beta1.AddToScheme(scheme)
objects := make([]runtime.Object, len(populators))
for i := range populators {
objects[i] = populators[i]
Expand Down Expand Up @@ -81,7 +81,7 @@ func TestValidateGroupKind(t *testing.T) {
ctrl := new(populatorController)
ctrl.metrics = new(FakeMetricsManager)

populator := popv1alpha1.VolumePopulator{
populator := popv1beta1.VolumePopulator{
TypeMeta: metav1.TypeMeta{
Kind: "VolumePopulator",
APIVersion: "populator.storage.k8s.io",
Expand Down
21 changes: 21 additions & 0 deletions vendor/github.com/blang/semver/.travis.yml

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

5 changes: 4 additions & 1 deletion vendor/github.com/blang/semver/README.md

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

2 changes: 1 addition & 1 deletion vendor/github.com/blang/semver/package.json

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

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

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

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

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

This file was deleted.

This file was deleted.

Loading