Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions intent_types/redis/v1alpha1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Redis Intent Type

## Overview

This intent type is designed to represent a Redis database configuration within an Infrastructure Catalog. It encapsulates the necessary information for provisioning and managing a Redis database instance.

## Fields

- `metadata`: Contains auxiliary information such as the maintainer, documentation link, labels, name, and description.
- `kind`: Specifies the kind of the resource, in this case, `redis`.
- `spec`: Contains detailed information about the Redis instance including the Redis version.
- `disabled`: Indicates if the resource is disabled (`true`) or enabled (`false`) by default.
- `flavor`: Specifies the default implementation details, including the version and name.

## Specification

In the `spec` object:
- `version`: Specifies the Redis version (e.g., `7.2.2`, `6.2.14`).
- `server_mode`: A field to specify if want to Redis in standalone or cluster mode
- `persistence`: Optional configuration for enabling redis persistence, here you can specify persistence options like RBD, AOF
- `replication`: Optional configuration for enabling redis master slave replication, you can specify replicas required
- `cache`: Optional Configuring Redis as a cache - setting maxmemory and maxmemory-policy
- `auth`: TBD - support for acl

## Example

See the `sample.json` file for an example instance of this intent type.
5 changes: 5 additions & 0 deletions intent_types/redis/v1alpha1/intent_type.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Redis Database",
"api_version": "v1alpha1",
"description": "An Intent Type for deploying and managing Redis Memory Storage, following Kubernetes style version naming."
}
46 changes: 46 additions & 0 deletions intent_types/redis/v1alpha1/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"api_version": "v1alpha1",
"metadata": {
"maintainer": "[email protected]",
"documentation_link": "https://example.com/documentation",
"labels": {
"owner": "[email protected]"
},
"name": "my-redis-instance",
"description": "A Redis database instance."
},
"kind": "redis",
"spec": {
"version": "7.2.2",
"server_mode" : "standalone",
"persistence": {
"rdb": {
"enable": true,
"snapshotTimeInSec": 300,
"noOfchanges": 10
},
"aof" : {
"enable" : false
}
},
"replication": {
"enabled": true,
"replica_count": 2
},
"cache" : {
"enable" : true,
"maxmemory" : "10mb",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move these to configuration

"maxmemory-policy" : "allkeys-lru"
},
"size" : {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where to add the disk config to be decided

"cpu" : "200m",
"memory" : "10G"
}
},
"disabled": false,
"flavor": {
"version": "1.0",
"name": "standard"
},
"advanced": {}
}
245 changes: 245 additions & 0 deletions intent_types/redis/v1alpha1/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"required": [
"api_version",
"metadata",
"kind",
"spec",
"flavor"
],
"properties": {
"api_version": {
"type": "string",
"enum": [
"v1alpha1"
],
"description": "Specifies the version of the schema."
},
"metadata": {
"type": "object",
"required": [
"name"
],
"properties": {
"maintainer": {
"type": "string"
},
"documentation_link": {
"type": "string"
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"name": {
"type": "string"
},
"description": {
"type": "string"
}
}
},
"kind": {
"type": "string"
},
"spec": {
"type": "object",
"required": [
"version",
"server_mode",
"size"
],
"properties": {
"version": {
"type": "string"
},
"server_mode": {
"type": "string",
"enum": [
"standalone",
"replication"
],
"description": "The server mode to run redis in"
},
"persistence": {
"type": "object",
"properties": {
"rdb": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"snapshotTimeInSec": {
"type": "integer"
},
"noOfchanges": {
"type": "integer"
}
},
"if": {
"properties": {
"enabled": {
"const": true
}
}
},
"then": {
"required": [
"snapshotTimeInSec",
"noOfchanges"
]
}
},
"aof": {
"type": "object",
"properties": {
"enable": {
"type": "boolean"
}
},
"required": [
"enable"
]
}
},
"description": "Optional persistence config. Either specify `rdb` config or `aos` config"
},
"replication": {
"type": "object",
"description": "Configure the replication count (optional)",
"properties": {
"enabled": {
"type": "boolean"
},
"replica_count": {
"type": "integer"
}
},
"required": [
"enabled"
],
"if": {
"properties": {
"enabled": {
"const": true
}
}
},
"then": {
"required": [
"replica_count"
]
}
},
"cache": {
"type": "object",
"properties": {
"enable": {
"type": "boolean"
},
"maxmemory": {
"type": "string"
},
"maxmemory-policy": {
"type": "string",
"enum": [
"noeviction",
"allkeys-lru",
"allkeys-lfu",
"volatile-lru",
"volatile-lfu",
"allkeys-random",
"volatile-random",
"volatile-ttl"
]
}
},
"required": [
"enable"
],
"if": {
"properties": {
"enable": {
"const": true
}
}
},
"then": {
"required": [
"maxmemory",
"maxmemory-policy"
]
}
},
"auth": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"username": {
"type": "string"
},
"password": {
"type": "string"
}
},
"if": {
"properties": {
"enabled": {
"const": true
}
}
},
"then": {
"required": [
"username",
"password"
]
}
},
"size": {
"type": "object",
"properties": {
"cpu": {
"type": "string"
},
"memory": {
"type": "string"
}
},
"required": [
"cpu",
"memory"
]
}
}
},
"disabled": {
"type": "boolean",
"default": false
},
"flavor": {
"type": "object",
"required": [
"version",
"name"
],
"properties": {
"version": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"advanced": {
"type": "object"
}
}
}