Newer
Older
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
</li>
<li>
<p>Namespaces: Kubernetes namespaces provide a way to partition resources within a cluster. The diagram shows that multiple namespaces (nsxx, nsyy, nsz) can be managed by CRIDGE.</p>
<blockquote>
<p>CR (Custom Resource): A CR is an instance of a CRD. It represents the actual custom resource that is managed within the Kubernetes cluster. Example shown in different namespaces:
<div class="language-yaml highlight"><pre><span></span><code><span id="__span-1-1"><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">example.com/v1</span>
</span><span id="__span-1-2"><a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Myresource</span>
</span><span id="__span-1-3"><a id="__codelineno-1-3" name="__codelineno-1-3" href="#__codelineno-1-3"></a><span class="nt">metadata</span><span class="p">:</span>
</span><span id="__span-1-4"><a id="__codelineno-1-4" name="__codelineno-1-4" href="#__codelineno-1-4"></a><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">example_resource_1</span>
</span></code></pre></div></p>
</blockquote>
</li>
</ul>
<p>In a nutchell:</p>
<ul>
<li>Various OSL services use the Service Bus to communicate with CRIDGE.</li>
<li>CRIDGE converts requests towards Kubernetes API and vice-versa, facilitating the integration of custom resources with other OSL services.</li>
<li>CRDs are defined and managed through the K8s API. The example CRD is named myresource.example.com.</li>
<li>Deploying CRs in Namespaces: Custom resources defined by the CRD are created and managed within different namespaces in the Kubernetes cluster. Each namespace can have its own instances of the custom resources.</li>
</ul>
<blockquote>
<p>The example CRD myresource.example.com allows the creation of custom resources of type Myresource.</p>
<p>Instances of Myresource are created in various namespaces, each with unique names like example_resource_1.</p>
</blockquote>
<h2 id="mupliple-clusters-management">Mupliple Clusters Management</h2>
<p>A CRIDGE service is usually responsible for managing one cluster. In the following diagram we show how it can be used for managing multiple clusters:</p>
<p><a class="glightbox" href="../images/cridge/img03.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="img03.png" src="../images/cridge/img03.png" /></a></p>
<p>We assume that there is an OSL Management cluster that OSL is installed. CRIDGE is also installed there if we would like to manage resources in the same management cluster. </p>
<ul>
<li>Each CRIDGE service has its own configuration to connect to target cluster</li>
<li>Each CRIDGE can be installed either in the managed cluster or at the remote clusters. Connectivity is handled via the service bus.</li>
<li><strong>Important</strong>: Each CRIDGE has a different context and API endpoints. This is used to request CRDs on a different cluster.</li>
</ul>
<blockquote>
<p>A CRD has a globally unique name for example mycrd.example.com. So we need to somehow identify also the different cluster.</p>
</blockquote>
<h2 id="awareness-for-crds-and-crs-in-a-cluster">Awareness for CRDs and CRs in a Cluster</h2>
<blockquote>
<p>CRDs and CRs can appear (disappear) or change status at any time in a cluster. OSL Resource Inventory need to be aware of these events.</p>
</blockquote>
<p>The implemented synchronization process is explained by the following diagram:</p>
<p><a class="glightbox" href="../images/cridge/img04.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="img04.png" src="../images/cridge/img04.png" /></a></p>
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
<p>WatcherService is executed when the CRIDGE service application starts (see onApplicationEvent). Specifically:</p>
<ul>
<li>KubernetesClientResource is a class that wraps fabric8’s KubernetesClient<ul>
<li>This fabric8 KubernetesClient is initialized from the kubeconf and default context of the machine that runs CRIDGE</li>
</ul>
</li>
<li>On CRIDGE start-up we try to register this cluster and context to OSL catalogs.<ul>
<li>See registerKubernetesClientInOSLResource method which registers the KubernetesContextDefinition in Resource Inventory as a LogicalResource via createOrUpdateResourceByNameCategoryVersion method</li>
</ul>
</li>
<li>After the creation (or update) of this cluster as a Resource in OSL we proceed to create SharedIndexInformers for CustomResourceDefinition objects</li>
<li>In this way, CRIDGE is always aware of all CRDs and their CRs in the cluster, even if a CRD or CR is added/updated/deleted in the K8S cluster outside of OSL (CRIDGE)</li>
<li>The SharedIndexInformer events notify CRIDGE, which is always aware of all CRDs and their CRs in the cluster, even if a CRD or CR is added/updated/deleted in the K8S cluster outside of OSL (CRIDGE)<ul>
<li>NOTE: The ADD event is raised every time also we run CRIDGE. Therefore, on ADD we do the method to createORupdate resource specifications and resources</li>
</ul>
</li>
<li>On ADD event:<ul>
<li>The CRD is transformed to OSL Kubernetes domain model: method kubernetesClientResource.KubernetesCRD2OpensliceCRD</li>
<li>Then the OSL Kubernetes domain model is:<ul>
<li>Transformed to Resource Specification and is stored to catalog (see createOrUpdateResourceSpecByNameCategoryVersion)</li>
<li>Transformed to Resource and is stored to catalog (see createOrUpdateResourceByNameCategoryVersion)</li>
</ul>
</li>
<li>Conceptually while a CRD is a new resource located in the Kubernetes cluster resource, it is transformed also as a Resource Specification (a high-level entity) which is ready to be reused as an entity to other scenarios. The same concept as in Kubernetes where a CRD is a definition ready to be used for instantiating resources of this CRD</li>
<li>Then for this CRD a Watcher is added for all Resources of this Kind (fabric8’s GenericKubernetesResource entity) </li>
<li>When we have a newly added/updated/deleted resource of a certain CRD the method updateGenericKubernetesResourceInOSLCatalog is called for this object (fabric8’s GenericKubernetesResource entity)</li>
<li>We examine if the resource has label org.etsi.osl.resourceId<ul>
<li>This label is added by OSOM during service orders to correlate K8S requested resources with resources in inventory</li>
</ul>
</li>
<li>If the label exists, we update the resource by ID updateResourceById</li>
<li>Else a resource is created in catalog</li>
</ul>
</li>
</ul>
<h2 id="exposure-of-crds-as-service-specifications">Exposure of CRDs as Service Specifications</h2>
<p>See <a href="../../service_design/kubernetes/exposing_kubernetes_resources/">Exposing Kubernetes Resources</a> section for ways to design services around CRDs.</p>
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
<h2 id="service-orchestration-and-crdscrs">Service Orchestration and CRDs/CRs</h2>
<p>OSOM checks the presence of attribute _CR_SPEC at the RFS to make a request for a CR deployment</p>
<ul>
<li>_CR_SPEC is a JSON or YAML string that is used for the request<ul>
<li>It is similar to what one will do with e.g. a kubectl apply</li>
<li>There are tools to translate a yaml file to a json</li>
</ul>
</li>
</ul>
<blockquote>
<p>LCM rules can be used to change attributes of this yaml/json file, before sending this for orchestration</p>
</blockquote>
<p>However, the following issue needs to be solved: <strong>How to map the CR lifecycle that is defined in the CRD with the TMF resource Lifecycle?</strong></p>
<p>For this We introduced the following characteristics: </p>
<ul>
<li>_CR_CHECK_FIELD</li>
<li>CR_CHECKVAL_STANDBY</li>
<li>_CR_CHECKVAL_ALARM </li>
<li>_CR_CHECKVAL_AVAILABLE</li>
<li>_CR_CHECKVAL_RESERVED</li>
<li>_CR_CHECKVAL_UNKNOWN</li>
<li>_CR_CHECKVAL_SUSPENDED</li>
</ul>
<p>OSOM sends to CRIDGE a message with the following information:</p>
<ul>
<li>currentContextCluster: current context of cluster </li>
<li>clusterMasterURL: current master url of the cluster </li>
<li>org.etsi.osl.serviceId: This is the related service id that the created resource has a reference </li>
<li>org.etsi.osl.resourceId: This is the related resource id that the created CR will wrap and reference. </li>
<li>org.etsi.osl.prefixName: we need to add a short prefix (default is cr) to various places. For example in K8s cannot start with a number </li>
<li>org.etsi.osl.serviceOrderId: the related service order id of this deployment request </li>
<li>org.etsi.osl.namespace: requested namespace name </li>
<li>org.etsi.osl.statusCheckFieldName: The name of the field that is needed to be monitored in order to monitor the status of the service and translate it to TMF resource statys (RESERVED AVAILABLE, etc) </li>
<li>org.etsi.osl.statusCheckValueStandby: The CR specific value (of the CheckFieldName) that needs to me mapped to the TMF resource state STANDBY (see org.etsi.osl.tmf.ri639.model.ResourceStatusType) </li>
<li>org.etsi.osl.statusCheckValueAlarm: The CR specific value (of the CheckFieldName) that needs to me mapped to the TMF resource state ALARMS (see org.etsi.osl.tmf.ri639.model.ResourceStatusType) </li>
<li>org.etsi.osl.statusCheckValueAvailable: The CR specific value (of the CheckFieldName) that needs to me mapped to the TMF resource state AVAILABLE (see org.etsi.osl.tmf.ri639.model.ResourceStatusType) </li>
<li>org.etsi.osl.statusCheckValueReserved: The CR specific value (of the CheckFieldName) that needs to me mapped to the TMF resource state RESERVED (see org.etsi.osl.tmf.ri639.model.ResourceStatusType) </li>
<li>org.etsi.osl.statusCheckValueUnknown: The CR specific value (of the CheckFieldName) that needs to me mapped to the TMF resource state UNKNOWN (see org.etsi.osl.tmf.ri639.model.ResourceStatusType) </li>
<li>
<p>org.etsi.osl.statusCheckValueSuspended: The CR specific value (of the CheckFieldName) that needs to me mapped to the TMF resource state SUSPENDED (see org.etsi.osl.tmf.ri639.model.ResourceStatusType) </p>
</li>
<li>
<p>Parameters:</p>
<ul>
<li>aService reference to the service that the resource and the CR belongs to</li>
<li>resourceCR reference the equivalent resource in TMF repo of the target CR. One to one mapping</li>
<li>orderId related service order ID</li>
<li>startDate start date of the deployment (not used currently)</li>
<li>endDate end date of the deployment (not used currently)</li>
<li>_CR_SPEC the spec that is sent to CRIDGE (in json)</li>
</ul>
</li>
<li>
<p>Returns:</p>
<ul>
<li>a string response from CRIDGE. It might return "OK" if everything is ok. "SEE OTHER" if there are multiple CRIDGEs then some other CRIDGE instance will handle the request for the equivalent cluster. Any other response is handled as error</li>
</ul>
</li>
<li>
<p>CRIDGE receives the message and creates according to the labels the necessary CR</p>
</li>
<li>It monitors the created resource(s) in namespace (see the Sequence Diagram in previous images)</li>
<li>It monitors and tries to figure out and map the Status of the CR to the TMF Status according to the provided org.etsi.osl.statusCheck* labels</li>
<li>It sends to the message bus the current resource for creation or update to the TMF service inventory</li>
</ul>
<h2 id="deployment-of-a-new-cr-based-on-a-crd">Deployment of a new CR based on a CRD</h2>
<p>The implemented process to deploy a CR is explained by the following diagram:</p>
<p><a class="glightbox" href="../images/cridge/img05.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="img05.png" src="../images/cridge/img05.png" /></a></p>
<ul>
<li>A message arrives to deploy a CR<ul>
<li>The call examines if this CRIDGE service can handle the request (based on context and masterURL)</li>
</ul>
</li>
<li>There are headers received and a _CR_SPEC in json</li>
<li>The _CR_SPEC is unmarshaled as GenericKubernetesResource</li>
<li>Headers are in format org.etsi.osl.*</li>
<li>These headers are injected as labels (see <a href="#service-orchestration-and-crdscrs">Service Orchestration section</a>)</li>
<li>A namespace is created for this resource</li>
<li>Watchers are created for this namespace for e.g. new secrets, config maps etc, so that they can be available back as resources to the Inventory of OSL</li>
</ul>
<h2 id="probe-further">Probe further</h2>
<p>See examples of exposing Kubernetes Operators as a Service via OpenSlice:</p>
<ul>
<li><a href="../../service_design/examples/calculator_crd_aas/calculator_crd_aas/">Offering "Calculator as a Service"</a></li>
<li><a href="../../service_design/examples/jenkins_helm_install_aas/jenkins_helm_install_aas/">Offering "Helm installation as a Service" (Jenkins example)</a></li>
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
</ul>
</article>
</div>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
<button type="button" class="md-top md-icon" data-md-component="top" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg>
Back to top
</button>
</main>
<footer class="md-footer">
<nav class="md-footer__inner md-grid" aria-label="Footer" >
<a href="../osom/" class="md-footer__link md-footer__link--prev" aria-label="Previous: OSOM">
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
</div>
<div class="md-footer__title">
<span class="md-footer__direction">
Previous
</span>
<div class="md-ellipsis">
OSOM
</div>
</div>
</a>
<a href="../metrico/" class="md-footer__link md-footer__link--next" aria-label="Next: METRICO">
<div class="md-footer__title">
<span class="md-footer__direction">
Next
</span>
<div class="md-ellipsis">
METRICO
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
</div>
</div>
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11z"/></svg>
</div>
</a>
</nav>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
<div class="md-copyright__highlight">
Copyright © 2025 ETSI OSL
</div>
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
<div class="md-social">
<a href="https://osl.etsi.org/" target="_blank" rel="noopener" title="osl.etsi.org" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M352 256c0 22.2-1.2 43.6-3.3 64H163.4c-2.2-20.4-3.3-41.8-3.3-64s1.2-43.6 3.3-64h185.3c2.2 20.4 3.3 41.8 3.3 64m28.8-64h123.1c5.3 20.5 8.1 41.9 8.1 64s-2.8 43.5-8.1 64H380.8c2.1-20.6 3.2-42 3.2-64s-1.1-43.4-3.2-64m112.6-32H376.7c-10-63.9-29.8-117.4-55.3-151.6 78.3 20.7 142 77.5 171.9 151.6zm-149.1 0H167.7c6.1-36.4 15.5-68.6 27-94.7 10.5-23.6 22.2-40.7 33.5-51.5C239.4 3.2 248.7 0 256 0s16.6 3.2 27.8 13.8c11.3 10.8 23 27.9 33.5 51.5 11.6 26 20.9 58.2 27 94.7m-209 0H18.6c30-74.1 93.6-130.9 172-151.6-25.5 34.2-45.3 87.7-55.3 151.6M8.1 192h123.1c-2.1 20.6-3.2 42-3.2 64s1.1 43.4 3.2 64H8.1C2.8 299.5 0 278.1 0 256s2.8-43.5 8.1-64m186.6 254.6c-11.6-26-20.9-58.2-27-94.6h176.6c-6.1 36.4-15.5 68.6-27 94.6-10.5 23.6-22.2 40.7-33.5 51.5-11.2 10.7-20.5 13.9-27.8 13.9s-16.6-3.2-27.8-13.8c-11.3-10.8-23-27.9-33.5-51.5zM135.3 352c10 63.9 29.8 117.4 55.3 151.6-78.4-20.7-142-77.5-172-151.6zm358.1 0c-30 74.1-93.6 130.9-171.9 151.6 25.5-34.2 45.2-87.7 55.3-151.6h116.7z"/></svg>
</a>
<a href="https://labs.etsi.org/rep/osl" target="_blank" rel="noopener" title="labs.etsi.org" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="m503.5 204.6-.7-1.8-69.7-181.78c-1.4-3.57-3.9-6.59-7.2-8.64-2.4-1.55-5.1-2.515-8-2.81s-5.7.083-8.4 1.11c-2.7 1.02-5.1 2.66-7.1 4.78-1.9 2.12-3.3 4.67-4.1 7.44l-47 144H160.8l-47.1-144c-.8-2.77-2.2-5.31-4.1-7.43-2-2.12-4.4-3.75-7.1-4.77a18.1 18.1 0 0 0-8.38-1.113 18.4 18.4 0 0 0-8.04 2.793 18.1 18.1 0 0 0-7.16 8.64L9.267 202.8l-.724 1.8a129.57 129.57 0 0 0-3.52 82c7.747 26.9 24.047 50.7 46.447 67.6l.27.2.59.4 105.97 79.5 52.6 39.7 32 24.2c3.7 1.9 8.3 4.3 13 4.3s9.3-2.4 13-4.3l32-24.2 52.6-39.7 106.7-79.9.3-.3c22.4-16.9 38.7-40.6 45.6-67.5 8.6-27 7.4-55.8-2.6-82"/></svg>
</a>
<a href="https://www.linkedin.com/company/openslice/" target="_blank" rel="noopener" title="www.linkedin.com" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3M135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5m282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9z"/></svg>
</a>
<a href="https://twitter.com/OpensliceOSS" target="_blank" rel="noopener" title="twitter.com" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8l164.9-188.5L26.8 48h145.6l100.5 132.9zm-24.8 373.8h39.1L151.1 88h-42z"/></svg>
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<div class="md-progress" data-md-component="progress" role="progressbar"></div>
<script id="__config" type="application/json">{"base": "../..", "features": ["navigation.instant", "navigation.instant.progress", "navigation.top", "navigation.footer", "navigation.path", "search", "search.highlight", "content.code.copy"], "search": "../../assets/javascripts/workers/search.f8cc74c7.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": {"provider": "mike"}}</script>
<script src="../../assets/javascripts/bundle.c8b220af.min.js"></script>
<script id="init-glightbox">const lightbox = GLightbox({"touchNavigation": true, "loop": false, "zoomable": true, "draggable": true, "openEffect": "zoom", "closeEffect": "zoom", "slideEffect": "slide"});
document$.subscribe(() => { lightbox.reload() });
</script></body>
</html>