Hi All,
In API *PUT /**apis/{api_id}* , response payload should be modified as
follows.
"gatewayEnvironments":[
"Production and Sandbox"
],
* "**k8sEnvironments**":[*
*“docker-desktop”*
* ],*
The value of the key will be changed to reflect the deployment environment.
Thanks.
On Fri, Feb 14, 2020 at 5:41 PM Shehani Rathnayake <[email protected]>
wrote:
> Hi All,
>
>
> WSO2 API Manager Private Jet Mode provides the ability to deploy an API in
> a dedicated Gateway node in Kubernetes. More information about the
> implementation of this feature can be found in the mail thread [1].
>
>
> Implementations are carried out in an extensive way so that it can be
> extended with any other container management systems. Also this extension
> can be used to publish API related artifacts to Github or any version
> control platform.
>
>
>
> In order to integrate this with APIM and to maintain the separation of
> handling gateway deployments information, we have come up with new rest API
> designs. The rest API designs and the requirements of implementing each are
> listed as follows.
>
>
> *1.* *GET* */deployments:*
>
> Requirement:
>
>
> In order to deploy an API in cloud cluster, GitHub etc. we need to get the
> cluster information from the tenant and those information will be added to
> the tenant-conf.json file as follows.
>
>
> This structure will be used to get information of all deployments.
>
>
> {
>
> "GatewayDeployments": {
>
> "Type": "Kubernetes",
>
> "ClassName": "org.wso2.carbon.apimgt.impl.containermgt.K8sManager",
>
> "ClusterInfo": [
>
> {
>
> “ClusterId”: “docker-desktop”,
>
> "DisplayName": "docker-desktop-cluster”,
>
> "Properties": {
>
> "MasterURL": "https://kubernetes.docker.internal:6443",
>
> "SAToken":
> "eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2Nvd...",
>
> "Namespace": "default",
>
> "Replicas": 1,
>
> "BasicSecurityCustomResourceName": "",
>
> "OauthSecurityCustomResourceName": "",
>
> "JWTSecurityCustomResourceName": ""
>
> }
>
> }
>
> ]
>
> }
>
>
> We need to retrieve those information form tenant-con.json file and
> populate information in UI under Environments tab as follows. Here we are
> going to populate cluster name, namespace, masterURL of each cluster as
> follows.
>
>
>
> This will be achieved with the API, */deployments*
>
>
> Response payload:
>
>
> The response payload will be as follows:
>
>
> {
>
> *"count"*:1,
>
> *"list"*:[
>
> {
>
> *"name"*:"Kubernetes",
>
> *"clusters"*:[
>
> {
>
> *"clusterId"*:"docker-desktop",
>
> *"displayName"*:"docker-desktop-cluster",
>
> *"masterURL"*:"https://kubernetes.docker.internal:6443",
>
> *"ingressURL"*:"api.com/foo",
>
> *"namespace"*:"default"
>
> }
>
> ]
>
> }
>
> ]
>
> }
>
>
>
> *2.* *GET /apis/{api_id}/deployments:*
>
>
> Requirement:
>
>
> After the deployment of an API to a selected cluster user may need to
> check the deployment status. In order to provide the deployment status
> details per API we have come up with the API
> */apis/{api_id}/deployments. *
>
>
> It will access the kubernetes cluster to get the deployment status details
> and will populate necessary information in UI under Environments tab. This
> details will be listed down under the corresponding cluster.
>
>
> Response payload:
>
>
> The response payload will be as follows:
>
>
> {
>
> *"count"*:1,
>
> *"list"*:[
>
> {
>
> *"type"*:"Kubernetes",
>
> *"clusters"*:[
>
> {
>
> *"d**isplayName**"*:"docker-desktop",
>
> *"deployed"*:"true",
>
> *"podsRunning"*:3,
>
> *"healthStatus"*:[
>
> {
>
> *"name"*:"pod1",
>
> *"ready"*:"true",
>
> *"status"*:"running",
>
> *"age"*:"1m"
>
> }
>
> ]
>
> }
>
> ]
>
> }
>
> ]
>
> }
>
>
>
> *3. PUT* /*apis/{api_id} *
>
>
> This is an existing API used to update the definition of an API. This will
> be extended with deployment details.
>
>
> Requirement:
>
>
> The other requirement is to keep the reference of selected clusters per
> API to identify the clusters to deploy a particular API and retrieve the
> deployment status of it. For that we have introduced the field “clusterId”
> in tenant-con.json file and it will be immutable and unique. This ID will
> be used to keep the references of clusters.
>
>
> To update the API with selected clusters, we have introduced a new field
> to the existing API model as follows.
>
>
> *"deployments": [**“docker-desktop”** ]*
>
>
> This field will save the Ids of selected clusters per API in the registry.
>
>
> This will be achieved with existing API, *apis/{api_id} : **put*
>
>
> Response payload:
>
>
> The updated payload will be as follows:
>
>
> {
>
> "id":"e9706e1d-85f8-470a-848c-4d5926055415",
>
> "name":"PizzaShackAPI",
>
> "description":"This is a simple API for Pizza Shack online pizza
> delivery store.",
>
> "context":"/pizzashack",
>
> "version":"1.0.0",
>
> "provider":"admin",
>
> "lifeCycleStatus":"PUBLISHED",
>
> "wsdlInfo":null,
>
> "wsdlUrl":null,
>
> "responseCachingEnabled":false,
>
> "cacheTimeout":300,
>
> "destinationStatsEnabled":null,
>
> "hasThumbnail":null,
>
> "isDefaultVersion":false,
>
> "enableSchemaValidation":false,
>
> "type":"HTTP",
>
> "transport":[
>
> "http",
>
> "https"
>
> ],
>
> "tags":[
>
> "pizza"
>
> ],
>
> "policies":[
>
> "Unlimited"
>
> ],
>
> "apiThrottlingPolicy":null,
>
> "authorizationHeader":"Authorization",
>
> "securityScheme":[
>
> "oauth2",
>
> "oauth_basic_auth_api_key_mandatory"
>
> ],
>
> "maxTps":null,
>
> "visibility":"PUBLIC",
>
> "visibleRoles":[
>
>
> ],
>
> "visibleTenants":[
>
>
> ],
>
> "endpointSecurity":null,
>
> "gatewayEnvironments":[
>
> "Production and Sandbox"
>
> ],
>
> * "deployments":[*
>
> *“docker-desktop”*
>
> * ],*
>
> "labels":[
>
>
> ],
>
> "mediationPolicies":[
>
>
> ],
>
> "subscriptionAvailability":"ALL_TENANTS",
>
> "subscriptionAvailableTenants":[
>
>
> ],
>
> "additionalProperties":{
>
>
> },
>
> "monetization":null,
>
> "accessControl":"NONE",
>
> "accessControlRoles":[
>
>
> ],
>
> "businessInformation":{
>
> "businessOwner":"Jane Roe",
>
> "businessOwnerEmail":"[email protected]",
>
> "technicalOwner":"John Doe",
>
> "technicalOwnerEmail":"[email protected]"
>
> },
>
> "corsConfiguration":{
>
> "corsConfigurationEnabled":false,
>
> "accessControlAllowOrigins":[
>
> "*"
>
> ],
>
> "accessControlAllowCredentials":false,
>
> "accessControlAllowHeaders":[
>
> "authorization",
>
> "Access-Control-Allow-Origin",
>
> "Content-Type",
>
> "SOAPAction"
>
> ],
>
> "accessControlAllowMethods":[
>
> "GET",
>
> "PUT",
>
> "POST",
>
> "DELETE",
>
> "PATCH",
>
> "OPTIONS"
>
> ]
>
> },
>
> "workflowStatus":null,
>
> "createdTime":"2020-02-13 18:36:31.976",
>
> "lastUpdatedTime":"2020-02-13 18:44:42.602",
>
> "endpointConfig":{
>
> "endpoint_type":"http",
>
> "sandbox_endpoints":{
>
> "url":"https://localhost:9443/am/sample/pizzashack/v1/api/"
>
> },
>
> "production_endpoints":{
>
> "url":"https://localhost:9443/am/sample/pizzashack/v1/api/"
>
> }
>
> },
>
> "endpointImplementationType":"ENDPOINT",
>
> "scopes":[
>
>
> ],
>
> "operations":[
>
> {
>
> "id":"",
>
> "target":"/order",
>
> "verb":"POST",
>
> "authType":"Application & Application User",
>
> "throttlingPolicy":"Unlimited",
>
> "scopes":[
>
>
> ],
>
> "usedProductIds":[
>
>
> ],
>
> "amznResourceName":null,
>
> "amznResourceTimeout":null
>
> },
>
> {
>
> "id":"",
>
> "target":"/order/{orderId}",
>
> "verb":"PUT",
>
> "authType":"Application & Application User",
>
> "throttlingPolicy":"Unlimited",
>
> "scopes":[
>
>
> ],
>
> "usedProductIds":[
>
>
> ],
>
> "amznResourceName":null,
>
> "amznResourceTimeout":null
>
> },
>
> {
>
> "id":"",
>
> "target":"/menu",
>
> "verb":"GET",
>
> "authType":"Application & Application User",
>
> "throttlingPolicy":"Unlimited",
>
> "scopes":[
>
>
> ],
>
> "usedProductIds":[
>
>
> ],
>
> "amznResourceName":null,
>
> "amznResourceTimeout":null
>
> },
>
> {
>
> "id":"",
>
> "target":"/order/{orderId}",
>
> "verb":"DELETE",
>
> "authType":"Application & Application User",
>
> "throttlingPolicy":"Unlimited",
>
> "scopes":[
>
>
> ],
>
> "usedProductIds":[
>
>
> ],
>
> "amznResourceName":null,
>
> "amznResourceTimeout":null
>
> },
>
> {
>
> "id":"",
>
> "target":"/order/{orderId}",
>
> "verb":"GET",
>
> "authType":"Application & Application User",
>
> "throttlingPolicy":"Unlimited",
>
> "scopes":[
>
>
> ],
>
> "usedProductIds":[
>
>
> ],
>
> "amznResourceName":null,
>
> "amznResourceTimeout":null
>
> }
>
> ],
>
> "threatProtectionPolicies":null,
>
> "categories":[
>
>
> ]
>
> }
>
>
> Really appreciate any feedback or suggestions in this regard.
>
>
> [1] Private Jet Mode for WSO2 API Manager with Kubernetes
>
>
>
> Thanks.
>
> --
> *Shehani Rathnayake* | Software Engineer | WSO2 Inc.
> <http://wso2.com/>
> (m) +94713490439 | (E) [email protected]
>
> <https://wso2.com/signature>
>
--
*Shehani Rathnayake* | Software Engineer | WSO2 Inc.
<http://wso2.com/>
(m) +94713490439 | (E) [email protected]
<https://wso2.com/signature>
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture