Skip to content

Commit

Permalink
fix: more jsonschema (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Bouquillon authored Sep 1, 2023
1 parent bd07add commit c04b3cd
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 42 deletions.
52 changes: 37 additions & 15 deletions docs/values.schema.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/docs/values.schema.json",
"title": "schema for .kontinuous/values.yaml",
"type": "object",
"additionalProperties": {
"type": "object",
"description": "Kontinuous component",
"title": "Additional helm chart",
"allOf": [
{
"if": {
"required": ["~chart"]
},
"then": {
"description": "Common to all charts",
"$ref": "#/definitions/chart"
}
},
{
"if": {
"required": ["~chart"],
Expand Down Expand Up @@ -54,6 +45,27 @@
"then": {
"$ref": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/charts/jobs/kontinuous.values.schema.json#"
}
},
{
"if": {
"required": ["~chart"],
"properties": {
"~chart": {
"const": "oauth2-proxy"
}
}
},
"then": {
"$ref": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/charts/oauth2-proxy/values.schema.json#"
}
},
{
"if": {
"required": ["~chart"]
},
"then": {
"$ref": "#/definitions/chart"
}
}
]
},
Expand Down Expand Up @@ -156,17 +168,27 @@
"type": "object",
"properties": {
"~chart": {
"description": "Kontinuous Chart for this component. see https://github.com/SocialGouv/kontinuous/tree/master/plugins/contrib/charts",
"description": "Kontinuous chart to use",
"type": "string",
"examples": ["app", "maildev", "hasura", "metabase"]
"default": "app",
"examples": [
"app",
"pg",
"hasura",
"metabase",
"pgweb",
"maildev",
"oauth2-proxy",
"redis"
]
},
"~needs": {
"description": "Job or deployment dependencies",
"markdownDescription": "Job or deployment dependencies.\n\nThe meta-value `~needs`is used to define dependencies tree between charts and jobs.\n\nYou can target using simple charts or jobs name, or be more specific to avoid collision in more complex cases.\n\nsee [~needs documentation](https://socialgouv.github.io/kontinuous/#https://raw.githubusercontent.com/socialgouv/kontinuous/v1/advanced/build?id=meta-values-plugin-needs)",
"type": "array",
"items": {
"type": "string"
},
"examples": ["[build-app]"]
"examples": ["[build-app]", "[pg, jobs.build-app]"]
}
},
"required": ["~chart"]
Expand Down
7 changes: 3 additions & 4 deletions plugins/contrib/charts/app/kontinuous.values.schema.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/charts/app/kontinuous.values.schema.json",
"title": "schema for helm chart app",
"title": "Kontinuous app helm chart",
"markdownDescription": "The [app chart](https://github.com/SocialGouv/kontinuous/blob/master/plugins/contrib/charts/app) provides all the resources to deploy a kubernetes application\n\n💡 You can use the [meta `~tpl~` prefix](https://socialgouv.github.io/kontinuous/#/./advanced/build?id=meta-values-plugin-tpl) to make any property a [go template](https://docs.gofiber.io/template/html/TEMPLATES_CHEATSHEET/#template-variables)",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^\\.": { "type": ["string", "number", "boolean"] }
},
"properties": {
"~chart": {
"description": "Base Helm Chart for this component",
"type": "string",
"examples": ["app", "hasura", "maildev"]
"type": "string"
},
"~forceRestart": {
"description": "Force restart on every deployment. default true",
Expand Down
27 changes: 10 additions & 17 deletions plugins/contrib/charts/jobs/kontinuous.values.schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/charts/jobs/kontinuous.values.schema.json",
"title": "schema for helm chart jobs",
"title": "Kontinuous jobs helm chart",
"markdownDescription": "The [jobs chart](https://github.com/SocialGouv/kontinuous/blob/master/plugins/contrib/charts/jobs) provides a way to define de define tasks in your deployment pipeline\n\n💡 See [the jobs documentations](https://socialgouv.github.io/kontinuous/#/./advanced/build?id=meta-values-plugin-needs).",
"type": "object",
"additionalProperties": false,
"required": ["runs"],
Expand Down Expand Up @@ -75,10 +76,9 @@
}
},
"then": {
"description": "Build and register docker image with buildkit",
"properties": {
"use": {
"description": "Build and register docker image with buildkit"
"markdownDescription": "Build and register docker image with buildkit.\n\nSee [build source](https://github.com/SocialGouv/kontinuous/tree/master/plugins/contrib/jobs/build)"
},
"with": {
"$ref": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/jobs/build/use.schema.json#"
Expand All @@ -95,10 +95,9 @@
}
},
"then": {
"description": "Build and register docker image with kaniko",
"properties": {
"use": {
"description": "Build and register docker image with kaniko"
"markdownDescription": "Build and register docker image with kaniko.\n\nSee [build-kaniko source](https://github.com/SocialGouv/kontinuous/tree/master/plugins/contrib/jobs/build-kaniko)"
},
"with": {
"$ref": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/jobs/build-kaniko/use.schema.json#"
Expand All @@ -115,10 +114,9 @@
}
},
"then": {
"description": "Create a Postgres Database",
"properties": {
"use": {
"description": "Create a Postgres Database"
"markdownDescription": "Create a Postgres Database\n\nSee [create-db source](https://github.com/SocialGouv/kontinuous/tree/master/plugins/contrib/jobs/create-db)"
},
"with": {
"$ref": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/jobs/create-db/use.schema.json#"
Expand All @@ -135,10 +133,9 @@
}
},
"then": {
"description": "Destroy namespace and databases",
"properties": {
"use": {
"description": "Destroy namespace and databases"
"markdownDescription": "Destroy namespace and databases\n\nSee [deactivate source](https://github.com/SocialGouv/kontinuous/tree/master/plugins/contrib/jobs/deactivate)"
},
"with": {
"$ref": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/jobs/deactivate/use.schema.json#"
Expand All @@ -155,10 +152,9 @@
}
},
"then": {
"description": "Destroy the database",
"properties": {
"use": {
"description": "Destroy the database"
"markdownDescription": "Destroy the database\n\nSee [drop-db source](https://github.com/SocialGouv/kontinuous/tree/master/plugins/contrib/jobs/drop-db)"
},
"with": {
"$ref": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/jobs/drop-db/use.schema.json#"
Expand All @@ -175,10 +171,9 @@
}
},
"then": {
"description": "Restore the database from a backup storage",
"properties": {
"use": {
"description": "Restore the database from a backup storage"
"markdownDescription": "Restore the database from a backup storage\n\nSee [pg-restore source](https://github.com/SocialGouv/kontinuous/tree/master/plugins/contrib/jobs/pg-restore)"
},
"with": {
"$ref": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/jobs/pg-restore/use.schema.json#"
Expand All @@ -195,10 +190,9 @@
}
},
"then": {
"description": "Execute psql commands on the database",
"properties": {
"use": {
"description": "Execute psql commands on the database"
"markdownDescription": "Execute psql commands on the database\n\nSee [psql source](https://github.com/SocialGouv/kontinuous/tree/master/plugins/contrib/jobs/psql)"
},
"with": {
"$ref": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/jobs/psql/use.schema.json#"
Expand All @@ -215,10 +209,9 @@
}
},
"then": {
"description": "Execute a repository .sql on the database",
"properties": {
"use": {
"description": "Execute a repository .sql on the database"
"markdownDescription": "Execute a repository .sql on the database\n\nSee [seed-db source](https://github.com/SocialGouv/kontinuous/tree/master/plugins/contrib/jobs/seed-db)"
},
"with": {
"$ref": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/contrib/jobs/seed-db/use.schema.json#"
Expand Down
47 changes: 47 additions & 0 deletions plugins/contrib/charts/oauth2-proxy/values.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"type": "object",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Kontinuous oauth2-proxy helm chart",
"markdownDescription": "The [oauth2-proxy chart](https://github.com/SocialGouv/kontinuous/blob/master/plugins/contrib/charts/oauth2-proxy) provide a configured proxy to protect your application using the awesome [oauth2-proxy](https://oauth2-proxy.github.io/)\n\n💡 You can use the [meta `~tpl~` prefix](https://socialgouv.github.io/kontinuous/#/./advanced/build?id=meta-values-plugin-tpl) to make any property a [go template](https://docs.gofiber.io/template/html/TEMPLATES_CHEATSHEET/#template-variables)",
"required": ["upstream"],
"properties": {
"namespace": {
"type": ["string", "null"],
"title": "resources namespace"
},
"host": {
"type": ["string", "null"],
"title": "ingress host"
},
"env": {
"$ref": "https://raw.githubusercontent.com/ad-m/kubernetes-json-schema/master/master-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.Container/properties/env"
},
"envFrom": {
"$ref": "https://raw.githubusercontent.com/ad-m/kubernetes-json-schema/master/master-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.Container/properties/envFrom"
},
"ingress": {
"type": "object",
"title": "The great NGINX ingress controller : https://kubernetes.github.io/ingress-nginx/user-guide",
"required": [],
"properties": {
"enabled": {
"type": ["boolean"],
"title": "enable ingress",
"default": "true"
},
"annotations": {
"title": "ingress annotations see https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations",
"$ref": "https://raw.githubusercontent.com/SocialGouv/json-schemas/main/nginx/annotations.schema.json"
}
}
},
"upstream": {
"type": ["string"],
"title": "Upstream service to protect, example: http://my-app"
},
"additionalArgs": {
"type": ["array"],
"title": "Additionnal oauth2-proxy arguments, see https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/overview#command-line-options"
}
}
}
20 changes: 15 additions & 5 deletions plugins/contrib/charts/oauth2-proxy/values.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
enabled:
# yaml-language-server: $schema=./values.schema.json

# @param {string,null} [namespace] resources namespace
namespace:
# @param {string,null} [host] ingress host
host:
rancherProjectId: my-cluser-id:my-project-id
isProd: false
isPreProd: false
# @param {https://raw.githubusercontent.com/ad-m/kubernetes-json-schema/master/master-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.Container/properties/env} [env]
env: []
# @param {https://raw.githubusercontent.com/ad-m/kubernetes-json-schema/master/master-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.Container/properties/envFrom} [envFrom]
envFrom: []

# @param {object,null} [ingress] The greet NGINX ingress consoller : https://kubernetes.github.io/ingress-nginx/user-guide
ingress:
# @param {boolean} [enabled] enable ingress
enabled: true
# @param {https://raw.githubusercontent.com/SocialGouv/json-schemas/main/nginx/annotations.schema.json} [annotations] ingress annotations see https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations
annotations: {}
upstream:

# @param {string} upstream Upstream service to protect, example: http://my-app
upstream:

# @param {array} [additionalArgs] Additionnal oauth2-proxy arguments, see https://oauth2-proxy.github.io/oauth2-proxy/docs/configuration/overview#command-line-options
additionalArgs: []
5 changes: 4 additions & 1 deletion plugins/fabrique/charts/pg/kontinuous.values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
"type": "object",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/socialgouv/kontinuous/v1/plugins/fabrique/charts/pg/kontinuous.values.schema.json",
"title": "schema for helm chart pg",
"title": "Kontinuous pg helm chart",
"markdownDescription": "The [pg chart](https://github.com/SocialGouv/kontinuous/blob/master/plugins/fabrique/charts/pg) is a wrapper around [cnpg-cluster helm chart](https://github.com/SocialGouv/kontinuous/blob/master/plugins/fabrique/charts/pg)",
"required": [],
"properties": {
"cnpg-cluster": {
"title": "Kontinuous cnpg-cluster helm-chart",
"markdownDescription": "The [cnpg-cluster helm chart](https://github.com/SocialGouv/helm-charts/tree/main/charts/cnpg-cluster) based on [https://cloudnative-pg.io](https://https://cloudnative-pg.io)\n\n💡 You can use the [meta `~tpl~` prefix](https://socialgouv.github.io/kontinuous/#/./advanced/build?id=meta-values-plugin-tpl) to make it a template",
"$ref": "https://raw.githubusercontent.com/socialgouv/helm-charts/v1/charts/cnpg-cluster/values.schema.json"
},
"backup": {
Expand Down

0 comments on commit c04b3cd

Please sign in to comment.