{
  "$schema": "http://json-schema.org/schema#",
  "type": "object",
  "properties": {
    "s3": {
      "description": "Configuration of temporary identity",
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Add S3 temporary identity inside your environment",
          "default": true
        },
        "accessKeyId": {
          "description": "AWS Access Key",
          "type": "string",
          "x-onyxia": {
            "overwriteDefaultWith": "{{s3.AWS_ACCESS_KEY_ID}}"
          },
          "hidden": {
            "value": false,
            "path": "s3/enabled"
          }
        },
        "endpoint": {
          "description": "AWS S3 Endpoint",
          "type": "string",
          "x-onyxia": {
            "overwriteDefaultWith": "{{s3.AWS_S3_ENDPOINT}}"
          },
          "hidden": {
            "value": false,
            "path": "s3/enabled"
          }
        },
        "defaultRegion": {
          "description": "AWS S3 default region",
          "type": "string",
          "x-onyxia": {
            "overwriteDefaultWith": "{{s3.AWS_DEFAULT_REGION}}"
          },
          "hidden": {
            "value": false,
            "path": "s3/enabled"
          }
        },
        "secretAccessKey": {
          "description": "AWS S3 secret access key",
          "type": "string",
          "render": "password",
          "x-onyxia": {
            "overwriteDefaultWith": "{{s3.AWS_SECRET_ACCESS_KEY}}"
          },
          "hidden": {
            "value": false,
            "path": "s3/enabled"
          }
        },
        "sessionToken": {
          "description": "AWS S3 session Token",
          "type": "string",
          "render": "password",
          "x-onyxia": {
            "overwriteDefaultWith": "{{s3.AWS_SESSION_TOKEN}}"
          },
          "hidden": {
            "value": false,
            "path": "s3/enabled"
          }
        }
      }
    },
    "ingress": {
      "type": "object",
      "form": true,
      "title": "Ingress Details",
      "properties": {
        "enabled": {
          "description": "Enable Ingress",
          "type": "boolean",
          "default": true,
          "x-onyxia": {
            "hidden": true,
            "overwriteDefaultWith": "k8s.ingress"
          }
        },
        "hostname": {
          "type": "string",
          "form": true,
          "title": "Hostname",
          "x-onyxia": {
            "hidden": false,
            "overwriteDefaultWith": "{{project.id}}-limesurvey.{{k8s.domain}}"
          }
        },
        "ingressClassName": {
          "type": "string",
          "form": true,
          "title": "ingressClassName",
          "default": "",
          "x-onyxia": {
            "hidden": true,
            "overwriteDefaultWith": "{{k8s.ingressClassName}}"
          }
        }
      }
    },
    "route": {
      "type": "object",
      "form": true,
      "title": "Route details",
      "properties": {
        "enabled": {
          "description": "Enable route",
          "type": "boolean",
          "default": false,
          "x-onyxia": {
            "hidden": false,
            "overwriteDefaultWith": "k8s.route"
          }
        },
        "hostname": {
          "type": "string",
          "form": true,
          "title": "Hostname",
          "x-onyxia": {
            "hidden": false,
            "overwriteDefaultWith": "{{project.id}}-limesurvey.{{k8s.domain}}"
          }
        }
      }
    },
    "security": {
      "description": "security specific configuration",
      "type": "object",
      "properties": {
        "password": {
          "type": "string",
          "description": "Password",
          "default": "changeme",
          "render": "password",
          "x-onyxia": {
            "overwriteDefaultWith": "{{project.password}}"
          }
        },
        "allowlist": {
          "type": "object",
          "description": "IP protection",
          "properties": {
            "enabled": {
              "type": "boolean",
              "title": "Enable IP protection",
              "description": "Only the configured set of IPs will be able to reach the service",
              "default": true,
              "x-onyxia": {
                "overwriteDefaultWith": "region.defaultIpProtection"
              }
            },
            "ip": {
              "type": "string",
              "description": "the white list of IP is whitespace",
              "title": "Whitelist of IP",
              "default": "0.0.0.0",
              "x-onyxia": {
                "overwriteDefaultWith": "{{user.ip}}"
              },
              "hidden": {
                "value": false,
                "path": "security/allowlist/enabled"
              }
            }
          }
        },
        "networkPolicy": {
          "type": "object",
          "description": "Define access policy to the service",
          "properties": {
            "enabled": {
              "type": "boolean",
              "title": "Enable network policy",
              "description": "Only pod from the same namespace will be allowed",
              "default": true,
              "x-onyxia": {
                "overwriteDefaultWith": "region.defaultNetworkPolicy"
              }
            },
            "from": {
              "type": "array",
              "description": "Array of source allowed to have network access to your service",
              "default": [
                {
                  "namespaceSelector": {
                    "matchLabels": {
                      "kubernetes.io/metadata.name": "ingress"
                    }
                  }
                }
              ],
              "x-onyxia": {
                "overwriteDefaultWith": "region.from"
              }
            }
          }
        }
      }
    },
    "resources": {
      "description": "Your service will have at least the requested resources and never more than its limits. No limit for a resource and you can consume everything left on the host machine.",
      "type": "object",
      "properties": {
        "requests": {
          "description": "Guaranteed resources",
          "type": "object",
          "properties": {
            "cpu": {
              "description": "The amount of cpu guaranteed",
              "title": "CPU",
              "type": "string",
              "default": "100m",
              "render": "slider",
              "sliderMin": 50,
              "sliderMax": 40000,
              "sliderStep": 50,
              "sliderUnit": "m",
              "sliderExtremity": "down",
              "sliderExtremitySemantic": "guaranteed",
              "sliderRangeId": "cpu"
            },
            "memory": {
              "description": "The amount of memory guaranteed",
              "title": "memory",
              "type": "string",
              "default": "2Gi",
              "render": "slider",
              "sliderMin": 1,
              "sliderMax": 200,
              "sliderStep": 1,
              "sliderUnit": "Gi",
              "sliderExtremity": "down",
              "sliderExtremitySemantic": "guaranteed",
              "sliderRangeId": "memory"
            }
          }
        },
        "limits": {
          "description": "max resources",
          "type": "object",
          "properties": {
            "cpu": {
              "description": "The maximum amount of cpu",
              "title": "CPU",
              "type": "string",
              "default": "30000m",
              "render": "slider",
              "sliderMin": 50,
              "sliderMax": 40000,
              "sliderStep": 50,
              "sliderUnit": "m",
              "sliderExtremity": "up",
              "sliderExtremitySemantic": "Maximum",
              "sliderRangeId": "cpu"
            },
            "memory": {
              "description": "The maximum amount of memory",
              "title": "Memory",
              "type": "string",
              "default": "50Gi",
              "render": "slider",
              "sliderMin": 1,
              "sliderMax": 200,
              "sliderStep": 1,
              "sliderUnit": "Gi",
              "sliderExtremity": "up",
              "sliderExtremitySemantic": "Maximum",
              "sliderRangeId": "memory"
            }
          }
        }
      }
    }
  }
}
