Developers

Updates and signatures

How to update without losing requests and how to verify the image is the official one.

Updated:

Versions

Each release publishes immutable tags (0.1.0-cpu, 0.1.0-cuda) and moves the floating tags (cpu, cuda, latest). In production use version tags: you know exactly what runs and you update when you decide. The Helm chart has the same version as the image.

Update

The graceful shutdown hands in-flight requests back to the network with no penalty, so updating is safe at any time. With Docker, pull the new version and recreate the container with the same volume:

bash
VERSION=0.1.0
docker pull registry.piap.io/piap/node:$VERSION-cpu
docker stop -t 90 piap-node && docker rm piap-node
docker run -d --name piap-node --restart unless-stopped --stop-timeout 90 \
  -e PIAP_TOKEN -v piap-data:/data --read-only --tmpfs /tmp \
  registry.piap.io/piap/node:$VERSION-cpu

With Docker Compose, change the tag in compose.yaml and run:

bash
docker compose pull
docker compose up -d

With Helm, change --version. The StatefulSet replaces one pod at a time and the PodDisruptionBudget keeps several from going down:

bash
helm upgrade piap-node oci://registry.piap.io/piap/charts/node --version 0.1.0 \
  -n piap --reuse-values
kubectl -n piap rollout status statefulset/piap-node

Verify signatures

Every published image is signed by piap and carries a CycloneDX SBOM as an attestation. Verify them with cosign and the piap public key (it is public, not a secret). cosign uses your docker login credentials:

bash
cosign verify --key https://piap.io/developers/cosign.pub registry.piap.io/piap/node:0.1.0-cpu
bash
cosign verify-attestation --key https://piap.io/developers/cosign.pub \
  --type cyclonedx registry.piap.io/piap/node:0.1.0-cpu

The public key:

cosign.pub
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE4B+TKwX5PJqjFVaMutGT3KsjGSzU
u/LVdzsB3dATNGuaIHil8JXkc6ywb0ZUFDLqX7KYjSV9lXvfoUtHG0BNuw==
-----END PUBLIC KEY-----

Require the signature in the cluster

Optional: an admission policy that only lets the signed official image run. Example with Kyverno (other admission tools that verify cosign signatures work too). The policy uses the pull Secret to read the signatures and pins the verified digest in the pod:

yaml
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: require-piap-node-signature
spec:
  validationFailureAction: Enforce
  webhookTimeoutSeconds: 30
  rules:
    - name: verify-piap-node
      match:
        any:
          - resources:
              kinds: ["Pod"]
              namespaces: ["piap"]
      verifyImages:
        - imageReferences:
            - "registry.piap.io/piap/node*"
          imageRegistryCredentials:
            secrets: ["piap-registry"]
          mutateDigest: true
          verifyDigest: true
          required: true
          attestors:
            - entries:
                - keys:
                    publicKeys: |-
                      -----BEGIN PUBLIC KEY-----
                      MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE4B+TKwX5PJqjFVaMutGT3KsjGSzU
                      u/LVdzsB3dATNGuaIHil8JXkc6ywb0ZUFDLqX7KYjSV9lXvfoUtHG0BNuw==
                      -----END PUBLIC KEY-----