Skip to content
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

Refactor LabTemplate API to support new scenarios #347

Merged
merged 1 commit into from
Nov 27, 2020

Conversation

palexster
Copy link
Member

@palexster palexster commented Nov 17, 2020

Description

This PR refactors the LabTemplate API to enable possible support to:

To do so, we are required to change the APIs:

  • Kubevirt objects are not embedded in the API anymore

How Has This Been Tested?

@palexster palexster changed the title Refactor LabTemplate to support container laboratory Refactor LabTemplate API to support new scenarios Nov 17, 2020
@palexster
Copy link
Member Author

/rebase

@palexster palexster force-pushed the apa/new_labtemplate branch 4 times, most recently from b0fe5f0 to 9a40238 Compare November 26, 2020 08:40
@palexster palexster force-pushed the apa/new_labtemplate branch 3 times, most recently from 1d9fee9 to 9179868 Compare November 26, 2020 11:03
@palexster palexster marked this pull request as ready for review November 26, 2020 11:04
@palexster
Copy link
Member Author

/deploy-staging

@kingmakerbot
Copy link
Collaborator

Your staging environment has been correctly deployed/updated!

operators/api/v1alpha1/labtemplate_types.go Outdated Show resolved Hide resolved
operators/api/v1alpha2/common.go Show resolved Hide resolved
operators/api/v1alpha2/labtemplate_types.go Outdated Show resolved Hide resolved
operators/api/v1alpha2/labtemplate_types.go Outdated Show resolved Hide resolved
operators/api/v1alpha2/labtemplate_types.go Outdated Show resolved Hide resolved
operators/pkg/instanceCreation/creation.go Outdated Show resolved Hide resolved
@palexster palexster force-pushed the apa/new_labtemplate branch 3 times, most recently from 7d1e4e0 to e93ea4a Compare November 26, 2020 15:34
@palexster
Copy link
Member Author

/deploy-staging

@palexster
Copy link
Member Author

/undeploy-staging

@kingmakerbot
Copy link
Collaborator

Your staging environment has been correctly deployed/updated!

@kingmakerbot
Copy link
Collaborator

Your staging environment has been correctly teared-down!

@palexster
Copy link
Member Author

/deploy-staging

@kingmakerbot
Copy link
Collaborator

Your staging environment has been correctly deployed/updated!

@palexster palexster force-pushed the apa/new_labtemplate branch 2 times, most recently from 4957c37 to a2db207 Compare November 26, 2020 17:15
@palexster palexster force-pushed the apa/new_labtemplate branch 2 times, most recently from c584054 to b5b39fc Compare November 26, 2020 17:30
@palexster
Copy link
Member Author

/rebase

@kingmakerbot
Copy link
Collaborator

The generated files in the operators/ folder appear to be out-of-date.

Please, ensure you are using the correct version of controller-gen and re-run:

make generate
make manifests
Here it is an excerpt of the diff:
diff --git a/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml b/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml
index 33ca57b..f06d78f 100644
--- a/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml
@@ -26,10 +26,12 @@ spec:
       description: ImageList is the Schema for the ImageList API
       properties:
         apiVersion:
-            description: APIVersion defines the versioned schema of this representation of an object.
+            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.
+            description: Kind is a string value representing the REST resource this
+              object represents.
           type: string
         metadata:
           type: object
diff --git a/operators/deploy/crds/crownlabs.polito.it_instances.yaml b/operators/deploy/crds/crownlabs.polito.it_instances.yaml
index 4416635..d61d977 100644
--- a/operators/deploy/crds/crownlabs.polito.it_instances.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_instances.yaml
@@ -24,10 +24,12 @@ spec:
       description: Instance is the Schema for the labinstances API
       properties:
         apiVersion:
-            description: APIVersion defines the versioned schema of this representation of an object.
+            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.
+            description: Kind is a string value representing the REST resource this
+              object represents.
           type: string
         metadata:
           type: object
diff --git a/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml b/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml
index a845e96..9e8d32e 100644
--- a/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml
@@ -24,10 +24,12 @@ spec:
       description: LabInstance is the Schema for the labinstances API
       properties:
         apiVersion:
-            description: APIVersion defines the versioned schema of this representation of an object.
+            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.
+            description: Kind is a string value representing the REST resource this
+              object represents.
           type: string
         metadata:
           type: object
diff --git a/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml b/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml
index e47539a..a2d51f8 100644
--- a/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml
@@ -24,10 +24,12 @@ spec:
       description: LabTemplate is the Schema for the labtemplates API
       properties:
         apiVersion:
-            description: APIVersion defines the versioned schema of this representation of an object.
+            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.
+            description: Kind is a string value representing the REST resource this
+              object represents.
           type: string
         metadata:
           type: object
@@ -47,46 +49,67 @@ spec:
               pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
               x-kubernetes-int-or-string: true
             vm:
-                description: VirtualMachineInstance is *the* VirtualMachineInstance Definition.
+                description: VirtualMachineInstance is *the* VirtualMachineInstance
+                  Definition.
               properties:
                 apiVersion:
-                    description: APIVersion defines the versioned schema of this representation of an object.
+                    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.
+                    description: Kind is a string value representing the REST resource
+                      this object represents.
                   type: string
                 metadata:
                   type: object
                 spec:
-                    description: VirtualMachineInstance Spec contains the VirtualMachineInstance specification.
+                    description: VirtualMachineInstance Spec contains the VirtualMachineInstance
+                      specification.

@giorio94
Copy link
Member

/rebase

@kingmakerbot
Copy link
Collaborator

The generated files in the operators/ folder appear to be out-of-date.

Please, ensure you are using the correct version of controller-gen and re-run:

make generate
make manifests
Here it is an excerpt of the diff:
diff --git a/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml b/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml
index 33ca57b..f06d78f 100644
--- a/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml
@@ -26,10 +26,12 @@ spec:
       description: ImageList is the Schema for the ImageList API
       properties:
         apiVersion:
-            description: APIVersion defines the versioned schema of this representation of an object.
+            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.
+            description: Kind is a string value representing the REST resource this
+              object represents.
           type: string
         metadata:
           type: object
diff --git a/operators/deploy/crds/crownlabs.polito.it_instances.yaml b/operators/deploy/crds/crownlabs.polito.it_instances.yaml
index 4416635..d61d977 100644
--- a/operators/deploy/crds/crownlabs.polito.it_instances.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_instances.yaml
@@ -24,10 +24,12 @@ spec:
       description: Instance is the Schema for the labinstances API
       properties:
         apiVersion:
-            description: APIVersion defines the versioned schema of this representation of an object.
+            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.
+            description: Kind is a string value representing the REST resource this
+              object represents.
           type: string
         metadata:
           type: object
diff --git a/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml b/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml
index a845e96..9e8d32e 100644
--- a/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml
@@ -24,10 +24,12 @@ spec:
       description: LabInstance is the Schema for the labinstances API
       properties:
         apiVersion:
-            description: APIVersion defines the versioned schema of this representation of an object.
+            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.
+            description: Kind is a string value representing the REST resource this
+              object represents.
           type: string
         metadata:
           type: object
diff --git a/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml b/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml
index e47539a..a2d51f8 100644
--- a/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml
@@ -24,10 +24,12 @@ spec:
       description: LabTemplate is the Schema for the labtemplates API
       properties:
         apiVersion:
-            description: APIVersion defines the versioned schema of this representation of an object.
+            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.
+            description: Kind is a string value representing the REST resource this
+              object represents.
           type: string
         metadata:
           type: object
@@ -47,46 +49,67 @@ spec:
               pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
               x-kubernetes-int-or-string: true
             vm:
-                description: VirtualMachineInstance is *the* VirtualMachineInstance Definition.
+                description: VirtualMachineInstance is *the* VirtualMachineInstance
+                  Definition.
               properties:
                 apiVersion:
-                    description: APIVersion defines the versioned schema of this representation of an object.
+                    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.
+                    description: Kind is a string value representing the REST resource
+                      this object represents.
                   type: string
                 metadata:
                   type: object
                 spec:
-                    description: VirtualMachineInstance Spec contains the VirtualMachineInstance specification.
+                    description: VirtualMachineInstance Spec contains the VirtualMachineInstance
+                      specification.

@kingmakerbot
Copy link
Collaborator

The generated files in the operators/ folder appear to be out-of-date.

Please, ensure you are using the correct version of controller-gen and re-run:

make generate
make manifests
Here it is an excerpt of the diff:
diff --git a/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml b/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml
index 9a04056..a92e8fe 100644
--- a/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_imagelists.yaml
@@ -26,10 +26,14 @@ spec:
       description: ImageList is the Schema for the ImageList API
       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'
+            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'
+            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
diff --git a/operators/deploy/crds/crownlabs.polito.it_instances.yaml b/operators/deploy/crds/crownlabs.polito.it_instances.yaml
index 6d2a656..f92321f 100644
--- a/operators/deploy/crds/crownlabs.polito.it_instances.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_instances.yaml
@@ -24,10 +24,14 @@ spec:
       description: Instance is the Schema for the labinstances API
       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'
+            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'
+            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
diff --git a/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml b/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml
index 282786d..057d5c2 100644
--- a/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_labinstances.yaml
@@ -24,10 +24,14 @@ spec:
       description: LabInstance is the Schema for the labinstances API
       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'
+            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'
+            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
diff --git a/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml b/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml
index 2d1c63f..fc8d5eb 100644
--- a/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml
+++ b/operators/deploy/crds/crownlabs.polito.it_labtemplates.yaml
@@ -24,10 +24,14 @@ spec:
       description: LabTemplate is the Schema for the labtemplates API
       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'
+            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'
+            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
@@ -47,46 +51,89 @@ spec:
               pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
               x-kubernetes-int-or-string: true
             vm:
-                description: VirtualMachineInstance is *the* VirtualMachineInstance Definition. It represents a virtual machine in the runtime environment of kubernetes.
+                description: VirtualMachineInstance is *the* VirtualMachineInstance
+                  Definition. It represents a virtual machine in the runtime environment
+                  of kubernetes.
               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'
+                    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

Co-Authored-By: Marco Iorio <giorio94@gmail.com>
@giorio94 giorio94 added kind/feature New feature or request kind/breaking Breaking change and removed kind/feature New feature or request labels Nov 27, 2020
@palexster palexster added the kind/cleanup Refactoring code label Nov 27, 2020
@mlavacca
Copy link
Contributor

/merge

@kingmakerbot kingmakerbot merged commit 82612ad into master Nov 27, 2020
@kingmakerbot kingmakerbot deleted the apa/new_labtemplate branch November 27, 2020 17:59
@kingmakerbot
Copy link
Collaborator

Your staging environment has been correctly teared-down!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants