pod-porter Values

Just like in HELM the variable values are stored in a values.yaml. A values.yaml file is required, but it can be empty. There is no specific structure to it at this time. The file MUST be named values.yaml and MUST be located in the root of the of the map for the ‘default’ values. If you are rendering a map the file can be called anything and located anywhere.

  • The is a basic form of the values.yaml file.

Example values.yaml
---

image:
  mongo:
    repository: "docker.io/library/mongo"
    tag: "8.0.3"
  mongo_express:
    repository: "docker.io/library/mongo-express"
    tag: "1.0.2"

service:
  mongo:
    node_port: 27017
    container_port: 27017
  mongo_express:
    node_port: 8181
    container_port: 8081

volumes:
  mongo:
    - name: "mongo-data-db-compose"
      value: "/data/db"
    - name: "mongo-data-configdb-compose"
      value: "/data/configdb"

environment:
  mongo:
    - name: "MONGO_INITDB_ROOT_USERNAME"
      value: "root"
    - name: "MONGO_INITDB_ROOT_PASSWORD"
      value: "example"
  mongo_express:
    - name: "ME_CONFIG_MONGODB_ADMINUSERNAME"
      value: "root"
    - name: "ME_CONFIG_MONGODB_ADMINPASSWORD"
      value: "example"
  • The is a more complex form of the values.yaml file, that includes values for a sub map.

Example values.yaml with Sub Map values
---
sub_map_values:
  batfish:
    image:
      batfish:
        repository: "docker.io/batfish/allinone"
        tag: "other"
    service:
      batfish:
        - node_port: 9000
          container_port: 8888
        - node_port: 9001
          container_port: 9997
        - node_port: 9002
          container_port: 9996

image:
  mongo:
    repository: "docker.io/library/mongo"
    tag: "8.0.3"
  mongo_express:
    repository: "docker.io/library/mongo-express"
    tag: "1.0.2"

service:
  mongo:
    node_port: 27017
    container_port: 27017
  mongo_express:
    node_port: 8181
    container_port: 8081

volumes:
  mongo:
    - name: "mongo-data-db-compose"
      value: "/data/db"
    - name: "mongo-data-configdb-compose"
      value: "/data/configdb"

environment:
  mongo:
    - name: "MONGO_INITDB_ROOT_USERNAME"
      value: "root"
    - name: "MONGO_INITDB_ROOT_PASSWORD"
      value: "example"
  mongo_express:
    - name: "ME_CONFIG_MONGODB_ADMINUSERNAME"
      value: "root"
    - name: "ME_CONFIG_MONGODB_ADMINPASSWORD"
      value: "example"

pod-porter Values Schema Validation

Just like in HELM the values.yaml can use JSON schema validation. Just create a file called values-schema.json in the root of the map where the values.yaml file is located. The schema will be used to validate the values.yaml file. You can reference how to create a JSON schema here JSON Schema Docs.

Example values.yaml with schema validation
---
image:
  mongo:
    repository: "docker.io/library/mongo"
    tag: "8.0.3"
  mongo_express:
    repository: "docker.io/library/mongo-express"
    tag: "1.0.2"

service:
  mongo:
  - node_port: 27017
    container_port: 27017
    name: "mongo-db"
  mongo_express:
  - node_port: 8181
    container_port: 8081
    name: "mongo-express"


environment_variables:
  mongo_db_root_username: "root"
  mongo_db_root_password: "example"
  mongo_express_admin_username: "root"
  mongo_express_admin_password: "example"

# Enable or disable mongo-express service
options:
  mongo_express_enable: false
Example values-schema.json for schema validation
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Values",
    "description": "Values schema for mongo porter",
    "type": "object",
    "properties": {
        "image": {
            "type": "object",
            "description": "image configuration",
            "properties": {
                "mongo": {
                    "type": "object",
                    "description": "mongo image",
                    "$ref": "#/$defs/image"
                },
                "mongo_express": {
                    "type": "object",
                    "description": "mongo express image",
                    "$ref": "#/$defs/image"
                }
            },
            "required": [
                "mongo",
                "mongo_express"
            ]
        },
        "service": {
            "type": "object",
            "description": "Services configuration",
            "properties": {
                "mongo": {
                    "type": "array",
                    "description": "mongo service",
                    "minItems": 1,
                    "maxItems": 1,
                    "items": {
                        "$ref": "#/$defs/service"
                    }
                },
                "mongo_express": {
                    "type": "array",
                    "description": "mongo express service",
                    "minItems": 1,
                    "maxItems": 1,
                    "items": {
                        "$ref": "#/$defs/service"
                    }
                }
            }
        },
        "environment_variables": {
            "type": "object",
            "description": "Environment variables",
            "properties": {
                "mongo_db_root_username": {
                    "$ref": "#/$defs/string_no_spaces",
                    "description": "MongoDB root username"
                },
                "mongo_db_root_password": {
                    "$ref": "#/$defs/string_no_spaces",
                    "description": "MongoDB root password"
                },
                "mongo_express_admin_username": {
                    "$ref": "#/$defs/string_no_spaces",
                    "description": "Mongo Express admin username"
                },
                "mongo_express_admin_password": {
                    "$ref": "#/$defs/string_no_spaces",
                    "description": "Mongo Express admin password"
                }
            },
            "required": [
                "mongo_db_root_username",
                "mongo_db_root_password",
                "mongo_express_admin_username",
                "mongo_express_admin_password"
            ]
        },
        "options": {
            "type": "object",
            "description": "Options",
            "properties": {
                "mongo_express_enable": {
                    "type": "boolean",
                    "description": "Enable Mongo express"
                }
            },
            "required": [
                "mongo_express_enable"
            ]
        }
    },
    "required": [
        "image",
        "service",
        "environment_variables",
        "options"
    ],
    "$defs": {
        "image": {
            "type": "object",
            "properties": {
                "repository": {
                    "$ref": "#/$defs/string_no_spaces",
                    "description": "The image repository"
                },
                "tag": {
                    "$ref": "#/$defs/string_no_spaces",
                    "description": "The image tag"
                }
            },
            "required": [
                "repository",
                "tag"
            ]
        },
        "service": {
            "type": "object",
            "description": "Service",
            "properties": {
                "node_port": {
                    "type": "integer",
                    "description": "The node port of the service",
                    "minimum": 1,
                    "maximum": 65535
                },
                "container_port": {
                    "type": "integer",
                    "description": "The container port of the service",
                    "minimum": 1,
                    "maximum": 65535
                },
                "name": {
                    "type": "string",
                    "description": "The name of the service"
                }
            },
            "required": [
                "node_port",
                "container_port",
                "name"
            ]
        },
        "string_no_spaces": {
            "type": "string",
            "description": "A string without spaces",
            "pattern": "^\\S+$"
        }
    }
}