Skip to content

Commit

Permalink
feat(managedservice): add support for rapyuta.io managedservices
Browse files Browse the repository at this point in the history
This commit introduces support for rapyuta.io managed services.

Usage: rio managedservice [OPTIONS] COMMAND [ARGS]...

  Managed Services on rapyuta.io

  With managed services on rapyuta.io, you can provision services like
  elasticsearch, etc. on-demand and use them with your deployments.

Options:
  --help  Show this message and exit.

Commands:
  inspect    Inspect a managedservice instance
  list       List all the managedservice instances
  providers  List available managedservice providers

You can create and delete managed services with the rio apply command
and it currently doesn't have a directly CLI option.

Reviewed By: Ankit Gadiya
  • Loading branch information
pallabpain committed Dec 6, 2022
1 parent a6b1d71 commit 7aff123
Show file tree
Hide file tree
Showing 21 changed files with 774 additions and 103 deletions.
22 changes: 22 additions & 0 deletions jsonschema/deployment-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ definitions:
nameOrGUID:
type: string

managedServiceSpec:
type: object
properties:
depends:
"$ref": "#/definitions/managedServiceDepends"

componentSpec:
properties:
runtime:
Expand Down Expand Up @@ -176,6 +182,11 @@ definitions:
items:
"$ref": "#/definitions/cloudNetworkAttachSpec"

managedServices:
type: array
items:
"$ref": "#/definitions/managedServiceSpec"

stringMap:
type: object
additionalProperties:
Expand Down Expand Up @@ -273,3 +284,14 @@ definitions:
type: string
guid:
type: string
managedServiceDepends:
properties:
kind:
const: managedservice
default: managedservice
nameOrGUID:
type: string
guid:
type: string


60 changes: 60 additions & 0 deletions jsonschema/managedservice-schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
$schema: "http://json-schema.org/draft-07/schema#"
title: ManagedService
$ref: "#/definitions/managedservice"
definitions:
managedservice:
type: object
properties:
apiVersion:
const: apiextensions.rapyuta.io/v1
default: apiextensions.rapyuta.io/v1
kind:
const: ManagedService
default: ManagedService
metadata:
"$ref": "#/definitions/metadata"
spec:
"$ref": "#/definitions/managedserviceSpec"
required:
- apiVersion
- kind
- metadata
- spec
metadata:
type: object
properties:
name:
type: string
guid:
"$ref": "#/definitions/uuid"
creator:
"$ref": "#/definitions/uuid"
project:
"$ref": "#/definitions/projectGUID"
labels:
"$ref": "#/definitions/stringMap"
required:
- name
projectGUID:
type: string
pattern: "^project-[a-z]{24}$"
stringMap:
type: object
additionalProperties:
type: string
uuid:
type: string
pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
managedserviceSpec:
type: object
properties:
provider:
type: string
enum:
- elasticsearch
config:
type: object
required:
- provider
- config
14 changes: 8 additions & 6 deletions riocli/apply/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from riocli.apply.util import process_files_values_secrets
from riocli.apply.explain import explain


@click.command(
'apply',
cls=HelpColorsCommand,
Expand All @@ -35,20 +36,20 @@ def apply(values: str, secrets: str, files: Iterable[str], dryrun: bool = False,
"""
Apply resource manifests
"""
glob_files, abs_values, abs_secrets = process_files_values_secrets(files, values, secrets)
glob_files, abs_values, abs_secrets = process_files_values_secrets(
files, values, secrets)

if len(glob_files) == 0:
click.secho('no files specified', fg='red')
raise SystemExit(1)

click.secho("----- Files Processed ----", fg="yellow")
for file in glob_files:
click.secho(file, fg="yellow")



rc = Applier(glob_files, abs_values, abs_secrets)
rc.parse_dependencies()

rc.apply(dryrun=dryrun, workers=workers)


Expand All @@ -66,7 +67,8 @@ def delete(values: str, secrets: str, files: Iterable[str], dryrun: bool = False
"""
Apply resource manifests
"""
glob_files, abs_values, abs_secrets = process_files_values_secrets(files, values, secrets)
glob_files, abs_values, abs_secrets = process_files_values_secrets(
files, values, secrets)

if len(glob_files) == 0:
click.secho('no files specified', fg='red')
Expand Down
4 changes: 4 additions & 0 deletions riocli/apply/manifests/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ spec:
- depends:
kind: network
nameOrGUID: "routed"
managedServices:
- depends:
kind: managedservice
nameOrGUID: "test-service"
9 changes: 9 additions & 0 deletions riocli/apply/manifests/managedservice.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: "apiextensions.rapyuta.io/v1"
kind: ManagedService
metadata:
name: "elastic-test"
labels:
creator: riocli
spec:
provider: elasticsearch
config: {}
Loading

0 comments on commit 7aff123

Please sign in to comment.