From ffa4278681b49ce413749d1a71b67e866686c53a Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Mon, 2 Aug 2021 10:20:48 -0400 Subject: [PATCH 01/13] Rename image for CI Rename image to csi-driver-shared-resource for CI. --- test/framework/daemonset.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/framework/daemonset.go b/test/framework/daemonset.go index b6ba7842d..32156202b 100644 --- a/test/framework/daemonset.go +++ b/test/framework/daemonset.go @@ -3,13 +3,13 @@ package framework import ( "context" "fmt" - kerrors "k8s.io/apimachinery/pkg/api/errors" "os" "strings" "time" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" @@ -155,7 +155,7 @@ func CreateCSIDriverPlugin(t *TestArgs) { imageNameOverride, found = os.LookupEnv("IMAGE_FORMAT") if found { t.T.Logf("%s: found CI image %s", time.Now().String(), imageNameOverride) - imageNameOverride = strings.ReplaceAll(imageNameOverride, "${component}", "csi-driver-projected-resource") + imageNameOverride = strings.ReplaceAll(imageNameOverride, "${component}", "csi-driver-shared-resource") imageNameOverride = strings.ReplaceAll(imageNameOverride, "stable", "pipeline") imageName = imageNameOverride } From 7960a060ccb350f7565d78385509a8011656b78b Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Wed, 28 Jul 2021 14:49:17 -0400 Subject: [PATCH 02/13] Rename api group - Rename api group to sharedresource.storage.openshift.io. - Update base CRD definition and type registration with new group name. - Regenerated deployment YAMLs. --- deploy/0000_10_projectedresource.crd.yaml | 216 ++++++++---------- .../0000_10_projectedresource.crd.yaml | 6 +- pkg/api/projectedresource/v1alpha1/doc.go | 2 +- .../projectedresource/v1alpha1/register.go | 2 +- 4 files changed, 94 insertions(+), 132 deletions(-) diff --git a/deploy/0000_10_projectedresource.crd.yaml b/deploy/0000_10_projectedresource.crd.yaml index aae0cdef4..252c88cfd 100644 --- a/deploy/0000_10_projectedresource.crd.yaml +++ b/deploy/0000_10_projectedresource.crd.yaml @@ -3,147 +3,109 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: shares.projectedresource.storage.openshift.io + name: shares.sharedresource.storage.openshift.io annotations: - displayName: SharesProjectedResources + displayName: Shares description: Extension for sharing ConfigMaps and Secrets across Namespaces spec: scope: Cluster - group: projectedresource.storage.openshift.io + group: sharedresource.storage.openshift.io names: plural: shares singular: share kind: Share listKind: ShareList versions: - - name: v1alpha1 - served: true - storage: true - "schema": - "openAPIV3Schema": - description: Share is the Schema for the shares API - type: object - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: ShareSpec defines the desired state of Share - type: object - required: - - backingResource - properties: - backingResource: - description: BackingResource captures the ConfigMap or Secret that - is shared. - type: object - required: - - kind - - name - - namespace - properties: - apiVersion: - description: APIVersion defines the versioned schema of this representation - of an object. - type: string - kind: - description: Kind is a string value representing the REST resource - this object represents. Currently only Secret and ConfigMap - are accepted. - type: string - name: - description: Name is the name of the object serving as the backing - resource - type: string - namespace: - description: Namespace is the namespace of the object serving - as the backing resource - type: string - description: - description: Description is a user readable explanation of what the - backing resource provides. - type: string - status: - description: ShareStatus defines the observed state of Share - type: object - properties: - conditions: - description: Conditions are the set of k8s Condition instances provided - by the associated controller for Shares. - type: array - items: - description: "Condition contains details for one aspect of the current - state of this API Resource. --- This struct is intended for direct - use as an array at the field path .status.conditions. For example, - type FooStatus struct{ // Represents the observations of a - foo's current state. // Known .status.conditions.type are: - \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type - \ // +patchStrategy=merge // +listType=map // +listMapKey=type - \ Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` - \n // other fields }" + - name: v1alpha1 + served: true + storage: true + "schema": + "openAPIV3Schema": + description: Share is the Schema for the shares API + type: object + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ShareSpec defines the desired state of Share + type: object + required: + - backingResource + properties: + backingResource: + description: BackingResource captures the ConfigMap or Secret that is shared. type: object required: - - lastTransitionTime - - message - - reason - - status - - type + - kind + - name + - namespace properties: - lastTransitionTime: - description: lastTransitionTime is the last time the condition - transitioned from one status to another. This should be when - the underlying condition changed. If that is not known, then - using the time when the API field changed is acceptable. + apiVersion: + description: APIVersion defines the versioned schema of this representation of an object. type: string - format: date-time - message: - description: message is a human readable message indicating - details about the transition. This may be an empty string. + kind: + description: Kind is a string value representing the REST resource this object represents. Currently only Secret and ConfigMap are accepted. type: string - maxLength: 32768 - observedGeneration: - description: observedGeneration represents the .metadata.generation - that the condition was set based upon. For instance, if .metadata.generation - is currently 12, but the .status.conditions[x].observedGeneration - is 9, the condition is out of date with respect to the current - state of the instance. - type: integer - format: int64 - minimum: 0 - reason: - description: reason contains a programmatic identifier indicating - the reason for the condition's last transition. Producers - of specific condition types may define expected values and - meanings for this field, and whether the values are considered - a guaranteed API. The value should be a CamelCase string. - This field may not be empty. + name: + description: Name is the name of the object serving as the backing resource type: string - maxLength: 1024 - minLength: 1 - pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ - status: - description: status of the condition, one of True, False, Unknown. + namespace: + description: Namespace is the namespace of the object serving as the backing resource type: string - enum: - - "True" - - "False" - - Unknown - type: - description: type of condition in CamelCase or in foo.example.com/CamelCase. - --- Many .condition.type values are consistent across resources - like Available, but because arbitrary conditions can be useful - (see .node.status.conditions), the ability to deconflict is - important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) - type: string - maxLength: 316 - pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + description: + description: Description is a user readable explanation of what the backing resource provides. + type: string + status: + description: ShareStatus defines the observed state of Share + type: object + properties: + conditions: + description: Conditions are the set of k8s Condition instances provided by the associated controller for Shares. + type: array + items: + description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" + type: object + required: + - lastTransitionTime + - message + - reason + - status + - type + properties: + lastTransitionTime: + description: lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + type: string + format: date-time + message: + description: message is a human readable message indicating details about the transition. This may be an empty string. + type: string + maxLength: 32768 + observedGeneration: + description: observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + type: integer + format: int64 + minimum: 0 + reason: + description: reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + type: string + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + status: + description: status of the condition, one of True, False, Unknown. + type: string + enum: + - "True" + - "False" + - Unknown + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + type: string + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ diff --git a/pkg/api/projectedresource/v1alpha1/0000_10_projectedresource.crd.yaml b/pkg/api/projectedresource/v1alpha1/0000_10_projectedresource.crd.yaml index 7c4f4630f..718523b74 100644 --- a/pkg/api/projectedresource/v1alpha1/0000_10_projectedresource.crd.yaml +++ b/pkg/api/projectedresource/v1alpha1/0000_10_projectedresource.crd.yaml @@ -3,13 +3,13 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: shares.projectedresource.storage.openshift.io + name: shares.sharedresource.storage.openshift.io annotations: - displayName: SharesProjectedResources + displayName: Shares description: Extension for sharing ConfigMaps and Secrets across Namespaces spec: scope: Cluster - group: projectedresource.storage.openshift.io + group: sharedresource.storage.openshift.io names: plural: shares singular: share diff --git a/pkg/api/projectedresource/v1alpha1/doc.go b/pkg/api/projectedresource/v1alpha1/doc.go index c551181c4..1cf78e303 100644 --- a/pkg/api/projectedresource/v1alpha1/doc.go +++ b/pkg/api/projectedresource/v1alpha1/doc.go @@ -2,6 +2,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true -// +groupName=projectedresource.storage.openshift.io +// +groupName=sharedresource.storage.openshift.io // Package v1alplha1 is the v1alpha1 version of the API. package v1alpha1 diff --git a/pkg/api/projectedresource/v1alpha1/register.go b/pkg/api/projectedresource/v1alpha1/register.go index b2e92bbce..760f7a5dc 100644 --- a/pkg/api/projectedresource/v1alpha1/register.go +++ b/pkg/api/projectedresource/v1alpha1/register.go @@ -8,7 +8,7 @@ import ( const ( Version = "v1alpha1" - GroupName = "projectedresource.storage.openshift.io" + GroupName = "sharedresource.storage.openshift.io" ) var ( From da1e5271bef7435b8ec1988b6eb13f79f7ae42db Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Wed, 28 Jul 2021 15:01:41 -0400 Subject: [PATCH 03/13] Rename directories - Rename pkg/api/projectedresource to pkg/api/sharedresource - Rename arguments for update/generated.sh to use new name - Regenerate informers and listers - Rename golang package imports - Update controller with new informer factory name - Update e2e tests to use new client --- hack/update-generated.sh | 2 +- .../v1alpha1/doc.go | 0 .../v1alpha1/register.go | 0 .../v1alpha1/share_type.go | 0 .../v1alpha1/zz_generated.deepcopy.go | 0 pkg/cache/configmaps.go | 5 ++-- pkg/cache/secrets.go | 5 ++-- pkg/cache/shares.go | 5 ++-- pkg/client/listers.go | 2 +- pkg/controller/controller.go | 6 ++-- .../clientset/versioned/clientset.go | 18 ++++++------ .../versioned/fake/clientset_generated.go | 10 +++---- .../clientset/versioned/fake/register.go | 4 +-- .../clientset/versioned/scheme/register.go | 4 +-- .../v1alpha1/doc.go | 0 .../v1alpha1/fake/doc.go | 0 .../v1alpha1/fake/fake_share.go | 8 +++--- .../fake/fake_sharedresource_client.go} | 8 +++--- .../v1alpha1/generated_expansion.go | 0 .../v1alpha1/share.go | 4 +-- .../v1alpha1/sharedresource_client.go} | 28 +++++++++---------- .../informers/externalversions/factory.go | 8 +++--- .../informers/externalversions/generic.go | 6 ++-- .../interface.go | 4 +-- .../v1alpha1/interface.go | 0 .../v1alpha1/share.go | 12 ++++---- .../v1alpha1/expansion_generated.go | 0 .../v1alpha1/share.go | 2 +- pkg/hostpath/hostpath.go | 2 +- pkg/hostpath/hostpath_test.go | 2 +- pkg/hostpath/nodeserver.go | 2 +- pkg/hostpath/nodeserver_test.go | 2 +- test/framework/namespace.go | 4 +-- test/framework/share.go | 12 ++++---- 34 files changed, 84 insertions(+), 81 deletions(-) rename pkg/api/{projectedresource => sharedresource}/v1alpha1/doc.go (100%) rename pkg/api/{projectedresource => sharedresource}/v1alpha1/register.go (100%) rename pkg/api/{projectedresource => sharedresource}/v1alpha1/share_type.go (100%) rename pkg/api/{projectedresource => sharedresource}/v1alpha1/zz_generated.deepcopy.go (100%) rename pkg/generated/clientset/versioned/typed/{projectedresource => sharedresource}/v1alpha1/doc.go (100%) rename pkg/generated/clientset/versioned/typed/{projectedresource => sharedresource}/v1alpha1/fake/doc.go (100%) rename pkg/generated/clientset/versioned/typed/{projectedresource => sharedresource}/v1alpha1/fake/fake_share.go (92%) rename pkg/generated/clientset/versioned/typed/{projectedresource/v1alpha1/fake/fake_projectedresource_client.go => sharedresource/v1alpha1/fake/fake_sharedresource_client.go} (65%) rename pkg/generated/clientset/versioned/typed/{projectedresource => sharedresource}/v1alpha1/generated_expansion.go (100%) rename pkg/generated/clientset/versioned/typed/{projectedresource => sharedresource}/v1alpha1/share.go (98%) rename pkg/generated/clientset/versioned/typed/{projectedresource/v1alpha1/projectedresource_client.go => sharedresource/v1alpha1/sharedresource_client.go} (55%) rename pkg/generated/informers/externalversions/{projectedresource => sharedresource}/interface.go (92%) rename pkg/generated/informers/externalversions/{projectedresource => sharedresource}/v1alpha1/interface.go (100%) rename pkg/generated/informers/externalversions/{projectedresource => sharedresource}/v1alpha1/share.go (85%) rename pkg/generated/listers/{projectedresource => sharedresource}/v1alpha1/expansion_generated.go (100%) rename pkg/generated/listers/{projectedresource => sharedresource}/v1alpha1/share.go (97%) diff --git a/hack/update-generated.sh b/hack/update-generated.sh index 9744a55dd..0086d8381 100755 --- a/hack/update-generated.sh +++ b/hack/update-generated.sh @@ -10,5 +10,5 @@ bash vendor/k8s.io/code-generator/generate-groups.sh \ deepcopy,client,lister,informer \ github.com/openshift/csi-driver-projected-resource/pkg/generated \ github.com/openshift/csi-driver-projected-resource/pkg/api \ -projectedresource:v1alpha1 \ +sharedresource:v1alpha1 \ --go-header-file "./hack/boilerplate.go.txt" \ No newline at end of file diff --git a/pkg/api/projectedresource/v1alpha1/doc.go b/pkg/api/sharedresource/v1alpha1/doc.go similarity index 100% rename from pkg/api/projectedresource/v1alpha1/doc.go rename to pkg/api/sharedresource/v1alpha1/doc.go diff --git a/pkg/api/projectedresource/v1alpha1/register.go b/pkg/api/sharedresource/v1alpha1/register.go similarity index 100% rename from pkg/api/projectedresource/v1alpha1/register.go rename to pkg/api/sharedresource/v1alpha1/register.go diff --git a/pkg/api/projectedresource/v1alpha1/share_type.go b/pkg/api/sharedresource/v1alpha1/share_type.go similarity index 100% rename from pkg/api/projectedresource/v1alpha1/share_type.go rename to pkg/api/sharedresource/v1alpha1/share_type.go diff --git a/pkg/api/projectedresource/v1alpha1/zz_generated.deepcopy.go b/pkg/api/sharedresource/v1alpha1/zz_generated.deepcopy.go similarity index 100% rename from pkg/api/projectedresource/v1alpha1/zz_generated.deepcopy.go rename to pkg/api/sharedresource/v1alpha1/zz_generated.deepcopy.go diff --git a/pkg/cache/configmaps.go b/pkg/cache/configmaps.go index ca595fa31..be835a04f 100644 --- a/pkg/cache/configmaps.go +++ b/pkg/cache/configmaps.go @@ -1,10 +1,11 @@ package cache import ( - sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" - "k8s.io/klog/v2" "sync" + sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" + "k8s.io/klog/v2" + corev1 "k8s.io/api/core/v1" ) diff --git a/pkg/cache/secrets.go b/pkg/cache/secrets.go index a19c0ecd9..a54d54cf5 100644 --- a/pkg/cache/secrets.go +++ b/pkg/cache/secrets.go @@ -1,10 +1,11 @@ package cache import ( - "k8s.io/klog/v2" "sync" - sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + "k8s.io/klog/v2" + + sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" corev1 "k8s.io/api/core/v1" ) diff --git a/pkg/cache/shares.go b/pkg/cache/shares.go index bab84c27f..c0a92428e 100644 --- a/pkg/cache/shares.go +++ b/pkg/cache/shares.go @@ -1,12 +1,13 @@ package cache import ( - "k8s.io/klog/v2" "sync" + "k8s.io/klog/v2" + corev1 "k8s.io/api/core/v1" - sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" ) /* diff --git a/pkg/client/listers.go b/pkg/client/listers.go index a2df3755f..fb29d85d2 100644 --- a/pkg/client/listers.go +++ b/pkg/client/listers.go @@ -1,7 +1,7 @@ package client import ( - sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/listers/projectedresource/v1alpha1" + sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/listers/sharedresource/v1alpha1" corev1 "k8s.io/client-go/listers/core/v1" ) diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index d1f386c6c..7148119ca 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -15,7 +15,7 @@ import ( "k8s.io/client-go/util/workqueue" "k8s.io/klog/v2" - sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" objcache "github.com/openshift/csi-driver-projected-resource/pkg/cache" "github.com/openshift/csi-driver-projected-resource/pkg/client" shareclientv1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned" @@ -123,13 +123,13 @@ func NewController(shareRelist time.Duration) (*Controller, error) { shareInformerFactory: shareInformerFactory, cfgMapInformer: informerFactory.Core().V1().ConfigMaps().Informer(), secInformer: informerFactory.Core().V1().Secrets().Informer(), - shareInformer: shareInformerFactory.Projectedresource().V1alpha1().Shares().Informer(), + shareInformer: shareInformerFactory.Sharedresource().V1alpha1().Shares().Informer(), listers: client.GetListers(), } client.SetConfigMapsLister(c.informerFactory.Core().V1().ConfigMaps().Lister()) client.SetSecretsLister(c.informerFactory.Core().V1().Secrets().Lister()) - client.SetSharesLister(c.shareInformerFactory.Projectedresource().V1alpha1().Shares().Lister()) + client.SetSharesLister(c.shareInformerFactory.Sharedresource().V1alpha1().Shares().Lister()) c.cfgMapInformer.AddEventHandler(c.configMapEventHandler()) c.secInformer.AddEventHandler(c.secretEventHandler()) diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index e2f523ed8..0c3412e9e 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -11,7 +11,7 @@ package versioned import ( "fmt" - projectedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1" + sharedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -19,19 +19,19 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - ProjectedresourceV1alpha1() projectedresourcev1alpha1.ProjectedresourceV1alpha1Interface + SharedresourceV1alpha1() sharedresourcev1alpha1.SharedresourceV1alpha1Interface } // Clientset contains the clients for groups. Each group has exactly one // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - projectedresourceV1alpha1 *projectedresourcev1alpha1.ProjectedresourceV1alpha1Client + sharedresourceV1alpha1 *sharedresourcev1alpha1.SharedresourceV1alpha1Client } -// ProjectedresourceV1alpha1 retrieves the ProjectedresourceV1alpha1Client -func (c *Clientset) ProjectedresourceV1alpha1() projectedresourcev1alpha1.ProjectedresourceV1alpha1Interface { - return c.projectedresourceV1alpha1 +// SharedresourceV1alpha1 retrieves the SharedresourceV1alpha1Client +func (c *Clientset) SharedresourceV1alpha1() sharedresourcev1alpha1.SharedresourceV1alpha1Interface { + return c.sharedresourceV1alpha1 } // Discovery retrieves the DiscoveryClient @@ -55,7 +55,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error - cs.projectedresourceV1alpha1, err = projectedresourcev1alpha1.NewForConfig(&configShallowCopy) + cs.sharedresourceV1alpha1, err = sharedresourcev1alpha1.NewForConfig(&configShallowCopy) if err != nil { return nil, err } @@ -71,7 +71,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset - cs.projectedresourceV1alpha1 = projectedresourcev1alpha1.NewForConfigOrDie(c) + cs.sharedresourceV1alpha1 = sharedresourcev1alpha1.NewForConfigOrDie(c) cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) return &cs @@ -80,7 +80,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.projectedresourceV1alpha1 = projectedresourcev1alpha1.New(c) + cs.sharedresourceV1alpha1 = sharedresourcev1alpha1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index c88e37dd7..f31d9121b 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -10,8 +10,8 @@ package fake import ( clientset "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned" - projectedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1" - fakeprojectedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/fake" + sharedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1" + fakesharedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -66,7 +66,7 @@ func (c *Clientset) Tracker() testing.ObjectTracker { var _ clientset.Interface = &Clientset{} -// ProjectedresourceV1alpha1 retrieves the ProjectedresourceV1alpha1Client -func (c *Clientset) ProjectedresourceV1alpha1() projectedresourcev1alpha1.ProjectedresourceV1alpha1Interface { - return &fakeprojectedresourcev1alpha1.FakeProjectedresourceV1alpha1{Fake: &c.Fake} +// SharedresourceV1alpha1 retrieves the SharedresourceV1alpha1Client +func (c *Clientset) SharedresourceV1alpha1() sharedresourcev1alpha1.SharedresourceV1alpha1Interface { + return &fakesharedresourcev1alpha1.FakeSharedresourceV1alpha1{Fake: &c.Fake} } diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index 1b0650ad6..c5127d8b5 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -9,7 +9,7 @@ SPDX-License-Identifier: Apache-2.0 package fake import ( - projectedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + sharedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -21,7 +21,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - projectedresourcev1alpha1.AddToScheme, + sharedresourcev1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index f57bcdaa5..96ce16bc7 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -9,7 +9,7 @@ SPDX-License-Identifier: Apache-2.0 package scheme import ( - projectedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + sharedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -21,7 +21,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - projectedresourcev1alpha1.AddToScheme, + sharedresourcev1alpha1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/doc.go b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/doc.go similarity index 100% rename from pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/doc.go rename to pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/doc.go diff --git a/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/doc.go similarity index 100% rename from pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/fake/doc.go rename to pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/doc.go diff --git a/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/fake/fake_share.go b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/fake_share.go similarity index 92% rename from pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/fake/fake_share.go rename to pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/fake_share.go index 44b0f6dee..8b8c66842 100644 --- a/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/fake/fake_share.go +++ b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/fake_share.go @@ -11,7 +11,7 @@ package fake import ( "context" - v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -22,12 +22,12 @@ import ( // FakeShares implements ShareInterface type FakeShares struct { - Fake *FakeProjectedresourceV1alpha1 + Fake *FakeSharedresourceV1alpha1 } -var sharesResource = schema.GroupVersionResource{Group: "projectedresource.storage.openshift.io", Version: "v1alpha1", Resource: "shares"} +var sharesResource = schema.GroupVersionResource{Group: "sharedresource.storage.openshift.io", Version: "v1alpha1", Resource: "shares"} -var sharesKind = schema.GroupVersionKind{Group: "projectedresource.storage.openshift.io", Version: "v1alpha1", Kind: "Share"} +var sharesKind = schema.GroupVersionKind{Group: "sharedresource.storage.openshift.io", Version: "v1alpha1", Kind: "Share"} // Get takes name of the share, and returns the corresponding share object, and an error if there is any. func (c *FakeShares) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Share, err error) { diff --git a/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/fake/fake_projectedresource_client.go b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/fake_sharedresource_client.go similarity index 65% rename from pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/fake/fake_projectedresource_client.go rename to pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/fake_sharedresource_client.go index 679fb8787..d688e150b 100644 --- a/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/fake/fake_projectedresource_client.go +++ b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/fake_sharedresource_client.go @@ -9,22 +9,22 @@ SPDX-License-Identifier: Apache-2.0 package fake import ( - v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1" + v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) -type FakeProjectedresourceV1alpha1 struct { +type FakeSharedresourceV1alpha1 struct { *testing.Fake } -func (c *FakeProjectedresourceV1alpha1) Shares() v1alpha1.ShareInterface { +func (c *FakeSharedresourceV1alpha1) Shares() v1alpha1.ShareInterface { return &FakeShares{c} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeProjectedresourceV1alpha1) RESTClient() rest.Interface { +func (c *FakeSharedresourceV1alpha1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/generated_expansion.go similarity index 100% rename from pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/generated_expansion.go rename to pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/generated_expansion.go diff --git a/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/share.go b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/share.go similarity index 98% rename from pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/share.go rename to pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/share.go index 49dd7a6eb..fdfa096b2 100644 --- a/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/share.go +++ b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/share.go @@ -12,7 +12,7 @@ import ( "context" "time" - v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" scheme "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,7 +46,7 @@ type shares struct { } // newShares returns a Shares -func newShares(c *ProjectedresourceV1alpha1Client) *shares { +func newShares(c *SharedresourceV1alpha1Client) *shares { return &shares{ client: c.RESTClient(), } diff --git a/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/projectedresource_client.go b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/sharedresource_client.go similarity index 55% rename from pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/projectedresource_client.go rename to pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/sharedresource_client.go index 39999853c..df2f92bf0 100644 --- a/pkg/generated/clientset/versioned/typed/projectedresource/v1alpha1/projectedresource_client.go +++ b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/sharedresource_client.go @@ -9,27 +9,27 @@ SPDX-License-Identifier: Apache-2.0 package v1alpha1 import ( - v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) -type ProjectedresourceV1alpha1Interface interface { +type SharedresourceV1alpha1Interface interface { RESTClient() rest.Interface SharesGetter } -// ProjectedresourceV1alpha1Client is used to interact with features provided by the projectedresource.storage.openshift.io group. -type ProjectedresourceV1alpha1Client struct { +// SharedresourceV1alpha1Client is used to interact with features provided by the sharedresource.storage.openshift.io group. +type SharedresourceV1alpha1Client struct { restClient rest.Interface } -func (c *ProjectedresourceV1alpha1Client) Shares() ShareInterface { +func (c *SharedresourceV1alpha1Client) Shares() ShareInterface { return newShares(c) } -// NewForConfig creates a new ProjectedresourceV1alpha1Client for the given config. -func NewForConfig(c *rest.Config) (*ProjectedresourceV1alpha1Client, error) { +// NewForConfig creates a new SharedresourceV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*SharedresourceV1alpha1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -38,12 +38,12 @@ func NewForConfig(c *rest.Config) (*ProjectedresourceV1alpha1Client, error) { if err != nil { return nil, err } - return &ProjectedresourceV1alpha1Client{client}, nil + return &SharedresourceV1alpha1Client{client}, nil } -// NewForConfigOrDie creates a new ProjectedresourceV1alpha1Client for the given config and +// NewForConfigOrDie creates a new SharedresourceV1alpha1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *ProjectedresourceV1alpha1Client { +func NewForConfigOrDie(c *rest.Config) *SharedresourceV1alpha1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -51,9 +51,9 @@ func NewForConfigOrDie(c *rest.Config) *ProjectedresourceV1alpha1Client { return client } -// New creates a new ProjectedresourceV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *ProjectedresourceV1alpha1Client { - return &ProjectedresourceV1alpha1Client{c} +// New creates a new SharedresourceV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *SharedresourceV1alpha1Client { + return &SharedresourceV1alpha1Client{c} } func setConfigDefaults(config *rest.Config) error { @@ -71,7 +71,7 @@ func setConfigDefaults(config *rest.Config) error { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *ProjectedresourceV1alpha1Client) RESTClient() rest.Interface { +func (c *SharedresourceV1alpha1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index ebf466ef2..9ad637eeb 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -15,7 +15,7 @@ import ( versioned "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned" internalinterfaces "github.com/openshift/csi-driver-projected-resource/pkg/generated/informers/externalversions/internalinterfaces" - projectedresource "github.com/openshift/csi-driver-projected-resource/pkg/generated/informers/externalversions/projectedresource" + sharedresource "github.com/openshift/csi-driver-projected-resource/pkg/generated/informers/externalversions/sharedresource" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -162,9 +162,9 @@ type SharedInformerFactory interface { ForResource(resource schema.GroupVersionResource) (GenericInformer, error) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool - Projectedresource() projectedresource.Interface + Sharedresource() sharedresource.Interface } -func (f *sharedInformerFactory) Projectedresource() projectedresource.Interface { - return projectedresource.New(f, f.namespace, f.tweakListOptions) +func (f *sharedInformerFactory) Sharedresource() sharedresource.Interface { + return sharedresource.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index 10dff5aff..c578644db 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -11,7 +11,7 @@ package externalversions import ( "fmt" - v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -42,9 +42,9 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=projectedresource.storage.openshift.io, Version=v1alpha1 + // Group=sharedresource.storage.openshift.io, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithResource("shares"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Projectedresource().V1alpha1().Shares().Informer()}, nil + return &genericInformer{resource: resource.GroupResource(), informer: f.Sharedresource().V1alpha1().Shares().Informer()}, nil } diff --git a/pkg/generated/informers/externalversions/projectedresource/interface.go b/pkg/generated/informers/externalversions/sharedresource/interface.go similarity index 92% rename from pkg/generated/informers/externalversions/projectedresource/interface.go rename to pkg/generated/informers/externalversions/sharedresource/interface.go index 793d0c6ad..55a22c87c 100644 --- a/pkg/generated/informers/externalversions/projectedresource/interface.go +++ b/pkg/generated/informers/externalversions/sharedresource/interface.go @@ -6,11 +6,11 @@ SPDX-License-Identifier: Apache-2.0 // Code generated by informer-gen. DO NOT EDIT. -package projectedresource +package sharedresource import ( internalinterfaces "github.com/openshift/csi-driver-projected-resource/pkg/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/informers/externalversions/projectedresource/v1alpha1" + v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/informers/externalversions/sharedresource/v1alpha1" ) // Interface provides access to each of this group's versions. diff --git a/pkg/generated/informers/externalversions/projectedresource/v1alpha1/interface.go b/pkg/generated/informers/externalversions/sharedresource/v1alpha1/interface.go similarity index 100% rename from pkg/generated/informers/externalversions/projectedresource/v1alpha1/interface.go rename to pkg/generated/informers/externalversions/sharedresource/v1alpha1/interface.go diff --git a/pkg/generated/informers/externalversions/projectedresource/v1alpha1/share.go b/pkg/generated/informers/externalversions/sharedresource/v1alpha1/share.go similarity index 85% rename from pkg/generated/informers/externalversions/projectedresource/v1alpha1/share.go rename to pkg/generated/informers/externalversions/sharedresource/v1alpha1/share.go index 7c9198ce9..32f280a62 100644 --- a/pkg/generated/informers/externalversions/projectedresource/v1alpha1/share.go +++ b/pkg/generated/informers/externalversions/sharedresource/v1alpha1/share.go @@ -12,10 +12,10 @@ import ( "context" time "time" - projectedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + sharedresourcev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" versioned "github.com/openshift/csi-driver-projected-resource/pkg/generated/clientset/versioned" internalinterfaces "github.com/openshift/csi-driver-projected-resource/pkg/generated/informers/externalversions/internalinterfaces" - v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/listers/projectedresource/v1alpha1" + v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/generated/listers/sharedresource/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" watch "k8s.io/apimachinery/pkg/watch" @@ -51,16 +51,16 @@ func NewFilteredShareInformer(client versioned.Interface, resyncPeriod time.Dura if tweakListOptions != nil { tweakListOptions(&options) } - return client.ProjectedresourceV1alpha1().Shares().List(context.TODO(), options) + return client.SharedresourceV1alpha1().Shares().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.ProjectedresourceV1alpha1().Shares().Watch(context.TODO(), options) + return client.SharedresourceV1alpha1().Shares().Watch(context.TODO(), options) }, }, - &projectedresourcev1alpha1.Share{}, + &sharedresourcev1alpha1.Share{}, resyncPeriod, indexers, ) @@ -71,7 +71,7 @@ func (f *shareInformer) defaultInformer(client versioned.Interface, resyncPeriod } func (f *shareInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&projectedresourcev1alpha1.Share{}, f.defaultInformer) + return f.factory.InformerFor(&sharedresourcev1alpha1.Share{}, f.defaultInformer) } func (f *shareInformer) Lister() v1alpha1.ShareLister { diff --git a/pkg/generated/listers/projectedresource/v1alpha1/expansion_generated.go b/pkg/generated/listers/sharedresource/v1alpha1/expansion_generated.go similarity index 100% rename from pkg/generated/listers/projectedresource/v1alpha1/expansion_generated.go rename to pkg/generated/listers/sharedresource/v1alpha1/expansion_generated.go diff --git a/pkg/generated/listers/projectedresource/v1alpha1/share.go b/pkg/generated/listers/sharedresource/v1alpha1/share.go similarity index 97% rename from pkg/generated/listers/projectedresource/v1alpha1/share.go rename to pkg/generated/listers/sharedresource/v1alpha1/share.go index 1fbf97a81..113a48d7b 100644 --- a/pkg/generated/listers/projectedresource/v1alpha1/share.go +++ b/pkg/generated/listers/sharedresource/v1alpha1/share.go @@ -9,7 +9,7 @@ SPDX-License-Identifier: Apache-2.0 package v1alpha1 import ( - v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + v1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/pkg/hostpath/hostpath.go b/pkg/hostpath/hostpath.go index 5357647d2..731f3340b 100644 --- a/pkg/hostpath/hostpath.go +++ b/pkg/hostpath/hostpath.go @@ -31,7 +31,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/klog/v2" - sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" objcache "github.com/openshift/csi-driver-projected-resource/pkg/cache" "github.com/openshift/csi-driver-projected-resource/pkg/client" ) diff --git a/pkg/hostpath/hostpath_test.go b/pkg/hostpath/hostpath_test.go index 74a676323..919841ada 100644 --- a/pkg/hostpath/hostpath_test.go +++ b/pkg/hostpath/hostpath_test.go @@ -30,7 +30,7 @@ import ( fakekubeclientset "k8s.io/client-go/kubernetes/fake" fakekubetesting "k8s.io/client-go/testing" - sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" "github.com/openshift/csi-driver-projected-resource/pkg/cache" "github.com/openshift/csi-driver-projected-resource/pkg/client" ) diff --git a/pkg/hostpath/nodeserver.go b/pkg/hostpath/nodeserver.go index ee9fa9c2d..73e1cd993 100644 --- a/pkg/hostpath/nodeserver.go +++ b/pkg/hostpath/nodeserver.go @@ -22,7 +22,7 @@ import ( "strings" "github.com/container-storage-interface/spec/lib/go/csi" - sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" "github.com/openshift/csi-driver-projected-resource/pkg/client" "golang.org/x/net/context" "google.golang.org/grpc/codes" diff --git a/pkg/hostpath/nodeserver_test.go b/pkg/hostpath/nodeserver_test.go index 39ecaf2f0..b277b7e68 100644 --- a/pkg/hostpath/nodeserver_test.go +++ b/pkg/hostpath/nodeserver_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/container-storage-interface/spec/lib/go/csi" - sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + sharev1alpha1 "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" "github.com/openshift/csi-driver-projected-resource/pkg/client" "golang.org/x/net/context" diff --git a/test/framework/namespace.go b/test/framework/namespace.go index 936705ca2..8f7bbc9ac 100644 --- a/test/framework/namespace.go +++ b/test/framework/namespace.go @@ -51,11 +51,11 @@ func CleanupTestNamespace(t *TestArgs) { if err != nil && !kerrors.IsNotFound(err) { t.T.Fatalf("error deleting cluster role binding %s: %s", t.Name, err.Error()) } - err = shareClient.ProjectedresourceV1alpha1().Shares().Delete(context.TODO(), t.Name, metav1.DeleteOptions{}) + err = shareClient.SharedresourceV1alpha1().Shares().Delete(context.TODO(), t.Name, metav1.DeleteOptions{}) if err != nil && !kerrors.IsNotFound(err) { t.T.Fatalf("error deleting share %s: %s", t.Name, err.Error()) } - err = shareClient.ProjectedresourceV1alpha1().Shares().Delete(context.TODO(), t.SecondName, metav1.DeleteOptions{}) + err = shareClient.SharedresourceV1alpha1().Shares().Delete(context.TODO(), t.SecondName, metav1.DeleteOptions{}) if err != nil && !kerrors.IsNotFound(err) { t.T.Fatalf("error deleting share %s: %s", t.Name, err.Error()) } diff --git a/test/framework/share.go b/test/framework/share.go index 910143cfd..68e26e36b 100644 --- a/test/framework/share.go +++ b/test/framework/share.go @@ -7,7 +7,7 @@ import ( kerrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - shareapi "github.com/openshift/csi-driver-projected-resource/pkg/api/projectedresource/v1alpha1" + shareapi "github.com/openshift/csi-driver-projected-resource/pkg/api/sharedresource/v1alpha1" ) func CreateShare(t *TestArgs) { @@ -25,7 +25,7 @@ func CreateShare(t *TestArgs) { }, }, } - _, err := shareClient.ProjectedresourceV1alpha1().Shares().Create(context.TODO(), share, metav1.CreateOptions{}) + _, err := shareClient.SharedresourceV1alpha1().Shares().Create(context.TODO(), share, metav1.CreateOptions{}) if err != nil && !kerrors.IsAlreadyExists(err) { t.T.Fatalf("error creating test share: %s", err.Error()) } @@ -45,7 +45,7 @@ func CreateShare(t *TestArgs) { }, }, } - _, err := shareClient.ProjectedresourceV1alpha1().Shares().Create(context.TODO(), share, metav1.CreateOptions{}) + _, err := shareClient.SharedresourceV1alpha1().Shares().Create(context.TODO(), share, metav1.CreateOptions{}) if err != nil && !kerrors.IsAlreadyExists(err) { t.T.Fatalf("error creating test share: %s", err.Error()) } @@ -59,13 +59,13 @@ func ChangeShare(t *TestArgs) { name = t.SecondName } t.T.Logf("%s: start change share %s", time.Now().String(), name) - share, err := shareClient.ProjectedresourceV1alpha1().Shares().Get(context.TODO(), name, metav1.GetOptions{}) + share, err := shareClient.SharedresourceV1alpha1().Shares().Get(context.TODO(), name, metav1.GetOptions{}) if err != nil { t.T.Fatalf("error getting share %s: %s", name, err.Error()) } share.Spec.BackingResource.Kind = "Secret" share.Spec.BackingResource.Name = "pull-secret" - _, err = shareClient.ProjectedresourceV1alpha1().Shares().Update(context.TODO(), share, metav1.UpdateOptions{}) + _, err = shareClient.SharedresourceV1alpha1().Shares().Update(context.TODO(), share, metav1.UpdateOptions{}) if err != nil { t.T.Fatalf("error updating share %s: %s", name, err.Error()) } @@ -78,7 +78,7 @@ func DeleteShare(t *TestArgs) { name = t.ShareToDelete } t.T.Logf("%s: start delete share %s", time.Now().String(), name) - err := shareClient.ProjectedresourceV1alpha1().Shares().Delete(context.TODO(), name, metav1.DeleteOptions{}) + err := shareClient.SharedresourceV1alpha1().Shares().Delete(context.TODO(), name, metav1.DeleteOptions{}) if err != nil && !kerrors.IsNotFound(err) { t.T.Fatalf("error deleting share %s: %s", name, err.Error()) } From 9372039c45c2e82b0f285d90a531d4839850b5f2 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Wed, 28 Jul 2021 15:05:04 -0400 Subject: [PATCH 04/13] Rename CRD YAML manifest - Rename CRD manifest to "sharedresource" - Move base YAML manifest to the sharedresource/v1alpha1 directory - Add rename to update-crd.sh and deploy-in-CI.sh --- ...ectedresource.crd.yaml => 0000_10_sharedresource.crd.yaml} | 0 deploy/deploy-in-CI.sh | 2 +- hack/update-crd.sh | 4 ++-- .../v1alpha1/0000_10_sharedresource.crd.yaml} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename deploy/{0000_10_projectedresource.crd.yaml => 0000_10_sharedresource.crd.yaml} (100%) rename pkg/api/{projectedresource/v1alpha1/0000_10_projectedresource.crd.yaml => sharedresource/v1alpha1/0000_10_sharedresource.crd.yaml} (100%) diff --git a/deploy/0000_10_projectedresource.crd.yaml b/deploy/0000_10_sharedresource.crd.yaml similarity index 100% rename from deploy/0000_10_projectedresource.crd.yaml rename to deploy/0000_10_sharedresource.crd.yaml diff --git a/deploy/deploy-in-CI.sh b/deploy/deploy-in-CI.sh index 400bdd54d..808859d8e 100755 --- a/deploy/deploy-in-CI.sh +++ b/deploy/deploy-in-CI.sh @@ -15,7 +15,7 @@ run () { # deploy hostpath plugin and registrar sidecar echo "creating share CRD" -run oc apply -f ${BASE_DIR}/0000_10_projectedresource.crd.yaml +run oc apply -f ${BASE_DIR}/0000_10_sharedresource.crd.yaml run oc apply -f ${BASE_DIR}/00-namespace.yaml run oc apply -f ${BASE_DIR}/01-service-account.yaml run oc apply -f ${BASE_DIR}/02-cluster-role.yaml diff --git a/hack/update-crd.sh b/hack/update-crd.sh index aabf29135..fd1f5423d 100755 --- a/hack/update-crd.sh +++ b/hack/update-crd.sh @@ -8,7 +8,7 @@ rm -rf deploy/0000_10_projectedresource.crd.yaml echo "If you do not have controller-gen installed visit https://github.com/openshift/kubernetes-sigs-controller-tools/releases" -controller-gen schemapatch:manifests=./pkg/api/projectedresource/v1alpha1 \ -paths=./pkg/api/projectedresource/v1alpha1 \ +controller-gen schemapatch:manifests=./pkg/api/sharedresource/v1alpha1 \ +paths=./pkg/api/sharedresource/v1alpha1 \ output:dir=./deploy diff --git a/pkg/api/projectedresource/v1alpha1/0000_10_projectedresource.crd.yaml b/pkg/api/sharedresource/v1alpha1/0000_10_sharedresource.crd.yaml similarity index 100% rename from pkg/api/projectedresource/v1alpha1/0000_10_projectedresource.crd.yaml rename to pkg/api/sharedresource/v1alpha1/0000_10_sharedresource.crd.yaml From 670edfb10c88ee272b076a4b90e2ee6295c173db Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Thu, 29 Jul 2021 11:25:21 -0400 Subject: [PATCH 05/13] Drop storage subdomain --- deploy/0000_10_sharedresource.crd.yaml | 4 ++-- .../sharedresource/v1alpha1/0000_10_sharedresource.crd.yaml | 4 ++-- pkg/api/sharedresource/v1alpha1/doc.go | 2 +- pkg/api/sharedresource/v1alpha1/register.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deploy/0000_10_sharedresource.crd.yaml b/deploy/0000_10_sharedresource.crd.yaml index 252c88cfd..2674fb4d0 100644 --- a/deploy/0000_10_sharedresource.crd.yaml +++ b/deploy/0000_10_sharedresource.crd.yaml @@ -3,13 +3,13 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: shares.sharedresource.storage.openshift.io + name: shares.sharedresource.openshift.io annotations: displayName: Shares description: Extension for sharing ConfigMaps and Secrets across Namespaces spec: scope: Cluster - group: sharedresource.storage.openshift.io + group: sharedresource.openshift.io names: plural: shares singular: share diff --git a/pkg/api/sharedresource/v1alpha1/0000_10_sharedresource.crd.yaml b/pkg/api/sharedresource/v1alpha1/0000_10_sharedresource.crd.yaml index 718523b74..3363b4ade 100644 --- a/pkg/api/sharedresource/v1alpha1/0000_10_sharedresource.crd.yaml +++ b/pkg/api/sharedresource/v1alpha1/0000_10_sharedresource.crd.yaml @@ -3,13 +3,13 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: - name: shares.sharedresource.storage.openshift.io + name: shares.sharedresource.openshift.io annotations: displayName: Shares description: Extension for sharing ConfigMaps and Secrets across Namespaces spec: scope: Cluster - group: sharedresource.storage.openshift.io + group: sharedresource.openshift.io names: plural: shares singular: share diff --git a/pkg/api/sharedresource/v1alpha1/doc.go b/pkg/api/sharedresource/v1alpha1/doc.go index 1cf78e303..833dd7f12 100644 --- a/pkg/api/sharedresource/v1alpha1/doc.go +++ b/pkg/api/sharedresource/v1alpha1/doc.go @@ -2,6 +2,6 @@ // +k8s:defaulter-gen=TypeMeta // +k8s:openapi-gen=true -// +groupName=sharedresource.storage.openshift.io +// +groupName=sharedresource.openshift.io // Package v1alplha1 is the v1alpha1 version of the API. package v1alpha1 diff --git a/pkg/api/sharedresource/v1alpha1/register.go b/pkg/api/sharedresource/v1alpha1/register.go index 760f7a5dc..e85d1aaab 100644 --- a/pkg/api/sharedresource/v1alpha1/register.go +++ b/pkg/api/sharedresource/v1alpha1/register.go @@ -8,7 +8,7 @@ import ( const ( Version = "v1alpha1" - GroupName = "sharedresource.storage.openshift.io" + GroupName = "sharedresource.openshift.io" ) var ( From 1332f26ebe750d124d3ab1f1f605b8ccce03f188 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Thu, 29 Jul 2021 11:57:55 -0400 Subject: [PATCH 06/13] Update deployment names - Use "csi-driver-shared-resource" for namespace and core components - Add suffixes for cluster role bindings - Rename csi driver deployment manifests to use desired ordering - Clarify comments in deploy scripts --- deploy/00-namespace.yaml | 2 +- deploy/01-service-account.yaml | 4 ++-- deploy/02-cluster-role.yaml | 4 ++-- deploy/03-cluster-role-binding.yaml | 14 ++++++------ ...riverinfo.yaml => 04-csi-driver-info.yaml} | 2 +- ...ugin.yaml => 05-csi-driver-daemonset.yaml} | 22 +++++++++---------- deploy/deploy-in-CI.sh | 4 ++-- deploy/deploy.sh | 12 +++++----- 8 files changed, 32 insertions(+), 32 deletions(-) rename deploy/{csi-hostpath-driverinfo.yaml => 04-csi-driver-info.yaml} (87%) rename deploy/{csi-hostpath-plugin.yaml => 05-csi-driver-daemonset.yaml} (89%) diff --git a/deploy/00-namespace.yaml b/deploy/00-namespace.yaml index 369a2194b..0ad7fdd1b 100644 --- a/deploy/00-namespace.yaml +++ b/deploy/00-namespace.yaml @@ -3,4 +3,4 @@ kind: Namespace metadata: labels: openshift.io/cluster-monitoring: "true" - name: csi-driver-projected-resource \ No newline at end of file + name: csi-driver-shared-resource \ No newline at end of file diff --git a/deploy/01-service-account.yaml b/deploy/01-service-account.yaml index 49f222fd9..b66b8e5c7 100644 --- a/deploy/01-service-account.yaml +++ b/deploy/01-service-account.yaml @@ -1,5 +1,5 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: csi-driver-projected-resource-plugin - namespace: csi-driver-projected-resource \ No newline at end of file + name: csi-driver-shared-resource + namespace: csi-driver-shared-resource \ No newline at end of file diff --git a/deploy/02-cluster-role.yaml b/deploy/02-cluster-role.yaml index edc657fd6..4b41770f0 100644 --- a/deploy/02-cluster-role.yaml +++ b/deploy/02-cluster-role.yaml @@ -1,7 +1,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: projected-resource-secret-configmap-share-watch-sar-create + name: csi-driver-shared-resource rules: - apiGroups: - "" @@ -14,7 +14,7 @@ rules: - list - watch - apiGroups: - - projectedresource.storage.openshift.io + - sharedresource.openshift.io resources: - shares verbs: diff --git a/deploy/03-cluster-role-binding.yaml b/deploy/03-cluster-role-binding.yaml index 9fd582945..1bc3da042 100644 --- a/deploy/03-cluster-role-binding.yaml +++ b/deploy/03-cluster-role-binding.yaml @@ -1,25 +1,25 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: projected-resource-privileged + name: csi-driver-shared-resource-privileged roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: system:openshift:scc:privileged subjects: - kind: ServiceAccount - name: csi-driver-projected-resource-plugin - namespace: csi-driver-projected-resource + name: csi-driver-shared-resource + namespace: csi-driver-shared-resource --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: projected-resource-secret-configmap-share-watch-sar-create + name: csi-driver-shared-resource roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: projected-resource-secret-configmap-share-watch-sar-create + name: csi-driver-shared-resource-deployment subjects: - kind: ServiceAccount - name: csi-driver-projected-resource-plugin - namespace: csi-driver-projected-resource + name: csi-drivver-shared-resource + namespace: csi-driver-shared-resource diff --git a/deploy/csi-hostpath-driverinfo.yaml b/deploy/04-csi-driver-info.yaml similarity index 87% rename from deploy/csi-hostpath-driverinfo.yaml rename to deploy/04-csi-driver-info.yaml index c179f4184..920ec7049 100644 --- a/deploy/csi-hostpath-driverinfo.yaml +++ b/deploy/04-csi-driver-info.yaml @@ -1,7 +1,7 @@ apiVersion: storage.k8s.io/v1 kind: CSIDriver metadata: - name: csi.shared-resources.openshift.io + name: csi.sharedresource.openshift.io spec: # Supports ephemeral inline volumes. volumeLifecycleModes: diff --git a/deploy/csi-hostpath-plugin.yaml b/deploy/05-csi-driver-daemonset.yaml similarity index 89% rename from deploy/csi-hostpath-plugin.yaml rename to deploy/05-csi-driver-daemonset.yaml index c21aa516d..552a5f1b8 100644 --- a/deploy/csi-hostpath-plugin.yaml +++ b/deploy/05-csi-driver-daemonset.yaml @@ -5,13 +5,13 @@ kind: Service apiVersion: v1 metadata: - name: csi-hostpathplugin - namespace: csi-driver-projected-resource + name: csi-driver-shared-resource + namespace: csi-driver-shared-resource labels: - app: csi-hostpathplugin + app: csi-driver-shared-resource spec: selector: - app: csi-hostpathplugin + app: csi-driver-shared-resource ports: - name: dummy port: 12345 @@ -19,20 +19,20 @@ spec: kind: DaemonSet apiVersion: apps/v1 metadata: - name: csi-hostpathplugin - namespace: csi-driver-projected-resource + name: csi-driver-shared-resource + namespace: csi-driver-shared-resource labels: - app: csi-hostpathplugin + app: csi-driver-shared-resource spec: selector: matchLabels: - app: csi-hostpathplugin + app: csi-driver-shared-resource template: metadata: labels: - app: csi-hostpathplugin + app: csi-driver-shared-resource spec: - serviceAccountName: csi-driver-projected-resource-plugin + serviceAccountName: csi-driver-shared-resource containers: - name: node-driver-registrar image: quay.io/openshift/origin-csi-node-driver-registrar:4.8.0 @@ -66,7 +66,7 @@ spec: command: - csi-driver-projected-resource args: - - "--drivername=csi.shared-resources.openshift.io" + - "--drivername=csi.sharedresource.openshift.io" - "--v=4" - "--endpoint=$(CSI_ENDPOINT)" - "--nodeid=$(KUBE_NODE_NAME)" diff --git a/deploy/deploy-in-CI.sh b/deploy/deploy-in-CI.sh index 808859d8e..0aa9bc558 100755 --- a/deploy/deploy-in-CI.sh +++ b/deploy/deploy-in-CI.sh @@ -13,11 +13,11 @@ run () { } -# deploy hostpath plugin and registrar sidecar +# deploy daemonset without registering the CSI driver echo "creating share CRD" run oc apply -f ${BASE_DIR}/0000_10_sharedresource.crd.yaml run oc apply -f ${BASE_DIR}/00-namespace.yaml run oc apply -f ${BASE_DIR}/01-service-account.yaml run oc apply -f ${BASE_DIR}/02-cluster-role.yaml run oc apply -f ${BASE_DIR}/03-cluster-role-binding.yaml -run oc apply -f ${BASE_DIR}/csi-hostpath-driverinfo.yaml \ No newline at end of file +run oc apply -f ${BASE_DIR}/05-csi-driver-daemonset.yaml \ No newline at end of file diff --git a/deploy/deploy.sh b/deploy/deploy.sh index a9b47fa0d..856c71636 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -19,8 +19,8 @@ run () { } -# deploy hostpath plugin and registrar sidecar -echo "deploying hostpath components" +# deploy csi driver daemonset +echo "deploying daemonset components" for i in $(ls ${BASE_DIR}/*.yaml | sort); do echo " $i" run oc apply -f $i @@ -29,15 +29,15 @@ done # Wait until all pods are running. expected_running_pods=3 cnt=0 -while [ $(oc get pods -n csi-driver-projected-resource 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l) -lt ${expected_running_pods} ]; do +while [ $(oc get pods -n csi-driver-shared-resource 2>/dev/null | grep '^csi-driver-shared-resource.* Running ' | wc -l) -lt ${expected_running_pods} ]; do if [ $cnt -gt 30 ]; then - echo "$(oc get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l) running pods:" + echo "$(oc get pods 2>/dev/null | grep '^csi-driver-shared-resource.* Running ' | wc -l) running pods:" oc describe pods - echo >&2 "ERROR: hostpath deployment not ready after over 5min" + echo >&2 "ERROR: daemonset deployment not ready after over 5min" exit 1 fi - echo $(date +%H:%M:%S) "waiting for hostpath deployment to complete, attempt #$cnt" + echo $(date +%H:%M:%S) "waiting for daemonset deployment to complete, attempt #$cnt" cnt=$(($cnt + 1)) sleep 10 done From 67bce7301e102781ff2ece0f83ba6b5d6e7b8436 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Thu, 29 Jul 2021 11:59:32 -0400 Subject: [PATCH 07/13] Fixes to api group name - Regenerate client - Update SAR check to use new api group - Use new group name when creating RBAC in test framework --- pkg/client/client.go | 2 +- .../typed/sharedresource/v1alpha1/fake/fake_share.go | 4 ++-- .../typed/sharedresource/v1alpha1/sharedresource_client.go | 2 +- pkg/generated/informers/externalversions/generic.go | 2 +- test/framework/rbac.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index c28a74747..d6a6d71e7 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -101,7 +101,7 @@ func ExecuteSAR(shareName, podNamespace, podName, podSA string) (bool, error) { sarClient := kubeClient.AuthorizationV1().SubjectAccessReviews() resourceAttributes := &authorizationv1.ResourceAttributes{ Verb: "get", - Group: "projectedresource.storage.openshift.io", + Group: "sharedresource.openshift.io", Resource: "shares", Name: shareName, } diff --git a/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/fake_share.go b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/fake_share.go index 8b8c66842..6d3cf75f7 100644 --- a/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/fake_share.go +++ b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/fake/fake_share.go @@ -25,9 +25,9 @@ type FakeShares struct { Fake *FakeSharedresourceV1alpha1 } -var sharesResource = schema.GroupVersionResource{Group: "sharedresource.storage.openshift.io", Version: "v1alpha1", Resource: "shares"} +var sharesResource = schema.GroupVersionResource{Group: "sharedresource.openshift.io", Version: "v1alpha1", Resource: "shares"} -var sharesKind = schema.GroupVersionKind{Group: "sharedresource.storage.openshift.io", Version: "v1alpha1", Kind: "Share"} +var sharesKind = schema.GroupVersionKind{Group: "sharedresource.openshift.io", Version: "v1alpha1", Kind: "Share"} // Get takes name of the share, and returns the corresponding share object, and an error if there is any. func (c *FakeShares) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Share, err error) { diff --git a/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/sharedresource_client.go b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/sharedresource_client.go index df2f92bf0..9f6657b5f 100644 --- a/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/sharedresource_client.go +++ b/pkg/generated/clientset/versioned/typed/sharedresource/v1alpha1/sharedresource_client.go @@ -19,7 +19,7 @@ type SharedresourceV1alpha1Interface interface { SharesGetter } -// SharedresourceV1alpha1Client is used to interact with features provided by the sharedresource.storage.openshift.io group. +// SharedresourceV1alpha1Client is used to interact with features provided by the sharedresource.openshift.io group. type SharedresourceV1alpha1Client struct { restClient rest.Interface } diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index c578644db..056887c42 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -42,7 +42,7 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=sharedresource.storage.openshift.io, Version=v1alpha1 + // Group=sharedresource.openshift.io, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithResource("shares"): return &genericInformer{resource: resource.GroupResource(), informer: f.Sharedresource().V1alpha1().Shares().Informer()}, nil diff --git a/test/framework/rbac.go b/test/framework/rbac.go index 51e9f8374..8feed7636 100644 --- a/test/framework/rbac.go +++ b/test/framework/rbac.go @@ -17,7 +17,7 @@ func createShareClusterRole(t *TestArgs) { Rules: []rbacv1.PolicyRule{ { Verbs: []string{"get", "list", "watch"}, - APIGroups: []string{"projectedresource.storage.openshift.io"}, + APIGroups: []string{"sharedresource.openshift.io"}, Resources: []string{"shares"}, ResourceNames: []string{t.Name}, }, From 68192b96b579a28c3c0a4324ed58aeecb4840f39 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Thu, 29 Jul 2021 13:11:30 -0400 Subject: [PATCH 08/13] fix default namespace for client --- pkg/client/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index d6a6d71e7..b515719d7 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -25,7 +25,7 @@ import ( const ( // TODO eventually change to the CSO csi driver namespace when shared-resources-operator is fully integrated into CSO and OCP - DefaultNamespace = "csi-driver-projected-resource" + DefaultNamespace = "csi-driver-shared-resource" ) var ( From ec43fe2b9d7b76a3efd56f6731b78abf3b09155c Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Tue, 3 Aug 2021 15:05:37 -0400 Subject: [PATCH 09/13] Fix CI deployment test Update component names to check in e2e tests. --- test/framework/daemonset.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/framework/daemonset.go b/test/framework/daemonset.go index 32156202b..bdd70ca52 100644 --- a/test/framework/daemonset.go +++ b/test/framework/daemonset.go @@ -19,7 +19,7 @@ import ( func WaitForDaemonSet(t *TestArgs) error { dsClient := kubeClient.AppsV1().DaemonSets(client.DefaultNamespace) err := wait.PollImmediate(1*time.Second, 10*time.Minute, func() (bool, error) { - _, err := dsClient.Get(context.TODO(), "csi-hostpathplugin", metav1.GetOptions{}) + _, err := dsClient.Get(context.TODO(), "csi-driver-shared-resource", metav1.GetOptions{}) if err != nil { t.T.Logf("%s: error waiting for driver daemonset to exist: %v", time.Now().String(), err) return false, nil @@ -107,23 +107,23 @@ func RestartDaemonSet(t *TestArgs) { //TODO possibly this can go away once we are in the OCP payload, though the csi driver operator element for all that needs to get sorted out, // but if it can, then hopefully repo images built from PRs are used when setting up this driver's daemonset func CreateCSIDriverPlugin(t *TestArgs) { - _, err1 := kubeClient.CoreV1().Services(client.DefaultNamespace).Get(context.TODO(), "csi-hostpathplugin", metav1.GetOptions{}) - _, err2 := kubeClient.AppsV1().DaemonSets(client.DefaultNamespace).Get(context.TODO(), "csi-hostpathplugin", metav1.GetOptions{}) + _, err1 := kubeClient.CoreV1().Services(client.DefaultNamespace).Get(context.TODO(), "csi-driver-shared-resource", metav1.GetOptions{}) + _, err2 := kubeClient.AppsV1().DaemonSets(client.DefaultNamespace).Get(context.TODO(), "csi-driver-shared-resource", metav1.GetOptions{}) if err1 == nil && err2 == nil { return } if err1 != nil { service := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: "csi-hostpathplugin", + Name: "csi-driver-shared-resource", Namespace: client.DefaultNamespace, Labels: map[string]string{ - "app": "csi-hostpathplugin", + "app": "csi-driver-shared-resource", }, }, Spec: corev1.ServiceSpec{ Selector: map[string]string{ - "app": "csi-hostpathplugin", + "app": "csi-driver-shared-resource", }, Ports: []corev1.ServicePort{ { @@ -162,26 +162,26 @@ func CreateCSIDriverPlugin(t *TestArgs) { } daemonSet := &appsv1.DaemonSet{ ObjectMeta: metav1.ObjectMeta{ - Name: "csi-hostpathplugin", + Name: "csi-driver-shared-resource", Namespace: client.DefaultNamespace, Labels: map[string]string{ - "app": "csi-hostpathplugin", + "app": "csi-driver-shared-resource", }, }, Spec: appsv1.DaemonSetSpec{ Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{ - "app": "csi-hostpathplugin", + "app": "csi-driver-shared-resource", }, }, Template: corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ - "app": "csi-hostpathplugin", + "app": "csi-driver-shared-resource", }, }, Spec: corev1.PodSpec{ - ServiceAccountName: "csi-driver-projected-resource-plugin", + ServiceAccountName: "csi-driver-shared-resource", Volumes: []corev1.Volume{ { Name: "socket-dir", @@ -291,7 +291,7 @@ func CreateCSIDriverPlugin(t *TestArgs) { ImagePullPolicy: corev1.PullAlways, Command: []string{"csi-driver-projected-resource"}, Args: []string{ - "--drivername=csi.shared-resources.openshift.io", + "--drivername=csi.sharedresource.openshift.io", "--v=4", "--endpoint=$(CSI_ENDPOINT)", "--nodeid=$(KUBE_NODE_NAME)", From 8b84418086bb47b0216daded7145f4a9b889cb91 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Tue, 3 Aug 2021 15:06:12 -0400 Subject: [PATCH 10/13] Update docs - Update component names in install docs - Update driver name in example YAML. --- docs/install.md | 54 +++++++++++++++++++++---------------------- examples/csi-app.yaml | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/install.md b/docs/install.md index d1c6f9888..9c9784ab4 100644 --- a/docs/install.md +++ b/docs/install.md @@ -24,13 +24,13 @@ Kubernetes resources: ```shell namespace/csi-driver-projected-resource created customresourcedefinition.apiextensions.k8s.io/shares.projectedresource.storage.openshift.io created -serviceaccount/csi-driver-projected-resource-plugin created -clusterrole.rbac.authorization.k8s.io/projected-resource-secret-configmap-share-watch-sar-create created -clusterrolebinding.rbac.authorization.k8s.io/projected-resource-privileged created -clusterrolebinding.rbac.authorization.k8s.io/projected-resource-secret-configmap-share-watch-sar-create created +serviceaccount/csi-driver-shared-resource created +clusterrole.rbac.authorization.k8s.io/csi-driver-shared-resource created +clusterrolebinding.rbac.authorization.k8s.io/csi-driver-shared-resource-privileged created +clusterrolebinding.rbac.authorization.k8s.io/csi-driver-shared-resource created csidriver.storage.k8s.io/csi-driver-projected-resource.openshift.io created -service/csi-hostpathplugin created -daemonset.apps/csi-hostpathplugin created +service/csi-driver-shared-resource created +daemonset.apps/csi-driver-shared-resource created ``` ### Installing from a local clone of this repository @@ -55,21 +55,21 @@ oc apply -f ./deploy/00-namespace.yaml namespace/csi-driver-projected-resource created ./deploy/01-service-account.yaml oc apply -f ./deploy/01-service-account.yaml -serviceaccount/csi-driver-projected-resource-plugin created +serviceaccount/csi-driver-shared-resource created ./deploy/02-cluster-role.yaml oc apply -f ./deploy/02-cluster-role.yaml -clusterrole.rbac.authorization.k8s.io/projected-resource-secret-configmap-share-watch-sar-create created +clusterrole.rbac.authorization.k8s.io/csi-driver-shared-resource created ./deploy/03-cluster-role-binding.yaml oc apply -f ./deploy/03-cluster-role-binding.yaml -clusterrolebinding.rbac.authorization.k8s.io/projected-resource-privileged unchanged -clusterrolebinding.rbac.authorization.k8s.io/projected-resource-secret-configmap-share-watch-sar-create unchanged +clusterrolebinding.rbac.authorization.k8s.io/csi-driver-shared-resource-privileged unchanged +clusterrolebinding.rbac.authorization.k8s.io/csi-driver-shared-resource unchanged ./deploy/csi-hostpath-driverinfo.yaml oc apply -f ./deploy/csi-hostpath-driverinfo.yaml csidriver.storage.k8s.io/csi-driver-projected-resource.openshift.io created ./deploy/csi-hostpath-plugin.yaml oc apply -f ./deploy/csi-hostpath-plugin.yaml -service/csi-hostpathplugin created -daemonset.apps/csi-hostpathplugin created +service/csi-driver-shared-resource created +daemonset.apps/csi-driver-shared-resource created 16:21:25 waiting for hostpath deployment to complete, attempt #0 ``` @@ -93,13 +93,13 @@ Kubernetes resources: ```shell namespace/csi-driver-projected-resource created customresourcedefinition.apiextensions.k8s.io/shares.projectedresource.storage.openshift.io created -serviceaccount/csi-driver-projected-resource-plugin created -clusterrole.rbac.authorization.k8s.io/projected-resource-secret-configmap-share-watch-sar-create created -clusterrolebinding.rbac.authorization.k8s.io/projected-resource-privileged created -clusterrolebinding.rbac.authorization.k8s.io/projected-resource-secret-configmap-share-watch-sar-create created +serviceaccount/csi-driver-shared-resource created +clusterrole.rbac.authorization.k8s.io/csi-driver-shared-resource created +clusterrolebinding.rbac.authorization.k8s.io/csi-driver-shared-resource-privileged created +clusterrolebinding.rbac.authorization.k8s.io/csi-driver-shared-resource created csidriver.storage.k8s.io/csi-driver-projected-resource.openshift.io created -service/csi-hostpathplugin created -daemonset.apps/csi-hostpathplugin created +service/csi-driver-shared-resource created +daemonset.apps/csi-driver-shared-resource created ``` @@ -123,13 +123,13 @@ Kubernetes resources: ```shell namespace/csi-driver-projected-resource created customresourcedefinition.apiextensions.k8s.io/shares.projectedresource.storage.openshift.io created -serviceaccount/csi-driver-projected-resource-plugin created -clusterrole.rbac.authorization.k8s.io/projected-resource-secret-configmap-share-watch-sar-create created -clusterrolebinding.rbac.authorization.k8s.io/projected-resource-privileged created -clusterrolebinding.rbac.authorization.k8s.io/projected-resource-secret-configmap-share-watch-sar-create created +serviceaccount/csi-driver-shared-resource created +clusterrole.rbac.authorization.k8s.io/csi-driver-shared-resource created +clusterrolebinding.rbac.authorization.k8s.io/csi-driver-shared-resource-privileged created +clusterrolebinding.rbac.authorization.k8s.io/csi-driver-shared-resource created csidriver.storage.k8s.io/csi-driver-projected-resource.openshift.io created -service/csi-hostpathplugin created -daemonset.apps/csi-hostpathplugin created +service/csi-driver-shared-resource created +daemonset.apps/csi-driver-shared-resource created ``` @@ -141,7 +141,7 @@ On a 3 node OCP cluster, this will look something like: ```shell $ oc get pods -n csi-driver-projected-resource NAME READY STATUS RESTARTS AGE -csi-hostpathplugin-c7bbk 2/2 Running 0 23m -csi-hostpathplugin-m4smv 2/2 Running 0 23m -csi-hostpathplugin-x9xjw 2/2 Running 0 23m +csi-driver-shared-resource-c7bbk 2/2 Running 0 23m +csi-driver-shared-resource-m4smv 2/2 Running 0 23m +csi-driver-shared-resource-x9xjw 2/2 Running 0 23m ``` diff --git a/examples/csi-app.yaml b/examples/csi-app.yaml index 2ff534f49..ca2b67857 100644 --- a/examples/csi-app.yaml +++ b/examples/csi-app.yaml @@ -27,6 +27,6 @@ spec: - name: my-csi-volume csi: #readOnly: true - driver: csi.shared-resources.openshift.io + driver: csi.sharedresource.openshift.io volumeAttributes: share: my-share \ No newline at end of file From 7bd4ab2b33e20269e2683e1b3d0f94de7fa119bd Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Tue, 3 Aug 2021 17:40:11 -0400 Subject: [PATCH 11/13] Fix driver name Fix driver name used in tests --- test/framework/pod.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/framework/pod.go b/test/framework/pod.go index bf95b3138..404cbba1d 100644 --- a/test/framework/pod.go +++ b/test/framework/pod.go @@ -16,7 +16,6 @@ import ( "k8s.io/apimachinery/pkg/util/wait" kubexec "k8s.io/kubectl/pkg/cmd/exec" - operatorv1 "github.com/openshift/api/operator/v1" "github.com/openshift/csi-driver-projected-resource/pkg/client" ) @@ -37,8 +36,9 @@ func CreateTestPod(t *TestArgs) { Name: "my-csi-volume", VolumeSource: corev1.VolumeSource{ CSI: &corev1.CSIVolumeSource{ - ReadOnly: &t.ReadOnly, - Driver: string(operatorv1.SharedResourcesCSIDriver), + ReadOnly: &t.ReadOnly, + // TODO: Update openshift/api with new driver name + Driver: "csi.sharedresource.openshift.io", VolumeAttributes: map[string]string{"share": t.Name}, }, }, @@ -65,8 +65,9 @@ func CreateTestPod(t *TestArgs) { Name: "my-csi-volume" + secondShareSuffix, VolumeSource: corev1.VolumeSource{ CSI: &corev1.CSIVolumeSource{ - ReadOnly: &t.ReadOnly, - Driver: string(operatorv1.SharedResourcesCSIDriver), + ReadOnly: &t.ReadOnly, + // TODO: Update openshift/api with new driver name + Driver: "csi.sharedresource.openshift.io", VolumeAttributes: map[string]string{"share": t.SecondName}, }, }, From 64a2089f79d5b11e3ed0239227f62cc962adc4d6 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Wed, 4 Aug 2021 10:25:18 -0400 Subject: [PATCH 12/13] Fix driver name in main.go --- cmd/main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index c28aa349a..6bb0bf2bf 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -3,16 +3,16 @@ package main import ( "flag" "fmt" - "github.com/spf13/cobra" - "github.com/spf13/pflag" "os" "os/signal" "syscall" "time" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + "k8s.io/klog/v2" - "github.com/openshift/api/operator/v1" "github.com/openshift/csi-driver-projected-resource/pkg/controller" "github.com/openshift/csi-driver-projected-resource/pkg/hostpath" ) @@ -62,7 +62,8 @@ func init() { rootCmd.Flags().AddGoFlagSet(flag.CommandLine) rootCmd.Flags().StringVar(&endPoint, "endpoint", "unix://tmp/csi.sock", "CSI endpoint") - rootCmd.Flags().StringVar(&driverName, "drivername", string(v1.SharedResourcesCSIDriver), "name of the driver") + // TODO: Use name registered in openshift/api + rootCmd.Flags().StringVar(&driverName, "drivername", "csi.sharedresource.openshift.io", "name of the driver") rootCmd.Flags().StringVar(&nodeID, "nodeid", "", "node id") rootCmd.Flags().Int64Var(&maxVolumesPerNode, "maxvolumespernode", 0, "limit of volumes per node") rootCmd.Flags().StringVar(&shareRelistInterval, "share-relist-interval", "", From 3b6a5dfce1127e82a023332a36bc28d652ec736e Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Wed, 4 Aug 2021 10:28:11 -0400 Subject: [PATCH 13/13] Register CSIDriver when running tests --- deploy/deploy-in-CI.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy/deploy-in-CI.sh b/deploy/deploy-in-CI.sh index 0aa9bc558..5252eaef9 100755 --- a/deploy/deploy-in-CI.sh +++ b/deploy/deploy-in-CI.sh @@ -20,4 +20,5 @@ run oc apply -f ${BASE_DIR}/00-namespace.yaml run oc apply -f ${BASE_DIR}/01-service-account.yaml run oc apply -f ${BASE_DIR}/02-cluster-role.yaml run oc apply -f ${BASE_DIR}/03-cluster-role-binding.yaml +run oc apply -f ${BASE_DIR}/04-csi-driver-info.yaml run oc apply -f ${BASE_DIR}/05-csi-driver-daemonset.yaml \ No newline at end of file