Score Specification

repository·main·Indexed 27 days ago

https://github.com/score-spec/spec

A vendor-neutral, open-source workload specification for cloud-native resource requirements. It allows developers to define containers, services, and resources in a platform-agnostic YAML format, which can then be translated into platform-specific configurations like Docker Compose via score-compose or Kubernetes manifests via score-k8s.

Tokens
602
Snippets
1
Records
3
Agent score
43%

What's inside Score

  1. Overview of the Score Specification

    main
    Score is an open-source, platform-agnostic workload specification designed for cloud-native developers. It allows you to describe a workload's configuration (such as containers, services, and resource dependencies) in a vendor-neutral way. This eliminates the need to maintain separate, platform-specific syntax for tools like Docker Compose or Kubernetes, as a Score specification can be translated into various target formats by different implementations.
  2. Use Score implementations to generate target configurations

    main

    To use a Score specification, you must use a Score Implementation to translate the spec into a target format.

    Reference implementations include:

    • score-compose: Converts a Score specification into a docker-compose.yaml file.
    • score-k8s: Generates manifests.yaml files for deployment to Kubernetes clusters.
  3. Define a workload using a Score specification

    main

    A Score specification is typically written in YAML and includes apiVersion, metadata, containers, service, and resources.

    • containers: Defines the containers in the workload, their images, and environment variables.
    • service: Defines the ports exposed by the workload.
    • resources: Declares dependencies like databases (type: postgres), DNS, or routing requirements.

    Variables within containers can use parameterization to reference resource outputs (e.g., ${resources.db.host}) to ensure environment-agnostic configuration.

    apiVersion: score.dev/v1b1
    metadata:
      name: sample
    
    containers:
      main:
        image: ghcr.io/score-spec/sample-app-gif:sha-2533037
        variables:
          PG_CONNECTION_STRING: "postgresql://${resources.db.username}:${resources.db.password}@${resources.db.host}:${resources.db.port}/${resources.db.database}?sslmode=disable"
    
    service:
      ports:
        web:
          port: 8080
    
    resources:
      db:
        type: postgres
      dns:
        type: dns
      route:
        type: route
        params:
          host: ${resources.dns.host}
          path: /
          port: 8080