Merge pull request #791 from TomChv/doc-107-remove-randomness
Remove random generation tag on 107 docs
This commit is contained in:
commit
ff7fb745a4
@ -111,7 +111,7 @@ cue mod init
|
|||||||
Let's create a new directory for our Cue package:
|
Let's create a new directory for our Cue package:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
mkdir cue.mod/kube
|
mkdir kube
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deploy using Kubectl
|
### Deploy using Kubectl
|
||||||
@ -159,7 +159,7 @@ kubectl delete -f k8s/
|
|||||||
|
|
||||||
Create a file named `todoapp.cue` and add the following configuration to it.
|
Create a file named `todoapp.cue` and add the following configuration to it.
|
||||||
|
|
||||||
```cue title="todoapp/cue.mod/kube/todoapp.cue"
|
```cue title="todoapp/kube/todoapp.cue"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -193,7 +193,7 @@ The above `config.cue` defines:
|
|||||||
|
|
||||||
- `kubeconfig` a generic value created to embed this string `kubeconfig` value
|
- `kubeconfig` a generic value created to embed this string `kubeconfig` value
|
||||||
|
|
||||||
```cue title="todoapp/cue.mod/kube/config.cue"
|
```cue title="todoapp/kube/config.cue"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -215,7 +215,7 @@ The below `config.cue` defines:
|
|||||||
- `gkeConfig`: transform a `gcpConfig` to a readable format for `kubernetes.#Resources.kubeconfig`
|
- `gkeConfig`: transform a `gcpConfig` to a readable format for `kubernetes.#Resources.kubeconfig`
|
||||||
using `alpha.dagger.io/gcp/gke`
|
using `alpha.dagger.io/gcp/gke`
|
||||||
|
|
||||||
```cue title="todoapp/cue.mod/kube/config.cue"
|
```cue title="todoapp/kube/config.cue"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -247,7 +247,7 @@ The below `config.cue` defines:
|
|||||||
- `eksConfig`, transform a `awsConfig` to a readable format for `kubernetes.#Resources.kubeconfig`
|
- `eksConfig`, transform a `awsConfig` to a readable format for `kubernetes.#Resources.kubeconfig`
|
||||||
using `alpha.dagger.io/aws/eks`
|
using `alpha.dagger.io/aws/eks`
|
||||||
|
|
||||||
```cue title="todoapp/cue.mod/kube/config.cue"
|
```cue title="todoapp/kube/config.cue"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -279,7 +279,7 @@ eksConfig: eks.#KubeConfig & {
|
|||||||
Now that your Cue package is ready, let's create an environment to run it:
|
Now that your Cue package is ready, let's create an environment to run it:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
dagger new 'kube' -m cue.mod/kube
|
dagger new 'kube' -m kube
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configure the environment
|
### Configure the environment
|
||||||
@ -452,7 +452,6 @@ Let's see how to deploy an image locally and push it to the local cluster
|
|||||||
|
|
||||||
`kube/todoapp.cue` faces these changes:
|
`kube/todoapp.cue` faces these changes:
|
||||||
|
|
||||||
- `suffix`, a random string for a unique tag name
|
|
||||||
- `repository`, source code of the app to build. It needs to have a Dockerfile
|
- `repository`, source code of the app to build. It needs to have a Dockerfile
|
||||||
- `registry`, URI of the registry to push to
|
- `registry`, URI of the registry to push to
|
||||||
- `image`, build of the image
|
- `image`, build of the image
|
||||||
@ -466,24 +465,18 @@ import (
|
|||||||
"encoding/yaml"
|
"encoding/yaml"
|
||||||
|
|
||||||
"alpha.dagger.io/dagger"
|
"alpha.dagger.io/dagger"
|
||||||
"alpha.dagger.io/random"
|
|
||||||
"alpha.dagger.io/docker"
|
"alpha.dagger.io/docker"
|
||||||
"alpha.dagger.io/kubernetes"
|
"alpha.dagger.io/kubernetes"
|
||||||
"alpha.dagger.io/kubernetes/kustomize"
|
"alpha.dagger.io/kubernetes/kustomize"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Randrom string for tag
|
|
||||||
suffix: random.#String & {
|
|
||||||
seed: ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// input: source code repository, must contain a Dockerfile
|
// input: source code repository, must contain a Dockerfile
|
||||||
// set with `dagger input dir repository . -e kube`
|
// set with `dagger input dir repository . -e kube`
|
||||||
repository: dagger.#Artifact & dagger.#Input
|
repository: dagger.#Artifact & dagger.#Input
|
||||||
|
|
||||||
// Registry to push images to
|
// Registry to push images to
|
||||||
registry: string & dagger.#Input
|
registry: string & dagger.#Input
|
||||||
tag: "test-kind-\(suffix.out)"
|
tag: "test-kind"
|
||||||
|
|
||||||
// input: kubernetes objects directory to deploy to
|
// input: kubernetes objects directory to deploy to
|
||||||
// set with `dagger input dir manifest ./k8s -e kube`
|
// set with `dagger input dir manifest ./k8s -e kube`
|
||||||
@ -538,7 +531,7 @@ The two files have to be edited to do so.
|
|||||||
|
|
||||||
- definition of a new `ecrCreds` value that contains ecr credentials for remote image push to GCR
|
- definition of a new `ecrCreds` value that contains ecr credentials for remote image push to GCR
|
||||||
|
|
||||||
```cue title="todoapp/cue.mod/kube/config.cue"
|
```cue title="todoapp/kube/config.cue"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -568,7 +561,6 @@ gcrCreds: gcr.#Credentials & {
|
|||||||
|
|
||||||
`kube/todoapp.cue`, on the other hand, faces these changes:
|
`kube/todoapp.cue`, on the other hand, faces these changes:
|
||||||
|
|
||||||
- `suffix`, a random string for a unique tag name
|
|
||||||
- `repository`, source code of the app to build. It needs to have a Dockerfile
|
- `repository`, source code of the app to build. It needs to have a Dockerfile
|
||||||
- `registry`, URI of the registry to push to
|
- `registry`, URI of the registry to push to
|
||||||
- `image`, build of the image
|
- `image`, build of the image
|
||||||
@ -582,24 +574,18 @@ import (
|
|||||||
"encoding/yaml"
|
"encoding/yaml"
|
||||||
|
|
||||||
"alpha.dagger.io/dagger"
|
"alpha.dagger.io/dagger"
|
||||||
"alpha.dagger.io/random"
|
|
||||||
"alpha.dagger.io/docker"
|
"alpha.dagger.io/docker"
|
||||||
"alpha.dagger.io/kubernetes"
|
"alpha.dagger.io/kubernetes"
|
||||||
"alpha.dagger.io/kubernetes/kustomize"
|
"alpha.dagger.io/kubernetes/kustomize"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Randrom string for tag
|
|
||||||
suffix: random.#String & {
|
|
||||||
seed: ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// input: source code repository, must contain a Dockerfile
|
// input: source code repository, must contain a Dockerfile
|
||||||
// set with `dagger input dir repository . -e kube`
|
// set with `dagger input dir repository . -e kube`
|
||||||
repository: dagger.#Artifact & dagger.#Input
|
repository: dagger.#Artifact & dagger.#Input
|
||||||
|
|
||||||
// GCR registry to push images to
|
// GCR registry to push images to
|
||||||
registry: string & dagger.#Input
|
registry: string & dagger.#Input
|
||||||
tag: "test-gcr-\(suffix.out)"
|
tag: "test-gcr"
|
||||||
|
|
||||||
// source of Kube config file.
|
// source of Kube config file.
|
||||||
// set with `dagger input dir manifest ./k8s -e kube`
|
// set with `dagger input dir manifest ./k8s -e kube`
|
||||||
@ -687,7 +673,6 @@ ecrCreds: ecr.#Credentials & {
|
|||||||
|
|
||||||
`kube/todoapp.cue`, on the other hand, faces these changes:
|
`kube/todoapp.cue`, on the other hand, faces these changes:
|
||||||
|
|
||||||
- `suffix`, a random string for a unique tag name
|
|
||||||
- `repository`, source code of the app to build. It needs to have a Dockerfile
|
- `repository`, source code of the app to build. It needs to have a Dockerfile
|
||||||
- `registry`, URI of the registry to push to
|
- `registry`, URI of the registry to push to
|
||||||
- `image`, build of the image
|
- `image`, build of the image
|
||||||
@ -701,24 +686,18 @@ import (
|
|||||||
"encoding/yaml"
|
"encoding/yaml"
|
||||||
|
|
||||||
"alpha.dagger.io/dagger"
|
"alpha.dagger.io/dagger"
|
||||||
"alpha.dagger.io/random"
|
|
||||||
"alpha.dagger.io/docker"
|
"alpha.dagger.io/docker"
|
||||||
"alpha.dagger.io/kubernetes"
|
"alpha.dagger.io/kubernetes"
|
||||||
"alpha.dagger.io/kubernetes/kustomize"
|
"alpha.dagger.io/kubernetes/kustomize"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Randrom string for tag
|
|
||||||
suffix: random.#String & {
|
|
||||||
seed: ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// input: source code repository, must contain a Dockerfile
|
// input: source code repository, must contain a Dockerfile
|
||||||
// set with `dagger input dir repository . -e kube`
|
// set with `dagger input dir repository . -e kube`
|
||||||
repository: dagger.#Artifact & dagger.#Input
|
repository: dagger.#Artifact & dagger.#Input
|
||||||
|
|
||||||
// ECR registry to push images to
|
// ECR registry to push images to
|
||||||
registry: string & dagger.#Input
|
registry: string & dagger.#Input
|
||||||
tag: "test-ecr-\(suffix.out)"
|
tag: "test-ecr"
|
||||||
|
|
||||||
// source of Kube config file.
|
// source of Kube config file.
|
||||||
// set with `dagger input dir manifest ./k8s -e kube`
|
// set with `dagger input dir manifest ./k8s -e kube`
|
||||||
@ -819,15 +798,13 @@ dagger input dir repository . -e kube
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
dagger up -e kube
|
dagger up -e kube
|
||||||
# 4:09AM INF suffix.out | computing
|
|
||||||
# 4:09AM INF manifest | computing
|
# 4:09AM INF manifest | computing
|
||||||
# 4:09AM INF repository | computing
|
# 4:09AM INF repository | computing
|
||||||
# ...
|
# ...
|
||||||
# 4:09AM INF todoApp.kubeSrc | #37 0.858 service/todoapp-service created
|
# 4:09AM INF todoApp.kubeSrc | #37 0.858 service/todoapp-service created
|
||||||
# 4:09AM INF todoApp.kubeSrc | #37 0.879 deployment.apps/todoapp created
|
# 4:09AM INF todoApp.kubeSrc | #37 0.879 deployment.apps/todoapp created
|
||||||
# Output Value Description
|
# Output Value Description
|
||||||
# suffix.out "azkestizysbx" generated random string
|
# todoApp.remoteImage.ref "localhost:5000/kind:test-kind@sha256:cb8d92518b876a3fe15a23f7c071290dfbad50283ad976f3f5b93e9f20cefee6" Image ref
|
||||||
# todoApp.remoteImage.ref "localhost:5000/kind:test-kind-azkestizysbx@sha256:cb8d92518b876a3fe15a23f7c071290dfbad50283ad976f3f5b93e9f20cefee6" Image ref
|
|
||||||
# todoApp.remoteImage.digest "sha256:cb8d92518b876a3fe15a23f7c071290dfbad50283ad976f3f5b93e9f20cefee6" Image digest
|
# todoApp.remoteImage.digest "sha256:cb8d92518b876a3fe15a23f7c071290dfbad50283ad976f3f5b93e9f20cefee6" Image digest
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -861,7 +838,7 @@ and repetition.
|
|||||||
|
|
||||||
Let's define a re-usable `#Deployment` definition in `kube/deployment.cue`.
|
Let's define a re-usable `#Deployment` definition in `kube/deployment.cue`.
|
||||||
|
|
||||||
```cue title="todoapp/cue.mod/kube/deployment.cue"
|
```cue title="todoapp/kube/deployment.cue"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// Deployment template containing all the common boilerplate shared by
|
// Deployment template containing all the common boilerplate shared by
|
||||||
@ -909,7 +886,7 @@ package main
|
|||||||
|
|
||||||
Indeed, let's also define a re-usable `#Service` definition in `kube/service.cue`.
|
Indeed, let's also define a re-usable `#Service` definition in `kube/service.cue`.
|
||||||
|
|
||||||
```cue title="todoapp/cue.mod/kube/service.cue"
|
```cue title="todoapp/kube/service.cue"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// Service template containing all the common boilerplate shared by
|
// Service template containing all the common boilerplate shared by
|
||||||
@ -955,7 +932,7 @@ without having boilerplate nor repetition.
|
|||||||
|
|
||||||
Create a new definition named `#AppManifest` that will generate the YAML in `kube/manifest.cue`.
|
Create a new definition named `#AppManifest` that will generate the YAML in `kube/manifest.cue`.
|
||||||
|
|
||||||
```cue title="todoapp/cue.mod/kube/manifest.cue"
|
```cue title="todoapp/kube/manifest.cue"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -1006,28 +983,22 @@ values={[
|
|||||||
|
|
||||||
<TabItem value="kind">
|
<TabItem value="kind">
|
||||||
|
|
||||||
```cue title="todoapp/cue.mod/kube/todoapp.cue"
|
```cue title="todoapp/kube/todoapp.cue"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"alpha.dagger.io/dagger"
|
"alpha.dagger.io/dagger"
|
||||||
"alpha.dagger.io/random"
|
|
||||||
"alpha.dagger.io/docker"
|
"alpha.dagger.io/docker"
|
||||||
"alpha.dagger.io/kubernetes"
|
"alpha.dagger.io/kubernetes"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Randrom string for tag
|
|
||||||
suffix: random.#String & {
|
|
||||||
seed: ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// input: source code repository, must contain a Dockerfile
|
// input: source code repository, must contain a Dockerfile
|
||||||
// set with `dagger input dir repository . -e kube`
|
// set with `dagger input dir repository . -e kube`
|
||||||
repository: dagger.#Artifact & dagger.#Input
|
repository: dagger.#Artifact & dagger.#Input
|
||||||
|
|
||||||
// Registry to push images to
|
// Registry to push images to
|
||||||
registry: string & dagger.#Input
|
registry: string & dagger.#Input
|
||||||
tag: "test-kind-\(suffix.out)"
|
tag: "test-kind"
|
||||||
|
|
||||||
// Todoapp deployment pipeline
|
// Todoapp deployment pipeline
|
||||||
todoApp: {
|
todoApp: {
|
||||||
@ -1059,28 +1030,22 @@ todoApp: {
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="gke">
|
<TabItem value="gke">
|
||||||
|
|
||||||
```cue title="todoapp/cue.mod/kube/todoapp.cue"
|
```cue title="todoapp/kube/todoapp.cue"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"alpha.dagger.io/dagger"
|
"alpha.dagger.io/dagger"
|
||||||
"alpha.dagger.io/random"
|
|
||||||
"alpha.dagger.io/docker"
|
"alpha.dagger.io/docker"
|
||||||
"alpha.dagger.io/kubernetes"
|
"alpha.dagger.io/kubernetes"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Randrom string for tag
|
|
||||||
suffix: random.#String & {
|
|
||||||
seed: ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// input: source code repository, must contain a Dockerfile
|
// input: source code repository, must contain a Dockerfile
|
||||||
// set with `dagger input dir repository . -e kube`
|
// set with `dagger input dir repository . -e kube`
|
||||||
repository: dagger.#Artifact & dagger.#Input
|
repository: dagger.#Artifact & dagger.#Input
|
||||||
|
|
||||||
// GCR registry to push images to
|
// GCR registry to push images to
|
||||||
registry: string & dagger.#Input
|
registry: string & dagger.#Input
|
||||||
tag: "test-gcr-\(suffix.out)"
|
tag: "test-gcr"
|
||||||
|
|
||||||
// Todoapp deployment pipeline
|
// Todoapp deployment pipeline
|
||||||
todoApp: {
|
todoApp: {
|
||||||
@ -1112,28 +1077,22 @@ todoApp: {
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="eks">
|
<TabItem value="eks">
|
||||||
|
|
||||||
```cue title="todoapp/cue.mod/kube/todoapp.cue"
|
```cue title="todoapp/kube/todoapp.cue"
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"alpha.dagger.io/dagger"
|
"alpha.dagger.io/dagger"
|
||||||
"alpha.dagger.io/random"
|
|
||||||
"alpha.dagger.io/docker"
|
"alpha.dagger.io/docker"
|
||||||
"alpha.dagger.io/kubernetes"
|
"alpha.dagger.io/kubernetes"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Randrom string for tag
|
|
||||||
suffix: random.#String & {
|
|
||||||
seed: ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// input: source code repository, must contain a Dockerfile
|
// input: source code repository, must contain a Dockerfile
|
||||||
// set with `dagger input dir repository . -e kube`
|
// set with `dagger input dir repository . -e kube`
|
||||||
repository: dagger.#Artifact & dagger.#Input
|
repository: dagger.#Artifact & dagger.#Input
|
||||||
|
|
||||||
// ECR registry to push images to
|
// ECR registry to push images to
|
||||||
registry: string & dagger.#Input
|
registry: string & dagger.#Input
|
||||||
tag: "test-ecr-\(suffix.out)"
|
tag: "test-ecr"
|
||||||
|
|
||||||
// Todoapp deployment pipeline
|
// Todoapp deployment pipeline
|
||||||
todoApp: {
|
todoApp: {
|
||||||
@ -1178,15 +1137,13 @@ dagger input unset manifest -e kube
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
dagger up -e kube
|
dagger up -e kube
|
||||||
# 4:09AM INF suffix.out | computing
|
|
||||||
# 4:09AM INF manifest | computing
|
# 4:09AM INF manifest | computing
|
||||||
# 4:09AM INF repository | computing
|
# 4:09AM INF repository | computing
|
||||||
# ...
|
# ...
|
||||||
# 4:09AM INF todoApp.kubeSrc | #37 0.858 service/todoapp-service created
|
# 4:09AM INF todoApp.kubeSrc | #37 0.858 service/todoapp-service created
|
||||||
# 4:09AM INF todoApp.kubeSrc | #37 0.879 deployment.apps/todoapp created
|
# 4:09AM INF todoApp.kubeSrc | #37 0.879 deployment.apps/todoapp created
|
||||||
# Output Value Description
|
# Output Value Description
|
||||||
# suffix.out "abdkektizesxb" generated random string
|
# todoApp.remoteImage.ref "localhost:5000/kind:test-kind@sha256:cb8d91518b076a3fe15a33f7c171290dfbad50283ad976f3f5b93e9f33cefag7" Image ref
|
||||||
# todoApp.remoteImage.ref "localhost:5000/kind:test-kind-abdkektizesxb@sha256:cb8d91518b076a3fe15a33f7c171290dfbad50283ad976f3f5b93e9f33cefag7" Image ref
|
|
||||||
# todoApp.remoteImage.digest "sha256:cb8d91518b076a3fe15a33f7c171290dfbad50283ad976f3f5b93e9f33cefag7" Image digest
|
# todoApp.remoteImage.digest "sha256:cb8d91518b076a3fe15a33f7c171290dfbad50283ad976f3f5b93e9f33cefag7" Image digest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user