You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/04/25 07:40:24 UTC

[GitHub] [camel-k] squakez commented on a diff in pull request #3230: Add a property to Mount trait that creates then mounts a PVC

squakez commented on code in PR #3230:
URL: https://github.com/apache/camel-k/pull/3230#discussion_r857336833


##########
pkg/trait/mount.go:
##########
@@ -52,6 +52,8 @@ type mountTrait struct {
 	Resources []string `property:"resources" json:"resources,omitempty"`
 	// A list of Persistent Volume Claims to be mounted. Syntax: [pvcname:/container/path]
 	Volumes []string `property:"volumes" json:"volumes,omitempty"`
+	// A Persistent Volume Claim to be created and mounted. Syntax: pvcname:storageClassName:requestedQuantity:/container/path
+	PVC string `property:"pvc" json:"pvc,omitempty"`

Review Comment:
   Probably we should have a slice of PVCs instead



##########
pkg/util/resource/config.go:
##########
@@ -170,6 +172,40 @@ func ParseVolume(item string) (*Config, error) {
 	}, nil
 }
 
+// CreateAndParseVolume will create and parse a volume and return a Config.
+func CreateAndParseVolume(item string) (*Config, error) {
+	pvcParts := strings.Split(item, ":")
+
+	if len(pvcParts) != 4 {
+		return nil, fmt.Errorf("could not create and mount pvc as %s", item)
+	}
+
+	pvc := corev1.PersistentVolumeClaim{

Review Comment:
   I think this object must be passed back to the caller. There you must invoke a function to store the PVC just created in the cluster. As an example, see what we do for the Service trait. We create it and then we apply it on the cluster: https://github.com/apache/camel-k/blob/main/pkg/trait/service.go#L112



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org