Dns
score.yaml
(view on GitHub)
:
apiVersion: score.dev/v1b1
metadata:
name: my-workload
containers:
my-container:
image: ghcr.io/stefanprodan/podinfo:latest
variables:
PODINFO_UI_MESSAGE: "Hello, ${resources.dns.url}!"
resources:
dns:
type: dns
route:
type: route
params:
host: ${resources.dns.host}
path: /
port: 8080
service:
ports:
tcp:
port: 8080
targetPort: 9898
10-dns-in-codespace.provisioners.yaml
(view on GitHub)
:
- uri: cmd://bash#dns-in-codespace
type: dns
description: Get the forwarded port URL in current GitHub Codespace on port 8080
args:
- -c
- |
set -eu -o pipefail
CODESPACE_NAME=$(gh codespace view --json name | jq -r .name)
HOST=${CODESPACE_NAME}-8080.app.github.dev
URL=https://${HOST}
OUTPUTS='{"resource_outputs":{"host":"%s", "url":"%s"}}'
printf "$OUTPUTS" "$HOST" "$URL"
#expected_outputs:
# - host
# - url
10-dns-with-url.provisioners.yaml
(view on GitHub)
:
- uri: template://community-provisioners/dns-with-route
type: dns
description: Outputs a *.localhost domain as the hostname and associated URL in http on port 8080
init: |
randomHostname: dns{{ randAlphaNum 6 | lower }}.localhost
state: |
instanceHostname: {{ dig "instanceHostname" .Init.randomHostname .State | quote }}
outputs: |
host: {{ .State.instanceHostname }}
url: http://{{ .State.instanceHostname }}:8080
expected_outputs:
- host
- url
README.md
(view on GitHub)
:
Prerequisites for `dns-in-codespace`:
- Have `gh` installed, this provisioner is using the GitHub CLI to get the name of the current GitHub Codespace.
Initialize your local workspace, by importing a specific community provisioner:
score-commpose init --provisioners REPLACE-ME-WITH-ACTUAL-PROVISIONER-FILE-URL.yaml
Note: you need to replace REPLACE-ME-WITH-ACTUAL-PROVISIONER-FILE-URL.yaml
by the actual provisioner file you want to use and import. More information here.
Get the provisioners definition:
score-compose provisioners list
Generate the platform specific manifests:
score-commpose generate score.yaml
See the resource outputs:
score-commpose resources list
You can run the following command on each resource listed with the previous command to get their outputs
:
score-commpose resources get-outputs
Deploy the generated manifests:
docker compose up -d
See the running containers:
docker ps
10-dns-in-codespace.provisioners.yaml
(view on GitHub)
:
- uri: cmd://bash#dns-in-codespace
type: dns
description: Get the forwarded port URL in current GitHub Codespace on port 80
args:
- -c
- |
set -eu -o pipefail
CODESPACE_NAME=$(gh codespace view --json name | jq -r .name)
HOST=${CODESPACE_NAME}-80.app.github.dev
URL=https://${HOST}
OUTPUTS='{"resource_outputs":{"host":"%s", "url":"%s"},"manifests":[]}'
printf "$OUTPUTS" "$HOST" "$URL"
expected_outputs:
- host
- url
10-dns-with-url.provisioners.yaml
(view on GitHub)
:
- uri: template://default-provisioners/dns-with-url
type: dns
description: Outputs a *.localhost domain as the hostname and associated URL in http on port 80
init: |
randomHostname: dns{{ randAlphaNum 6 | lower }}.localhost
state: |
instanceHostname: {{ dig "instanceHostname" .Init.randomHostname .State | quote }}
outputs: |
host: {{ .State.instanceHostname }}
url: http://{{ .State.instanceHostname }}:80
expected_outputs:
- host
- url
README.md
(view on GitHub)
:
Prerequisites for `dns-in-codespace`:
- Have `gh` installed, this provisioner is using the GitHub CLI to get the name of the current GitHub Codespace.
Initialize your local workspace, by importing a specific community provisioner:
score-k8s init --provisioners REPLACE-ME-WITH-ACTUAL-PROVISIONER-FILE-URL.yaml
Note: you need to replace REPLACE-ME-WITH-ACTUAL-PROVISIONER-FILE-URL.yaml
by the actual provisioner file you want to use and import. More information here.
Get the provisioners definition:
score-k8s provisioners list
Generate the platform specific manifests:
score-k8s generate score.yaml
See the resource outputs:
score-k8s resources list
You can run the following command on each resource listed with the previous command to get their outputs
:
score-k8s resources get-outputs
Deploy the generated manifests:
kubectl apply -f manifests.yaml
See the running containers:
kubectl get all