diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/ExposingCRDs_aaS_Example_Calculator.md b/docs/ExposingCRDs_aaS_Example_Calculator/ExposingCRDs_aaS_Example_Calculator.md index 28d8099586512424b5bf22aa97c8bcc1a29663f3..e50c05c53e03a0fc0e24ddbe117b6397dfa6bdab 100644 --- a/docs/ExposingCRDs_aaS_Example_Calculator/ExposingCRDs_aaS_Example_Calculator.md +++ b/docs/ExposingCRDs_aaS_Example_Calculator/ExposingCRDs_aaS_Example_Calculator.md @@ -4,10 +4,9 @@ ## Intended Audience: Service Designers -To illustrate the powerful concept of Kubernetes operators and how they can be utilized to offer a service through OpenSlice, -let's provide an example of a "Calculator as a Service." -This example will demonstrate the flexibility and capabilities of Kubernetes operators in managing custom resources -and automating operational tasks. +> To illustrate the powerful concept of Kubernetes operators and how they can be utilized to offer a service through OpenSlice, let's provide an example of a "Calculator as a Service." + +> This example will demonstrate the flexibility and capabilities of Kubernetes operators in managing custom resources and automating operational tasks. --- ## Offering "Calculator as a Service" through OpenSlice @@ -18,8 +17,9 @@ and automating operational tasks. - Also while the service is active, we can do further calculations, until we destroy it. -- Assume the following simple CRD of a calculator model accepting two params (spec section) and an action and returning a result (status section) -- The controller (the calculato code) is implemented in any language and is installed in a Kubernetes cluster +Assume the following simple CRD of a calculator model accepting two params (spec section) and an action and returning a result (status section) + +The controller (the calculator code) is implemented in any language and is installed in a Kubernetes cluster ``` @@ -103,17 +103,28 @@ To perform this through OpenSlice as a Service Specification ready to be ordered ### CRD is saved automatically as Resource Specification As soon as the CRD is deployed in the cluster (e.g. by your admin via kubctl or via any installation through the internet) it is automatically transformed and is available in OpenSlice catalogs as a Resource Specification. -- See also the fully qualified name of the resource specification. -- The resource specification name is quite unique, so you can install the CRD in many clusters around the internet. Each CRD on each cluster will appear here + +- See also the fully qualified name of the resource specification. + - MyCalculator@examples.osl.etsi.org/v1alpha1@docker-desktop@https://kubernetes.docker.internal:6443/ + - The resource specification name is quite unique, so you can install the CRD in many clusters around the internet. Each CRD on each cluster will appear here, for example: + - MyCalculator@examples.osl.etsi.org/v1alpha1@default_cluster@https://10.10.10.8:6443/ + - MyCalculator@examples.osl.etsi.org/v1alpha1@edge1_cluster@https://172.16.10.10:6443/ + - Having this OpenSlice can manage resources in multiple clusters <img src="img07.png" > +> See also the detailed characteristics. See how OpenSlice makes all characteristics automatically flat and expanded with key-value style <img src="img08.png" width=1024px> --- -### Create a ResourceFacingServiceSpecification +# Expose to Users + +## Start by Creating a ResourceFacingServiceSpecification + +From the UI menu create a new Service Specification + <img src="img09.png" width=1024px> @@ -124,7 +135,7 @@ As soon as the CRD is deployed in the cluster (e.g. by your admin via kubctl or ### Creation of CRD-related characteristics -- We need now to adjust some characteristics of this CRD as Resoruce Specification. +- We need now to adjust some characteristics of this CRD as Resource Specification. - OpenSlice transalted automatically the CRD spec in a flat list of characteristics.So the "spec" section from the original yaml for example, is now unfold into: spec, spec.parama, spec.paramb, etc. the same for "status" object - We need to make OpenSlice aware of when the service will be active. - So we go to characteristic _CR_CHECK_FIELD and we define that the field that shows the status of the service is the characteristic "status.status" (is a text field) @@ -132,7 +143,9 @@ As soon as the CRD is deployed in the cluster (e.g. by your admin via kubctl or - We need also to define the yaml file that OpenSLice will use to create the new resource in the kubernetes cluster - We insert the YAML in the characteristic _CR_SPEC - the _CR_SPEC is: ``` + the _CR_SPEC is: + +``` apiVersion: examples.osl.etsi.org/v1alpha1 kind: MyCalculator metadata: @@ -149,21 +162,45 @@ spec: > However the values are fixed. How do we allow a user to pass parameters through OpenSlice -### Pass parameters through OpenSlice +## Expose in Catalog + +Create a new CustomerFacingServiceSpecification + + - Go to the menu Service Specification>New Service Specification + - Create a service My Calulator and mark it as a Bundle + - Go to Service Specification Relationships and add MyCalculatorRFS + - The service will be automatically transformed to a "CustomerFacingServiceSpecification" + - Add the following characteristics as the image shows: + + +<img src="cfs_img12.png" width=1024px> + -We need to Create LCM rules in ResourceFacingServiceSpecification -- The goal of the rules is to allow the user to pass parameters to the actual resource towards the cluster. -- we will create one rule that will pass the parameters just before creating the service (PRE_PROVISION phase) -- we will create one rule that will pass the parameters while the service is active (SUPERVISION phase) -- The rules will be the same + + + +### Allow users to pass new values through OpenSlice + + + +We need to Create LCM rules in CustomerFacingServiceSpecification: + + - The goal of the rules is to allow the user to pass parameters to the actual resource towards the cluster. + - we will create one rule that will pass the parameters just before creating the service (PRE_PROVISION phase) + - we will create one rule that will pass the parameters while the service is active (SUPERVISION phase) + - The rules will be the same <img src="img12.png" width=1024px> If we see one rule it will look like the following: <img src="img13.png" width=1024px> -- We need to change the _CR_SPEC characteristic -- We use a block that changes a String according to variables +- We need to change the _CR_SPEC characteristic of the referenced ResourceFacingServiceSpecification +- First bring a block from Service>Relationships>Service Refs and drop the "Service MyCalculatorRFS" block +- Then add a list block from Lists +- Then add the block that modifies a referenced characteristic from Service>Relationships>Service Refs the block "Set value to characteristic of a Referenced Service" +- Add a block for text _CR_SPEC +- We use a block that changes a String according to variables Text>"A formatted text replacing variables from List" - See that we have as Input string the YAML string lines - see that parama, paramb has a %d (they accept integers), action is %s (accepts a string) - See that the variables tha will replace the %d, %d and %s are an list @@ -171,11 +208,19 @@ If we see one rule it will look like the following: - the second %d will be replaced with the value from characteristic spec.paramb - the %s will be replaced with the value from characteristic spec.action - -### Create a CustomerFacingServiceSpecification -We will now expose it to our users by creating a CustomerFacingServiceSpecification +If we see the SUPERVISION rule it will look like the following: + +- It contains also the Result field, which takes the value from the referenced service +- Add a block for the Result field from Service>Number blocks +- Add a str to int block from Number blocks +- Add Service>Relationships>Service Refs and drop the input block [Service MyCalculatorRFS] "Get Service details from current context running service" and select from the drop down the "serviceCharacteristicValue" +- Add as name the "status.result" + + +<img src="img13_1.png" width=1024px> + <img src="img14.png" width=1024px> @@ -196,20 +241,21 @@ When a user orders the service, it will look like this: - After the Service Order we have 2 services in service inventory on CFS and on RFS. Both have references to values - OpenSlice (via CRIDGE service) updates the Resource in Resource Inventory and OSOM updates the Services in Service Inventory - The Actual resources are running in the Kubernetes cluster managed by OpenSlice -- The result is in the characteristic status.result +- The result is in the characteristic status.result of the running service <img src="img17.png" width=800px> <img src="img18.png" width=1024px> - ### Modify the running service +### Modify the running service - The use can modify the service + The user can modify the service <img src="img19.png" width=1024px> - After a while the update is applied to the cluster, the controller will pick up the resource update and patch the resource - OpenSlice (via CRIDGE service) updates the Resource in Resource Inventory and OSOM updates the Services in Service Inventory +- The result will be available to the respective characteristic "Result" after a few seconds, as need to go through various steps (OpenSlice orchestrator, down to kubernetes, to Calculator controller and back) <img src="img20.png" width=1024px> diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/cfs_img12.png b/docs/ExposingCRDs_aaS_Example_Calculator/cfs_img12.png new file mode 100644 index 0000000000000000000000000000000000000000..d3f55dad53fef145b49e720afd5a13140a097917 Binary files /dev/null and b/docs/ExposingCRDs_aaS_Example_Calculator/cfs_img12.png differ diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/img07.png b/docs/ExposingCRDs_aaS_Example_Calculator/img07.png new file mode 100644 index 0000000000000000000000000000000000000000..6990bf18122d41d5c3eee345270c4c18b5b0a1dc Binary files /dev/null and b/docs/ExposingCRDs_aaS_Example_Calculator/img07.png differ diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/img08.png b/docs/ExposingCRDs_aaS_Example_Calculator/img08.png new file mode 100644 index 0000000000000000000000000000000000000000..fdb27bf11096f00458a89586ae5efc2cb8e162b8 Binary files /dev/null and b/docs/ExposingCRDs_aaS_Example_Calculator/img08.png differ diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/img09.png b/docs/ExposingCRDs_aaS_Example_Calculator/img09.png new file mode 100644 index 0000000000000000000000000000000000000000..a6b963879355580e242b02b10e007e1434fdceb3 Binary files /dev/null and b/docs/ExposingCRDs_aaS_Example_Calculator/img09.png differ diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/img10.png b/docs/ExposingCRDs_aaS_Example_Calculator/img10.png new file mode 100644 index 0000000000000000000000000000000000000000..73d0ef7c9aaa5e56098c5fca4420fd6c50b8cd2a Binary files /dev/null and b/docs/ExposingCRDs_aaS_Example_Calculator/img10.png differ diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/img13.png b/docs/ExposingCRDs_aaS_Example_Calculator/img13.png index 75f1d429ccd072b3c5a1a215165c5ab5e34d5d32..f97136493d1c2b6bca4c52a99a2d237a4109b090 100644 Binary files a/docs/ExposingCRDs_aaS_Example_Calculator/img13.png and b/docs/ExposingCRDs_aaS_Example_Calculator/img13.png differ diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/img13_1.png b/docs/ExposingCRDs_aaS_Example_Calculator/img13_1.png new file mode 100644 index 0000000000000000000000000000000000000000..f3d019ce3704a7397b9b5049022362dd1b8bc32a Binary files /dev/null and b/docs/ExposingCRDs_aaS_Example_Calculator/img13_1.png differ diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/img16.png b/docs/ExposingCRDs_aaS_Example_Calculator/img16.png index 83a167d66f2a4846b1f0f1364c503712f8a42011..11cd78e7cb200ee0506f09a681b01b41331de5bb 100644 Binary files a/docs/ExposingCRDs_aaS_Example_Calculator/img16.png and b/docs/ExposingCRDs_aaS_Example_Calculator/img16.png differ diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/img17.png b/docs/ExposingCRDs_aaS_Example_Calculator/img17.png index 52943f7a131fa0f247140cc93ff2cb2bc3a9c84f..d11c3c47217474cc72f95a746bbb71c5f913b840 100644 Binary files a/docs/ExposingCRDs_aaS_Example_Calculator/img17.png and b/docs/ExposingCRDs_aaS_Example_Calculator/img17.png differ diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/img19.png b/docs/ExposingCRDs_aaS_Example_Calculator/img19.png index 39c9d78b7b1b43d72b732b35a7b93a550626e78c..ad9d34b5396d69f7654447e4ee74331386adb2a5 100644 Binary files a/docs/ExposingCRDs_aaS_Example_Calculator/img19.png and b/docs/ExposingCRDs_aaS_Example_Calculator/img19.png differ diff --git a/docs/ExposingCRDs_aaS_Example_Calculator/img20.png b/docs/ExposingCRDs_aaS_Example_Calculator/img20.png index b7f4f6ad25699833493cde4cde23269bfb8c84d0..be0c6f94c46cfb6d0a5024115ebbe9200ae8812a 100644 Binary files a/docs/ExposingCRDs_aaS_Example_Calculator/img20.png and b/docs/ExposingCRDs_aaS_Example_Calculator/img20.png differ diff --git a/docs/HELM_Installation_aaS_Jenkins_Example/img061.png b/docs/HELM_Installation_aaS_Jenkins_Example/img061.png new file mode 100644 index 0000000000000000000000000000000000000000..f2dcdf951f264b1164804fba435449ad176e8da7 Binary files /dev/null and b/docs/HELM_Installation_aaS_Jenkins_Example/img061.png differ