diff --git a/Makefile b/Makefile index fbd7290f..6aa42aea 100644 --- a/Makefile +++ b/Makefile @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -.PHONY: all data-source-validator clean test +.PHONY: all volume-data-source-validator clean test -CMDS=data-source-validator +CMDS=volume-data-source-validator all: build include release-tools/build.make diff --git a/cmd/data-source-validator/Dockerfile b/cmd/data-source-validator/Dockerfile deleted file mode 100644 index 48230826..00000000 --- a/cmd/data-source-validator/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM gcr.io/distroless/base:latest -LABEL maintainers="Kubernetes Authors" -LABEL description="Data Source Validator Controller" -ARG binary=./bin/data-source-validator - -COPY ${binary} data-source-validator -ENTRYPOINT ["/data-source-validator"] diff --git a/cmd/volume-data-source-validator/Dockerfile b/cmd/volume-data-source-validator/Dockerfile new file mode 100644 index 00000000..df1ba647 --- /dev/null +++ b/cmd/volume-data-source-validator/Dockerfile @@ -0,0 +1,7 @@ +FROM gcr.io/distroless/base:latest +LABEL maintainers="Kubernetes Authors" +LABEL description="Volume Data Source Validator Controller" +ARG binary=./bin/volume-data-source-validator + +COPY ${binary} volume-data-source-validator +ENTRYPOINT ["/volume-data-source-validator"] diff --git a/cmd/data-source-validator/main.go b/cmd/volume-data-source-validator/main.go similarity index 100% rename from cmd/data-source-validator/main.go rename to cmd/volume-data-source-validator/main.go diff --git a/deploy/kubernetes/rbac-data-source-validator.yaml b/deploy/kubernetes/rbac-data-source-validator.yaml index 2bd9fbf6..4740d7b4 100644 --- a/deploy/kubernetes/rbac-data-source-validator.yaml +++ b/deploy/kubernetes/rbac-data-source-validator.yaml @@ -1,6 +1,7 @@ -# RBAC file for the data-source-validator controller +# RBAC file for the volume-data-source-validator controller # -# The data-source-validator controller does asynchronous validation of PVC data sources +# The volume-data-source-validator controller does asynchronous validation of PVC data +# sources. # It should be installed as part of the base Kubernetes distribution in an appropriate # namespace for components implementing base system functionality. For installing with # Vanilla Kubernetes, kube-system makes sense for the namespace. @@ -8,14 +9,14 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: data-source-validator + name: volume-data-source-validator namespace: kube-system --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: - name: data-source-validator + name: volume-data-source-validator rules: - apiGroups: [populator.storage.k8s.io] resources: [volumepopulators] @@ -31,12 +32,12 @@ rules: kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: - name: data-source-validator + name: volume-data-source-validator subjects: - kind: ServiceAccount - name: data-source-validator + name: volume-data-source-validator namespace: kube-system roleRef: kind: ClusterRole - name: data-source-validator + name: volume-data-source-validator apiGroup: rbac.authorization.k8s.io diff --git a/deploy/kubernetes/setup-data-source-validator.yaml b/deploy/kubernetes/setup-data-source-validator.yaml index 209aec04..aaf408fd 100644 --- a/deploy/kubernetes/setup-data-source-validator.yaml +++ b/deploy/kubernetes/setup-data-source-validator.yaml @@ -1,6 +1,7 @@ -# This YAML file shows how to deploy the data-source-validator controller +# This YAML file shows how to deploy the volume-data-source-validator controller -# The data-source-validator controller does asynchronous validation of PVC data sources +# The volume-data-source-validator controller does asynchronous validation of PVC data +# sources. # It should be installed as part of the base Kubernetes distribution in an appropriate # namespace for components implementing base system functionality. For installing with # Vanilla Kubernetes, kube-system makes sense for the namespace. @@ -9,23 +10,23 @@ kind: StatefulSet apiVersion: apps/v1 metadata: - name: data-source-validator + name: volume-data-source-validator namespace: kube-system spec: - serviceName: data-source-validator + serviceName: volume-data-source-validator replicas: 1 selector: matchLabels: - app: data-source-validator + app: volume-data-source-validator template: metadata: labels: - app: data-source-validator + app: volume-data-source-validator spec: - serviceAccount: data-source-validator + serviceAccount: volume-data-source-validator containers: - - name: data-source-validator - image: data-source-validator:latest + - name: volume-data-source-validator + image: volume-data-source-validator:latest args: - "--v=5" - "--leader-election=false" diff --git a/pkg/data-source-validator/data_source_validator.go b/pkg/data-source-validator/data_source_validator.go index 0da4a0b6..33026619 100644 --- a/pkg/data-source-validator/data_source_validator.go +++ b/pkg/data-source-validator/data_source_validator.go @@ -40,6 +40,7 @@ import ( "k8s.io/klog/v2" 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" ) @@ -75,7 +76,7 @@ func NewDataSourceValidator( broadcaster.StartLogging(klog.Infof) broadcaster.StartRecordingToSink(&corev1.EventSinkImpl{Interface: client.CoreV1().Events(v1.NamespaceAll)}) var eventRecorder record.EventRecorder - eventRecorder = broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: fmt.Sprintf("data-source-validator")}) + eventRecorder = broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: fmt.Sprintf("volume-data-source-validator")}) ctrl := &populatorController{ dynClient: dynClient, @@ -105,8 +106,8 @@ func NewDataSourceValidator( func (ctrl *populatorController) Run(workers int, stopCh <-chan struct{}) { defer ctrl.queue.ShutDown() - klog.Infof("Starting data-source-validator controller") - defer klog.Infof("Shutting down data-source-validator controller") + klog.Infof("Starting volume-data-source-validator controller") + defer klog.Infof("Shutting down volume-data-source-validator controller") if !cache.WaitForCacheSync(stopCh, ctrl.popListerSynced, ctrl.pvcListerSynced) { klog.Errorf("Cannot sync caches")