From 437d47ed00be729fb65a4f26fbdb37cd8cbcdd26 Mon Sep 17 00:00:00 2001 From: Hugo Santos Date: Tue, 25 Jul 2023 08:44:51 +0200 Subject: [PATCH] statefulset: added support for template PersistentVolumeClaims. --- internal/frontend/cuefrontend/node.go | 2 + internal/frontend/cuefrontend/volumes.go | 6 +- internal/runtime/kubernetes/deployment.go | 30 ++++- internal/runtime/kubernetes/volumes.go | 45 ++++---- .../testdata/server/statefulminio/server.cue | 51 +++++++++ internal/versions/versions.json | 2 +- schema/volume.pb.go | 104 ++++++++++-------- schema/volume.proto | 1 + 8 files changed, 166 insertions(+), 75 deletions(-) create mode 100644 internal/testdata/server/statefulminio/server.cue diff --git a/internal/frontend/cuefrontend/node.go b/internal/frontend/cuefrontend/node.go index e865c051c..1c43c5104 100644 --- a/internal/frontend/cuefrontend/node.go +++ b/internal/frontend/cuefrontend/node.go @@ -61,6 +61,7 @@ type cueRequiredStorage struct { ByteCount string `json:"byteCount"` MountPath string `json:"mountPath"` PersistentID string `json:"persistentId"` + Template bool `json:"template"` } type cueProvides struct { @@ -340,6 +341,7 @@ func parseCueNode(ctx context.Context, env *schema.Environment, pl parsing.Early pv, err := anypb.New(&schema.PersistentVolume{ Id: d.PersistentID, SizeBytes: uint64(v), + Template: d.Template, }) if err != nil { return fnerrors.NewWithLocation(loc, "failed to marshal persistent volume: %w", err) diff --git a/internal/frontend/cuefrontend/volumes.go b/internal/frontend/cuefrontend/volumes.go index 521525cc5..e09b43a8d 100644 --- a/internal/frontend/cuefrontend/volumes.go +++ b/internal/frontend/cuefrontend/volumes.go @@ -71,8 +71,9 @@ type cueEphemeralVolume struct { } type cuePersistentVolume struct { - Id string `json:"id"` - Size string `json:"size"` + Id string `json:"id"` + Size string `json:"size"` + Template bool `json:"template"` } type cueWorkspaceSyncVolume struct { @@ -150,6 +151,7 @@ func parseVolume(ctx context.Context, pl parsing.EarlyPackageLoader, loc pkggrap definition = &schema.PersistentVolume{ Id: bits.Id, SizeBytes: uint64(sizeBytes), + Template: bits.Template, } case constants.VolumeKindHostPath: diff --git a/internal/runtime/kubernetes/deployment.go b/internal/runtime/kubernetes/deployment.go index c84e5742b..9eee69cd4 100644 --- a/internal/runtime/kubernetes/deployment.go +++ b/internal/runtime/kubernetes/deployment.go @@ -16,6 +16,7 @@ import ( "strings" "time" + "github.com/dustin/go-humanize" specs "github.com/opencontainers/image-spec/specs-go/v1" "golang.org/x/exp/slices" corev1 "k8s.io/api/core/v1" @@ -466,6 +467,8 @@ func prepareDeployment(ctx context.Context, target BoundNamespace, deployable ru volumes := deployable.Volumes mounts := deployable.MainContainer.Mounts + var volumeTemplates []*applycorev1.PersistentVolumeClaimApplyConfiguration + volumeDefs := map[string]*volumeDef{} for k, volume := range volumes { if volume.Name == "" { @@ -488,6 +491,7 @@ func prepareDeployment(ctx context.Context, target BoundNamespace, deployable ru quantity := resource.NewScaledQuantity(int64(ev.SizeBytes), 0) emptydir = emptydir.WithSizeLimit(*quantity) } + spec = spec.WithVolumes(applycorev1.Volume().WithName(name).WithEmptyDir(emptydir)) case constants.VolumeKindHostPath: @@ -509,17 +513,36 @@ func prepareDeployment(ctx context.Context, target BoundNamespace, deployable ru return fnerrors.InternalError("%s: failed to unmarshal persistent volume definition: %w", volume.Name, err) } + if pv.Template { + if deployable.Class != schema.DeployableClass_STATEFUL { + return fnerrors.InternalError("volume %q is a template, but the server is not stateful", volume.Name) + } + } + if pv.Id == "" { return fnerrors.BadInputError("%s: persistent ID is missing", volume.Name) } - v, operations, err := makePersistentVolume(target.namespace, target.env, deployable.ErrorLocation, volume.Owner, name, pv.Id, pv.SizeBytes, annotations) + v, pvc, err := makePersistentVolume(target.namespace, target.env, deployable.ErrorLocation, volume.Owner, name, pv.Id, pv.SizeBytes, pv.Template, annotations) if err != nil { return err } - spec = spec.WithVolumes(v) - s.operations = append(s.operations, operations...) + if v != nil { + spec = spec.WithVolumes(v) + } + + if pvc != nil { + if pv.Template { + volumeTemplates = append(volumeTemplates, pvc) + } else { + // spec = spec.WithVolumes(v) + s.operations = append(s.operations, kubedef.Apply{ + Description: fmt.Sprintf("Persistent storage for %s (%s)", volume.Owner, humanize.Bytes(pv.SizeBytes)), + Resource: pvc, + }) + } + } case constants.VolumeKindWorkspaceSync: volumeDef.isWorkspaceSync = true @@ -928,6 +951,7 @@ func prepareDeployment(ctx context.Context, target BoundNamespace, deployable ru WithReplicas(replicas). WithRevisionHistoryLimit(revisionHistoryLimit). WithTemplate(tmpl). + WithVolumeClaimTemplates(volumeTemplates...). WithSelector(applymetav1.LabelSelector().WithMatchLabels(kubedef.SelectById(deployable)))) if deployable.ConfigImage != nil { statefulSet.WithAnnotations(map[string]string{ diff --git a/internal/runtime/kubernetes/volumes.go b/internal/runtime/kubernetes/volumes.go index dbd42acc8..132257704 100644 --- a/internal/runtime/kubernetes/volumes.go +++ b/internal/runtime/kubernetes/volumes.go @@ -5,10 +5,8 @@ package kubernetes import ( - "fmt" "math" - "github.com/dustin/go-humanize" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" applycorev1 "k8s.io/client-go/applyconfigurations/core/v1" @@ -24,7 +22,7 @@ type volumeDef struct { isWorkspaceSync bool } -func makePersistentVolume(ns string, env *schema.Environment, loc fnerrors.Location, owner, name, persistentId string, sizeBytes uint64, annotations map[string]string) (*applycorev1.VolumeApplyConfiguration, definitions, error) { +func makePersistentVolume(ns string, env *schema.Environment, loc fnerrors.Location, owner, name, persistentId string, sizeBytes uint64, template bool, annotations map[string]string) (*applycorev1.VolumeApplyConfiguration, *applycorev1.PersistentVolumeClaimApplyConfiguration, error) { if sizeBytes >= math.MaxInt64 { return nil, nil, fnerrors.NewWithLocation(loc, "requiredstorage value too high (maximum is %d)", math.MaxInt64) } @@ -33,35 +31,38 @@ func makePersistentVolume(ns string, env *schema.Environment, loc fnerrors.Locat // Ephemeral environments are short lived, so there is no need for persistent volume claims. // Admin servers are excluded here as they run as singletons in a global namespace. - var operations definitions - var v *applycorev1.VolumeApplyConfiguration - if env.GetEphemeral() { - v = applycorev1.Volume(). + return applycorev1.Volume(). WithName(name). WithEmptyDir(applycorev1.EmptyDirVolumeSource(). - WithSizeLimit(*quantity)) + WithSizeLimit(*quantity)), nil, nil + } else if template { + return nil, applycorev1.PersistentVolumeClaim(name, ns). + WithLabels(kubedef.ManagedByUs()). + WithAnnotations(annotations). + WithSpec(applycorev1.PersistentVolumeClaimSpec(). + WithAccessModes(corev1.ReadWriteOnce). + WithResources(applycorev1.ResourceRequirements().WithRequests(corev1.ResourceList{ + corev1.ResourceStorage: *quantity, + }))), nil } else { - v = applycorev1.Volume(). + v := applycorev1.Volume(). WithName(name). WithPersistentVolumeClaim( applycorev1.PersistentVolumeClaimVolumeSource(). WithClaimName(persistentId)) - operations = append(operations, kubedef.Apply{ - Description: fmt.Sprintf("Persistent storage for %s (%s)", owner, humanize.Bytes(sizeBytes)), - Resource: applycorev1.PersistentVolumeClaim(persistentId, ns). - WithLabels(kubedef.ManagedByUs()). - WithAnnotations(annotations). - WithSpec(applycorev1.PersistentVolumeClaimSpec(). - WithAccessModes(corev1.ReadWriteOnce). - WithResources(applycorev1.ResourceRequirements().WithRequests(corev1.ResourceList{ - corev1.ResourceStorage: *quantity, - }))), - }) - } + pvc := applycorev1.PersistentVolumeClaim(persistentId, ns). + WithLabels(kubedef.ManagedByUs()). + WithAnnotations(annotations). + WithSpec(applycorev1.PersistentVolumeClaimSpec(). + WithAccessModes(corev1.ReadWriteOnce). + WithResources(applycorev1.ResourceRequirements().WithRequests(corev1.ResourceList{ + corev1.ResourceStorage: *quantity, + }))) - return v, operations, nil + return v, pvc, nil + } } func toK8sVol(vol *kubedef.SpecExtension_Volume) (*applycorev1.VolumeApplyConfiguration, error) { diff --git a/internal/testdata/server/statefulminio/server.cue b/internal/testdata/server/statefulminio/server.cue new file mode 100644 index 000000000..99a2d5d41 --- /dev/null +++ b/internal/testdata/server/statefulminio/server.cue @@ -0,0 +1,51 @@ +server: { + name: "minio-server" + + image: "minio/minio@sha256:de46799fc1ced82b784554ba4602b677a71966148b77f5028132fc50adf37b1f" + + // MinIO acts as an object store which requires a stateful deployment (more conservative update strategy). + class: "stateful" + + env: { + // Disable update checking as self-update will never be used. + MINIO_UPDATE: "off" + + MINIO_ROOT_USER: fromSecret: ":user" + MINIO_ROOT_PASSWORD: fromSecret: ":password" + } + + args: [ + "server", + "/minio", + "--address=:9000", + "--console-address=:9001", + ] + + mounts: { + "/minio": persistent: { + // Unique volume identifier + id: "minio-server-data" + size: "10GiB" + template: true + } + } +} + +secrets: { + "user": { + description: "Minio root user" + generate: { + uniqueId: "minio-user" + randomByteCount: 32 + format: "FORMAT_BASE32" + } + } + "password": { + description: "Minio root password" + generate: { + uniqueId: "minio-password" + randomByteCount: 32 + format: "FORMAT_BASE32" + } + } +} diff --git a/internal/versions/versions.json b/internal/versions/versions.json index c8f0675b7..77c22b195 100644 --- a/internal/versions/versions.json +++ b/internal/versions/versions.json @@ -1,5 +1,5 @@ { - "api_version": 86, + "api_version": 87, "minimum_api_version": 40, "cache_version": 1 } diff --git a/schema/volume.pb.go b/schema/volume.pb.go index df8b3f552..abab8a9db 100644 --- a/schema/volume.pb.go +++ b/schema/volume.pb.go @@ -233,6 +233,7 @@ type PersistentVolume struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` SizeBytes uint64 `protobuf:"varint,2,opt,name=size_bytes,json=sizeBytes,proto3" json:"size_bytes,omitempty"` + Template bool `protobuf:"varint,3,opt,name=template,proto3" json:"template,omitempty"` } func (x *PersistentVolume) Reset() { @@ -281,6 +282,13 @@ func (x *PersistentVolume) GetSizeBytes() uint64 { return 0 } +func (x *PersistentVolume) GetTemplate() bool { + if x != nil { + return x.Template + } + return false +} + type HostPathVolume struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -638,56 +646,58 @@ var file_schema_volume_proto_rawDesc = []byte{ 0x30, 0x0a, 0x0f, 0x45, 0x70, 0x68, 0x65, 0x6d, 0x65, 0x72, 0x61, 0x6c, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x69, 0x7a, 0x65, 0x42, 0x79, 0x74, 0x65, - 0x73, 0x22, 0x41, 0x0a, 0x10, 0x50, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x56, + 0x73, 0x22, 0x5d, 0x0a, 0x10, 0x50, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x69, 0x7a, 0x65, 0x42, - 0x79, 0x74, 0x65, 0x73, 0x22, 0x2e, 0x0a, 0x0e, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x74, 0x68, - 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x6f, 0x72, 0x79, 0x22, 0x29, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x53, 0x79, 0x6e, 0x63, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, - 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, - 0x81, 0x04, 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, - 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x45, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x2e, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x1a, 0xa3, 0x03, - 0x0a, 0x05, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x37, 0x0a, 0x06, 0x69, - 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x66, 0x6f, - 0x75, 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, - 0x46, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x06, 0x69, 0x6e, - 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x73, - 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x66, 0x6f, 0x75, 0x6e, 0x64, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x74, 0x52, 0x09, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, - 0x53, 0x65, 0x74, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x72, 0x65, - 0x66, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x61, 0x63, 0x6b, - 0x61, 0x67, 0x65, 0x52, 0x65, 0x66, 0x52, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, - 0x66, 0x12, 0x73, 0x0a, 0x15, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x5f, - 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x3f, 0x2e, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, - 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x4b, 0x75, - 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, - 0x66, 0x52, 0x13, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x53, 0x65, 0x63, - 0x72, 0x65, 0x74, 0x52, 0x65, 0x66, 0x1a, 0x55, 0x0a, 0x13, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x65, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, 0x66, 0x12, 0x1f, 0x0a, - 0x0b, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, - 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x4a, 0x04, 0x08, - 0x03, 0x10, 0x04, 0x22, 0x4a, 0x0a, 0x0b, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, - 0x65, 0x74, 0x12, 0x3b, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, - 0x25, 0x5a, 0x23, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6c, 0x61, 0x62, 0x73, - 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x74, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x22, 0x2e, 0x0a, 0x0e, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x74, 0x68, 0x56, 0x6f, 0x6c, 0x75, + 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x22, 0x29, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x79, 0x6e, + 0x63, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x81, 0x04, 0x0a, 0x12, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x6f, 0x6c, 0x75, + 0x6d, 0x65, 0x12, 0x45, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, + 0x61, 0x62, 0x6c, 0x65, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x1a, 0xa3, 0x03, 0x0a, 0x05, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x37, 0x0a, 0x06, 0x69, 0x6e, 0x6c, 0x69, 0x6e, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x06, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, + 0x12, 0x3d, 0x0a, 0x0a, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x53, 0x65, 0x74, 0x52, 0x09, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x65, 0x74, 0x12, + 0x3c, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x66, 0x52, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, 0x66, 0x12, 0x73, 0x0a, + 0x15, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x72, + 0x65, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x66, + 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x6f, 0x6c, + 0x75, 0x6d, 0x65, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x65, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, 0x66, 0x52, 0x13, 0x6b, + 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, + 0x65, 0x66, 0x1a, 0x55, 0x0a, 0x13, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, + 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, 0x66, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x63, + 0x72, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, + 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x4a, 0x04, 0x08, 0x03, 0x10, 0x04, 0x22, + 0x4a, 0x0a, 0x0b, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x74, 0x12, 0x3b, + 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1f, 0x2e, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x73, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x25, 0x5a, 0x23, 0x6e, + 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x6c, 0x61, 0x62, 0x73, 0x2e, 0x64, 0x65, 0x76, + 0x2f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/schema/volume.proto b/schema/volume.proto index a5ded0f42..c4d9bf185 100644 --- a/schema/volume.proto +++ b/schema/volume.proto @@ -43,6 +43,7 @@ message EphemeralVolume { message PersistentVolume { string id = 1; uint64 size_bytes = 2; + bool template = 3; } message HostPathVolume {