Newer
Older
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
Introduction
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6_2" >
<label class="md-nav__link" for="__nav_6_2" id="__nav_6_2_label" tabindex="0">
<span class="md-ellipsis">
CAMARA
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_6_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_6_2">
<span class="md-nav__icon md-icon"></span>
CAMARA
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../addons/camara/intro/" class="md-nav__link">
<span class="md-ellipsis">
Offering CAMARAaaS
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../addons/camara/qod/" class="md-nav__link">
<span class="md-ellipsis">
Quality on Demand
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" checked>
<label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
<span class="md-ellipsis">
Design & Architecture
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_7">
<span class="md-nav__icon md-icon"></span>
Design & Architecture
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../architecture/" class="md-nav__link">
<span class="md-ellipsis">
Architecture
</span>
</a>
</li>
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
<li class="md-nav__item">
<a href="../messagebus/" class="md-nav__link">
<span class="md-ellipsis">
Message bus
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../osom/" class="md-nav__link">
<span class="md-ellipsis">
OSOM
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
CRIDGE
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
CRIDGE
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#introduction" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#approach" class="md-nav__link">
<span class="md-ellipsis">
Approach
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#mupliple-clusters-management" class="md-nav__link">
<span class="md-ellipsis">
Mupliple Clusters Management
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#awareness-for-crds-and-crs-in-a-cluster" class="md-nav__link">
<span class="md-ellipsis">
Awareness for CRDs and CRs in a Cluster
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#exposure-of-crds-as-service-specifications" class="md-nav__link">
<span class="md-ellipsis">
Exposure of CRDs as Service Specifications
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#service-orchestration-and-crdscrs" class="md-nav__link">
<span class="md-ellipsis">
Service Orchestration and CRDs/CRs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#deployment-of-a-new-cr-based-on-a-crd" class="md-nav__link">
<span class="md-ellipsis">
Deployment of a new CR based on a CRD
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#probe-further" class="md-nav__link">
<span class="md-ellipsis">
Probe further
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../metrico/" class="md-nav__link">
<span class="md-ellipsis">
METRICO
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../oauth/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7_7" >
<label class="md-nav__link" for="__nav_7_7" id="__nav_7_7_label" tabindex="0">
<span class="md-ellipsis">
APIs
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_7_7_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_7_7">
<span class="md-nav__icon md-icon"></span>
APIs
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../tmfapi/" class="md-nav__link">
<span class="md-ellipsis">
TMF API
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../nfvapi/" class="md-nav__link">
<span class="md-ellipsis">
NFV API
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../issuemgt/" class="md-nav__link">
<span class="md-ellipsis">
Issue management
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../centrallog/" class="md-nav__link">
<span class="md-ellipsis">
Central logging
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" >
<label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0">
<span class="md-ellipsis">
Contribute
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_8">
<span class="md-nav__icon md-icon"></span>
Contribute
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../contribute/developing/" class="md-nav__link">
<span class="md-ellipsis">
Developing
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../contribute/documenting/" class="md-nav__link">
<span class="md-ellipsis">
Documenting
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../terminology/" class="md-nav__link">
<span class="md-ellipsis">
Terminology
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#introduction" class="md-nav__link">
<span class="md-ellipsis">
Introduction
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#approach" class="md-nav__link">
<span class="md-ellipsis">
Approach
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#mupliple-clusters-management" class="md-nav__link">
<span class="md-ellipsis">
Mupliple Clusters Management
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#awareness-for-crds-and-crs-in-a-cluster" class="md-nav__link">
<span class="md-ellipsis">
Awareness for CRDs and CRs in a Cluster
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#exposure-of-crds-as-service-specifications" class="md-nav__link">
<span class="md-ellipsis">
Exposure of CRDs as Service Specifications
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#service-orchestration-and-crdscrs" class="md-nav__link">
<span class="md-ellipsis">
Service Orchestration and CRDs/CRs
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#deployment-of-a-new-cr-based-on-a-crd" class="md-nav__link">
<span class="md-ellipsis">
Deployment of a new CR based on a CRD
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#probe-further" class="md-nav__link">
<span class="md-ellipsis">
Probe further
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
<h1 id="cridge-a-service-to-manage-custom-resources-in-a-kubernetes-cluster">CRIDGE: A Service to manage Custom Resources in a Kubernetes Cluster</h1>
<!-- **Intended Audience: OpenSlice Developers** -->
<h2 id="introduction">Introduction</h2>
<p>Kubernetes is an orchestration system for automating software deployment, scaling, and management. One can interact though the Kubernetes API and it has a set of objects ready for use out of the box. Custom Resource Definitions (CRDs) is a way that allows to manage things other than Kubernetes itself and allows to create our own objects The use of CRDs makes the possibilities of Kubernetes management almost limitless. You can extend the base Kubernetes API with any object you like using CRDs.</p>
<p>CRIDGE is a service designed to create and manage Custom Resources (CRs) based on Custom Resource Definitions (CRDs) installed on a Kubernetes cluster. By leveraging OpenSlice (OSL), CRIDGE enables seamless integration and orchestration within Kubernetes environments, utilizing Kubernetes APIs via the TMF APIs and models. Thus, more or less, OSL exposes Kubernetes APIs as TMF APIs and models.</p>
<p>By allowing the design and lifecycle management of services/resources that expose CRDs/CRs in a Kubernetes cluster via the TMF APIs, OSL can be used in many complex scenarios now involing resources from multiple domains. </p>
<p>Pros, in a nutshell:</p>
<ol>
<li>
<p>CRIDGE service allows OSL to:</p>
<ul>
<li>Create and manage Custom Resources (CRs) using installed CRDs on a target Kubernetes cluster.</li>
<li>Facilitate complex orchestration scenarios by wrapping Kubernetes APIs as TMF APIs and models.</li>
<li>Handles connectivity to a Kubernetes cluster and manages the lifecycle of CRDs</li>
<li>Wraps the Kubernetes API, receives and provides resources towards other OSL services via the service bus</li>
</ul>
</li>
<li>
<p>Enabling Loose Coupling and Orchestration</p>
<ul>
<li>Language Flexibility: Developers can write CRDs in any language and expose them via the Kubernetes APIs. OSL will reuse these CRDs, enhancing flexibility and integration capabilities.</li>
<li>Familiar Deployment: Developers can create and deploy applications using familiar tools such as Helm charts, simplifying the process and reducing the learning curve.</li>
</ul>
</li>
<li>
<p>Ecosystem Reusability</p>
<ul>
<li>CRIDGE capitalizes on the extensive Kubernetes ecosystem, particularly focusing on operators (CRDs).</li>
<li>Key repositories and hubs such as artifacthub.io and Operatorhub.io can be utilized for finding and deploying operators.</li>
</ul>
</li>
<li>
<p>Service Catalog Exposure and Deployment</p>
<p>OSL can expose CRs in service catalogs, facilitating their deployment in complex scenarios.
These scenarios may include service bundles that involve multiple systems, such as RAN controllers or other Kubernetes clusters, providing a robust and versatile deployment framework.</p>
</li>
</ol>
<blockquote>
<p>Why the CRIDGE name? We wanted to build a service that maps TMF models to CRDs; a kind of a <strong>CR</strong>D to TMF br<strong>idge</strong>. Therefore CRIDGE was born.</p>
</blockquote>
<h2 id="approach">Approach</h2>
<blockquote>
<p>OSL in general is responsible for exposing Service Specifications which are ready to be ordered and orchestrated, through TMFORUM Open APIs as defined in the OSL Service Spec Catalog. Usually for a service specification a corresponding (one or more) Resource Specification (resourceSpecificationReference) is registered in the OSL Resource Spec Catalog.</p>
</blockquote>
<p>The following image illustrates the approach.</p>
<p><a class="glightbox" href="../images/cridge/img01.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="img01.png" src="../images/cridge/img01.png" /></a></p>
<ol>
<li>A CRD in a cluster will be mapped in TMF model as a Resource specification and therefore can be exposed as a service specification in a catalog</li>
<li>Service Orders can be created for this service specification. The OSL Orchestrator (OSOM) will manage the lifecycle of the Service Order.</li>
<li>OSOM creates a Resource in OSL Resource inventory and requests (via CRIDGE) a new Custom Resource (CR) in the target cluster<ul>
<li>The resource is created in a specific namespace (for example the UUID of the Service Order)</li>
<li>A CR in a cluster will be mapped in TMF model as a Resource in the resource Inventory</li>
<li>Other related resources created by the CRD Controller within the namespace are automatically created in OSL Resource Inventory under the same Service Order</li>
</ul>
</li>
</ol>
<p><a class="glightbox" href="../images/cridge/img02.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="img02.png" src="../images/cridge/img02.png" /></a></p>
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
<p>The provided image illustrates the architecture and workflow of the CRIDGE service, showing how it interacts with other components within a Kubernetes (K8s) cluster. </p>
<p>Following, there is an explanation of the key components and flow in the diagram:</p>
<ul>
<li>Other OSL Services: This box represents various OSL services such as Service Spec Catalogue, Resource Spec Catalogue, Service Inventory, Resource Inventory, and OSOM (OpenSlice Service Orchestration and Management).</li>
<li>Service Bus: This is the communication layer that facilitates interaction between the CRIDGE service and other OSL services.</li>
<li>CRIDGE: CRIDGE acts as a bridge that converts CRDs (Custom Resource Definitions) to TMF (TM Forum) APIs and models. It enables the creation and management of Custom Resources (CRs) in the Kubernetes cluster.</li>
<li>
<p>K8s API: The Kubernetes API server, which is the central control point for managing the Kubernetes cluster. CRIDGE interacts with the K8s API to manage CRDs and CRs.</p>
<blockquote>
<p>CRD (Custom Resource Definition): A CRD is a way to define custom resources in Kubernetes cluster-wise. It allows the extension of Kubernetes API to create and manage user-defined resources. Example :
<div class="language-yaml highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">apiextensions.k8s.io/v1</span>
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">CustomResourceDefinition</span>
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span class="nt">metadata</span><span class="p">:</span>
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-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">myresource.example.com</span>
</span></code></pre></div></p>
</blockquote>
</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>
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
<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>
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
<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>