Skip to content

Commit

Permalink
Added json schema and ui meta data to cronjob
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlocph committed Aug 5, 2021
1 parent 9609cc2 commit eec4f30
Show file tree
Hide file tree
Showing 4 changed files with 389 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/cron-job/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.0
version: 0.2.1

dependencies:
- name: common
Expand Down
71 changes: 71 additions & 0 deletions charts/cron-job/helm-ui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[
{
"schemaIDs": [
"#/properties/image",
"#/properties/shell",
"#/properties/command"
],
"uiSchema": {
"#/properties/replicas": {
"ui:widget": "range"
}
},
"metaData": {
"name": "Basics",
"icon": "M17 8l4 4m0 0l-4 4m4-4H3"
}
},
{
"schemaIDs": [
"#/properties/resources"
],
"uiSchema": {
},
"metaData": {
"name": "Resources",
"icon": "M9 7h6m0 10v-3m-3 3h.01M9 17h.01M9 14h.01M12 14h.01M15 11h.01M12 11h.01M9 11h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z"
}
},
{
"schemaIDs": [
"#/properties/vars"
],
"uiSchema": {
"#/properties/vars": {
"additionalProperties": {
"type": "string"
}
}
},
"metaData": {
"name": "Environment Variables",
"icon": "M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
}
},
{
"schemaIDs": [
"#/properties/sealedSecrets"
],
"uiSchema": {
"#/properties/sealedSecrets": {
"additionalProperties": {
"type": "string"
}
}
},
"metaData": {
"name": "Sealed Secrets",
"icon": "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"
}
},
{
"schemaIDs": [
"#/properties/volumes"
],
"uiSchema": {},
"metaData": {
"name": "Volumes",
"icon": "M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"
}
}
]
316 changes: 316 additions & 0 deletions charts/cron-job/values.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,316 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "http://example.com/example.json",
"type": "object",
"title": "The root schema",
"description": "The root schema comprises the entire JSON document.",
"default": {},
"required": [],
"properties": {
"image": {
"$id": "#/properties/image",
"type": "object",
"title": "Image",
"description": "The image to deploy",
"default": {},
"examples": [
{
"repository": "nginx",
"tag": "latest"
}
],
"required": [
"repository",
"tag"
],
"properties": {
"repository": {
"$id": "#/properties/image/properties/repository",
"type": "string",
"title": "Repository",
"description": "",
"default": "nginx",
"examples": [
"nginx"
]
},
"tag": {
"$id": "#/properties/image/properties/tag",
"type": "string",
"title": "Tag",
"description": "",
"default": "1.19.3",
"examples": [
"latest"
]
}
}
},
"podAnnotations": {
"$id": "#/properties/podAnnotations",
"type": "object",
"title": "The podAnnotations schema",
"description": "An explanation about the purpose of this instance.",
"default": {},
"examples": [
{}
],
"required": [],
"additionalProperties": true
},
"resources": {
"$id": "#/properties/resources",
"type": "object",
"title": "",
"description": "",
"default": {},
"examples": [
{
"requests": {
"cpu": "200m",
"memory": "200mi"
},
"limits": {
"cpu": "200m",
"memory": "200mi"
}
}
],
"required": [],
"properties": {
"requests": {
"$id": "#/properties/resources/properties/requests",
"type": "object",
"title": "Requests",
"description": "The typical resources your app uses",
"default": {},
"examples": [
{
"cpu": "200m",
"memory": "200mi"
}
],
"required": [
"cpu",
"memory"
],
"properties": {
"cpu": {
"$id": "#/properties/resources/properties/requests/properties/cpu",
"type": "string",
"title": "CPU",
"description": "",
"default": "200m",
"examples": [
"200m"
]
},
"memory": {
"$id": "#/properties/resources/properties/requests/properties/memory",
"type": "string",
"title": "Memory",
"description": "",
"default": "200Mi",
"examples": [
"200mi"
]
}
}
},
"limits": {
"$id": "#/properties/resources/properties/limits",
"type": "object",
"title": "Limits",
"description": "The maximum resources your app may use",
"default": {},
"examples": [
{
"cpu": "200m",
"memory": "200mi"
}
],
"required": [
"cpu",
"memory"
],
"properties": {
"cpu": {
"$id": "#/properties/resources/properties/limits/properties/cpu",
"type": "string",
"title": "CPU",
"description": "The hard ceiling for the app's CPU usage. The app will be throttled to this limit. 1000m or 1000 CPU shares = 1 CPU core",
"default": "200m",
"examples": [
"200m"
]
},
"memory": {
"$id": "#/properties/resources/properties/limits/properties/memory",
"type": "string",
"title": "Memory",
"description": "The hard ceiling for the app's memory usage. The app will be RESTARTED if it reaches this limit",
"default": "200Mi",
"examples": [
"200mi"
]
}
}
}
}
},
"nodeSelector": {
"$id": "#/properties/nodeSelector",
"type": "object",
"title": "The nodeSelector schema",
"description": "An explanation about the purpose of this instance.",
"default": {},
"examples": [
{}
],
"required": [],
"additionalProperties": true
},
"tolerations": {
"$id": "#/properties/tolerations",
"type": "array",
"title": "The tolerations schema",
"description": "An explanation about the purpose of this instance.",
"default": [],
"examples": [
[]
],
"additionalItems": true,
"items": {
"$id": "#/properties/tolerations/items"
}
},
"affinity": {
"$id": "#/properties/affinity",
"type": "object",
"title": "The affinity schema",
"description": "An explanation about the purpose of this instance.",
"default": {},
"examples": [
{}
],
"required": [],
"additionalProperties": true
},
"secret": {
"$id": "#/properties/secret",
"type": "object",
"title": "The secret schema",
"description": "An explanation about the purpose of this instance.",
"default": {},
"examples": [
{
"enabled": false
}
],
"required": [
"enabled"
],
"properties": {
"enabled": {
"$id": "#/properties/secret/properties/enabled",
"type": "boolean",
"title": "The enabled schema",
"description": "An explanation about the purpose of this instance.",
"default": false,
"examples": [
false
]
}
},
"additionalProperties": true
},
"shell": {
"$id": "#/properties/shell",
"type": "string",
"title": "Shell",
"description": "The shell to use",
"default": "/bin/sh"
},
"command": {
"$id": "#/properties/command",
"type": "string",
"title": "Command",
"description": "The command to run in the cronjob",
"default": "echo \"I'm alive\""
},
"vars": {
"$id": "#/properties/vars",
"type": "object",
"title": "Environment variables",
"description": "",
"default": {},
"examples": [
{
"VAR_1": "value 1",
"VAR_2": "value 2"
}
],
"required": [],
"properties": {},
"additionalProperties": true
},
"sealedSecrets": {
"$id": "#/properties/sealedSecrets",
"type": "object",
"title": "Sealed Secrets",
"description": "",
"default": {},
"examples": [
{
"VAR_1": "value 1",
"VAR_2": "value 2"
}
],
"required": [],
"properties": {},
"additionalProperties": true
},
"volumes": {
"$id": "#/properties/volumes",
"type": "array",
"title": "Volumes",
"default": [],
"additionalItems": true,
"items": {
"$id": "#/properties/volumes/items",
"type": "object",
"properties": {
"name": {
"$id": "#/properties/volumes/items/anyOf/0/properties/name",
"type": "string",
"title": "Name",
"description": "The name of the volume. Used only to recognize the volumes purpose in the config later on",
"default": "data"
},
"path": {
"$id": "#/properties/volumes/items/anyOf/0/properties/path",
"type": "string",
"title": "Path",
"description": "The mount path inside the container",
"default": "/data"
},
"size": {
"$id": "#/properties/volumes/items/anyOf/0/properties/size",
"type": "string",
"title": "Size",
"description": "",
"default": "10Gi"
},
"storageClass": {
"$id": "#/properties/volumes/items/anyOf/0/properties/storageClass",
"type": "string",
"title": "Storage Class",
"description": "The slug indicating the disk type in your cloud provider. `standard` on Google Cloud, `default` on Azure; `do-block-storage` on Digital Ocean",
"default": ""
}
}
}
}
},
"additionalProperties": true
}
Loading

0 comments on commit eec4f30

Please sign in to comment.