-
Notifications
You must be signed in to change notification settings - Fork 1.8k
OSDOCS-15215#Volume populators TP > GA #96030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lpettyjo
wants to merge
1
commit into
openshift:main
Choose a base branch
from
lpettyjo:OSDOCS-15215
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
modules/persistent-storage-csi-vol-populator-procedure-admin.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * storage/container_storage_interface/persistent-storage-csi-vol-populators.adoc | ||
|
||
:_mod-docs-content-type: PROCEDURE | ||
[id="persistent-storage-csi-vol-populator-procedure-admin_{context}"] | ||
= Creating CRDs for volume populators | ||
|
||
The following procedure explains how to create an example "hello, world" customer resource definition (CRD) for a volume populator. | ||
|
||
Users can then create instances of this CRD to populate persistent volume claims (PVCs). | ||
|
||
.Prerequisites | ||
|
||
* Access to the {product-title} web console. | ||
|
||
* Access to the cluster with cluster-admin privileges. | ||
|
||
.Procedure | ||
|
||
To create a CRD for a volume populator: | ||
|
||
. Create a CRD volume populator using the following example YAML file: | ||
+ | ||
.Example CRD volume populator YAML file | ||
[source,yaml] | ||
---- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: hellos.hello.example.com | ||
spec: | ||
group: hello.example.com | ||
names: | ||
kind: Hello | ||
listKind: HelloList | ||
plural: hellos | ||
singular: hello | ||
scope: Namespaced | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: Hello is a specification for a Hello resource | ||
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 | ||
spec: | ||
description: HelloSpec is the spec for a Hello resource | ||
properties: | ||
fileContents: | ||
type: string | ||
fileName: | ||
type: string | ||
required: | ||
- fileContents | ||
- fileName | ||
type: object | ||
required: | ||
- spec | ||
type: object | ||
served: true | ||
storage: true | ||
---- | ||
|
||
.Next steps | ||
You can now create CR instances of this CRD to populate PVCs. |
139 changes: 139 additions & 0 deletions
139
modules/persistent-storage-csi-vol-populator-procedure.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * storage/container_storage_interface/persistent-storage-csi-vol-populators.adoc | ||
|
||
:_mod-docs-content-type: PROCEDURE | ||
[id="persistent-storage-csi-vol-populator-procedure_{context}"] | ||
= Creating pre-populated volumes using volume populators | ||
|
||
The following procedure explains how to use a custom data source, using the example 'hello, world' Custom Resource Definition (CRD) created previously, to create a pre-populated persistent volume claim (PVC)." | ||
|
||
.Prerequisites | ||
|
||
* You are logged in to a running {product-title} cluster. | ||
|
||
* A custom resource definition (CRD) for volume populators has already been created. | ||
|
||
.Procedure | ||
|
||
To create a pre-populated volume using a volume populator: | ||
|
||
. Create an instance of the "Hello" custom resource (CR) with the text "Hello, World!" by running the following command: | ||
+ | ||
[source,terminal] | ||
---- | ||
oc apply -f - <<EOF | ||
apiVersion: hello.example.com/v1alpha1 | ||
kind: Hello | ||
metadata: | ||
name: example-hello | ||
spec: | ||
fileName: example.txt | ||
fileContents: Hello, world! | ||
EOF | ||
---- | ||
+ | ||
The CR serves as the data source to populate the PVC that you create later in this procedure. | ||
|
||
. Create a PVC that references the Hello CR by using the following example file: | ||
+ | ||
.Example PVC YAML file | ||
[source,yaml] | ||
---- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: example-pvc | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10Mi | ||
dataSourceRef: <1> | ||
apiGroup: hello.example.com | ||
kind: Hello | ||
name: example-hello <2> | ||
volumeMode: Filesystem | ||
---- | ||
<1> The `dataSourceRef` field specifies the data source for the PVC. | ||
<2> The name of the CR that you are using as the data source. In this example, 'example-hello'. | ||
|
||
. Ensure that the PVC is created and in `Bound` status after a while by running the following command: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ oc get pvc example-pvc <1> | ||
---- | ||
<1> In this example, the name of the PVC is `example-pvc`. | ||
+ | ||
.Example output | ||
[source,terminal] | ||
---- | ||
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE | ||
example-pvc Bound my-pv 10Mi ReadWriteOnce gp3-csi <unset> 14s | ||
---- | ||
|
||
. Create a job that reads from the PVC to verify that the data source information was applied using the following example file: | ||
+ | ||
.Example job YAML file | ||
[source,yaml] | ||
---- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: example-job | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: example-container | ||
image: busybox:latest | ||
command: | ||
- cat | ||
- /mnt/example.txt <1> | ||
volumeMounts: | ||
- name: vol | ||
mountPath: /mnt | ||
restartPolicy: Never | ||
volumes: | ||
- name: vol | ||
persistentVolumeClaim: | ||
claimName: example-pvc <2> | ||
---- | ||
<1> The location and name of the file with the "Hello, world!" text. | ||
<2> The name of the PVC you created in Step 2. In this example, `example-pvc`. | ||
|
||
. Run the job by running the following command: | ||
+ | ||
[source,terminal] | ||
---- | ||
oc run example-job --image=busybox --command -- sleep 30 --restart=OnFailure | ||
---- | ||
+ | ||
.Example output | ||
[source,terminal] | ||
---- | ||
pod/example-job created | ||
---- | ||
|
||
. Wait for the job to finish (including all of its dependencies) by running the following command: | ||
+ | ||
[source,terminal] | ||
---- | ||
oc wait --for=condition=Complete job/example-job | ||
---- | ||
|
||
. Verify the contents collected by the job by running the following command: | ||
+ | ||
[source,terminal] | ||
---- | ||
oc logs job/example-job | ||
---- | ||
+ | ||
.Expected output | ||
+ | ||
[source,terminal] | ||
---- | ||
Hello, world! | ||
---- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * storage/container_storage_interface/persistent-storage-csi.adoc | ||
// * storage/container_storage_interface/persistent-storage-csi-vol-populators.adoc | ||
|
||
:_mod-docs-content-type: CONCEPT | ||
[id="persistent-storage-csi-vol-populator_{context}"] | ||
= Volume populators | ||
= Volume populators overview | ||
|
||
Volume populators use the `datasource` field in a persistent volume claim (PVC) spec to create pre-populated volumes. | ||
The volume populators feature allows you to create pre-populated volumes. | ||
|
||
Volume population is currently enabled, and supported as a Technology Preview feature. However, {product-title} does not ship with any volume populators. | ||
In {product-title} 4.12 through 4.19, the `dataSource` field in a persistent volume claim (PVC) spec provided volume populator capability. However, it was limited to using only PVCs and snapshots as the data source for populating volumes. Starting with {product-title} 4.20, the `dataSourceRef` field is used instead. With `dataSourceRef`, you can use any appropriate custom resource (CR) as the data source to pre-populate a new volume. | ||
|
||
[NOTE] | ||
==== | ||
Volume populator functionality using the `dataSource` field is likely to be deprecated in future versions. If you have created any volume populators using this field, consider re-creating your volume populators to use the new `dataSourceRef` field to avoid future issues. | ||
==== | ||
|
||
Volume population is enabled by default and {product-title} ships with the volume-data-source-validator controller installed. However, {product-title} does not ship with any volume populators. | ||
|
||
:FeatureName: Volume populators | ||
include::snippets/technology-preview.adoc[leveloffset=+1] |
24 changes: 24 additions & 0 deletions
24
storage/container_storage_interface/persistent-storage-csi-vol-populators.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
:_mod-docs-content-type: ASSEMBLY | ||
[id="persistent-storage-csi-vol-populators"] | ||
= Volume populators | ||
include::_attributes/common-attributes.adoc[] | ||
:context: persistent-storage-csi-vol-populators | ||
|
||
toc::[] | ||
|
||
include::modules/persistent-storage-csi-vol-populator.adoc[leveloffset=+1] | ||
|
||
== Creating volume populators | ||
To create and use volume populators: | ||
|
||
. Create a custom resource definition (CRD) for volume populators | ||
|
||
. Create a pre-populated volume using a volume populator | ||
|
||
include::modules/persistent-storage-csi-vol-populator-procedure-admin.adoc[leveloffset=+2] | ||
For information about how to pre-populated volume using a volume populator, see xref:../../storage/container_storage_interface/persistent-storage-csi-vol-populators.adoc#persistent-storage-csi-vol-populator-procedure_persistent-storage-csi-vol-populators[Creating pre-populated volumes with volume populators]. | ||
|
||
include::modules/persistent-storage-csi-vol-populator-procedure.adoc[leveloffset=+2] | ||
|
||
|
||
// TP features should be excluded from OSD and ROSA. When this feature is GA, it can be included in the OSD/ROSA docs, but with a warning that it is available as of version 4.x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.