Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions docs/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* [Create a Volume Manager Custom Resource](#create-a-volume-manager-custom-resource)
* [Create a Pod using the Custom Resource Status](#create-a-pod-using-the-custom-resource-status)
* [Create a Deployment using the Custom Resource Status](#create-a-deployment-using-the-custom-resource-status)
* [Create a Deployment using the VCK Initializer](#create-a-deployment-using-the-vck-initializer)
* [Types of Sources](#types-of-sources)
* [Data distribution] (#data-distribution)

Expand Down Expand Up @@ -169,7 +170,68 @@ $ kubectl create -f resources/deployments/vck-deployment.yaml
deployment "vck-example-deployment" created
```

## Create a Deployment using the VCK Initializer

The VCK Initializer will ensure the volume manager data is only injected into Deployments with an `initializer.kubernetes.io/vck` annotation set to a non-empty value.

```yaml

"initializer.kubernetes.io/vck": '{
"name": "<insert-your-vck-name>",
"id": "<insert-your-vck-id>",
"containers": [
{
"name": "<insert-your contianer-name>",
"mount-path" : "<insert-your-mount-path>"
}
],
}'
```

| Key | Required | Description | Default |
|:----------------------|:---------:|:------------------------------------------------|:--------------|
| name | yes | The VCK name to append volumes to containers | |
| id | no | The id of the volume to append to container | first volume |
| containers | no | Name and MountPath of container | all |
| container.name | yes | Name of the container to append the VCK volume | |
| container.mount-path | no | Path for the VCK to mount the volume | /var/dataset |

The id key is optional it picks the first volume by default, similarly the container object is optional it picks all containers by default and appends it to default mount path "/var/datasets". If the container object just contains the name,vck is appended to default mount path "/var/datasets".
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add an example here which would cover the cases described?

Copy link
Author

Choose a reason for hiding this comment

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

so we have an examples folder where we could add this? I would rather have an example file than paste the yams here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I meant an example like we have for the source types at the bottom: https://github.com/IntelAI/vck/pull/61/files/69b16c782919477bbc63340f56f2e9e51e89b358#diff-2872b51e38bcd053c0e88c4fe5c28fd2L215. Just like snippets of the important parts.


* Annotation with only name

```yaml

"initializer.kubernetes.io/vck": '{
"name": "<insert-your-vck-name>"
}'
```

* Annotation with no containers

```yaml
"initializer.kubernetes.io/vck": '{
"name": "<insert-your-vck-name>",
"id": "<insert-your-vck-id>"
}'
```

* Annotation with no container.mount-path

```yaml
"initializer.kubernetes.io/vck": '{
"name": "<insert-your-vck-name>",
"id": "<insert-your-vck-id>",
"containers": [
{
"name": "<insert-your contianer-name>"
}
],
}'
```

## Types of Sources

The following source types are currently implemented:
* S3: Files present in an S3 bucket and provided as `volumeConfig.sourceURL` in the CR are downloaded/synced onto the number of nodes equal to `volumeConfig.replicas` and made available as a hostPath volume. Node affinity details are provided through `volume.nodeAffinity` to guide the scheduling of pods.
* NFS: The path exported by an NFS server is mounted and made available as a PVC.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: admissionregistration.k8s.io/v1alpha1
kind: InitializerConfiguration
metadata:
name: vck
initializers:
- name: vck.initializer.kubernetes.io
rules:
- apiGroups:
- "*"
apiVersions:
- "*"
resources:
- deployments
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"context"
"flag"

"github.com/IntelAI/vck/pkg/resource/reify"

apiv1 "k8s.io/api/core/v1"
Expand All @@ -13,6 +14,7 @@ import (
"github.com/IntelAI/vck/pkg/controller"
"github.com/IntelAI/vck/pkg/handlers"
"github.com/IntelAI/vck/pkg/hooks"
initializer "github.com/IntelAI/vck/pkg/initializer"
"github.com/IntelAI/vck/pkg/resource"
"github.com/IntelAI/vck/pkg/util"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -110,6 +112,11 @@ func main() {

// Start a controller for instances of our custom resource.
controller := controller.New(hooks, crdClient)

// Start initializer for vck
initializer := initializer.New(k8sClientset, crdClient)
go initializer.RunIntializer()

go controller.Run(ctx, *namespace)

<-ctx.Done()
Expand Down
Loading