ℹ️ 2022-12-19 TAP 1.3版に更新しました
こちらの記事でrust buildpackを使ってRustアプリのコンテナイメージを作成しました。
今回はTanzu Application Platform (TAP)上でrust buildpackを使ってアプリをデプロイできるようににします。
TAPでRustを使えるようにするには、ClusterStoreにRust Buildpackを追加し、ClusterBuilderにRustのgroupを追加する必要があります。
TAP 1.2以降では、使用するStore, Stack, BuilderはTanzuNetDependencyUpdaterリソースに定義されているので、
これを更新するのが楽です。TAP 1.1以下では本記事の内容は使えません。
TanzuNetDependencyUpdaterはlite dependencies (デフォルト)を使う場合と、full dependeniesを使う場合で異なります。
lite dependenciesを使用している場合
こちらの記事でインストールした環境にRust Buildpackを追加します。
次のようにTanzuNetDependencyUpdaterにClusterStoreとClusterBuilderを追加するoverlayを用意します。
rust buildpackのReleases を見て、執筆時点で最新の0.21.0を使用します。
cat <<EOF > buildservice-add-rust-buildpack.yaml
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.subset({"metadata":{"name":"dependency-updater"}, "kind": "TanzuNetDependencyUpdater"})
---
spec:
inlineDescriptor:
clusterStores:
#@overlay/match by="name", missing_ok=True
- name: default
sources:
#@overlay/append
- image: docker.io/paketocommunity/rust:0.21.0
clusterBuilders:
#@overlay/match by="name", missing_ok=True
- name: base
order:
#@overlay/append
- group:
- id: paketo-community/rust
#@overlay/match by="name", missing_ok=True
- name: base-jammy
order:
#@overlay/append
- group:
- id: paketo-community/rust
EOF
次のコマンドでoverlayファイルのSecretを作成します。
kubectl -n tap-install create secret generic buildservice-add-rust-buildpack \
-o yaml \
--dry-run=client \
--from-file=buildservice-add-rust-buildpack.yaml \
| kubectl apply -f-
tap-values.yaml
のpackage_overlays
に次の項目を追加します。
package_overlays:
# ...
- name: buildservice
secrets:
- name: buildservice-add-rust-buildpack
次のコマンドでTAPを更新します。
tanzu package installed update tap -f tap-values.yaml -n tap-install
Builderの更新の進捗は次のログを見ることで確認できます。
$ kubectl logs -n build-service deploy/dependency-updater-controller -f
Importing ...
の後 Reconcile succeeded
が出ていればアップロード完了です。
{"level":"info","ts":1671256567.689486,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterStack 'base'..."}
{"level":"info","ts":1671256574.6747718,"caller":"dependencyupdater/logger.go:21","msg":"Uploading to 'ghcr.io/making/buildservice'..."}
{"level":"info","ts":1671256586.5696454,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterStack 'base-jammy'..."}
{"level":"info","ts":1671256593.1804342,"caller":"dependencyupdater/logger.go:21","msg":"Uploading to 'ghcr.io/making/buildservice'..."}
{"level":"info","ts":1671256604.486676,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterStack 'default'..."}
{"level":"info","ts":1671256611.5543656,"caller":"dependencyupdater/logger.go:21","msg":"Uploading to 'ghcr.io/making/buildservice'..."}
{"level":"info","ts":1671256623.4512107,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterBuilder 'base'..."}
{"level":"info","ts":1671256623.451297,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterBuilder 'base-jammy'..."}
{"level":"info","ts":1671256623.4513245,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterBuilder 'default'..."}
{"level":"error","ts":1671256663.5169995,"caller":"controller/controller.go:566","msg":"Reconcile error","knative.dev/kind":"tanzunetdependencyupdaters.buildservice.tanzu.vmware.com","knative.dev/traceid":"dd2f47e0-eb8f-4896-acac-d652c68590cd","knative.dev/key":"build-service/dependency-updater","duration":158.1577005,"error":"Operation cannot be fulfilled on tanzunetdependencyupdaters.buildservice.tanzu.vmware.com \"dependency-updater\": the object has been modified; please apply your changes to the latest version and try again","stacktrace":"knative.dev/pkg/controller.(*Impl).handleErr\n\tknative.dev/pkg@v0.0.0-20220816153547-f78a00694307/controller/controller.go:566\nknative.dev/pkg/controller.(*Impl).processNextWorkItem\n\tknative.dev/pkg@v0.0.0-20220816153547-f78a00694307/controller/controller.go:543\nknative.dev/pkg/controller.(*Impl).RunContext.func3\n\tknative.dev/pkg@v0.0.0-20220816153547-f78a00694307/controller/controller.go:491"}
{"level":"info","ts":1671256663.54724,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterStore 'default'..."}
{"level":"info","ts":1671256669.2393765,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1671256675.8956268,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1671256681.7479155,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1671256687.4219196,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1671256693.0272758,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1671256698.7091641,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1671256704.3584926,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1671256709.986599,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1671256714.0713937,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1671256714.071569,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterStack 'base'..."}
{"level":"info","ts":1671256720.7520647,"caller":"dependencyupdater/logger.go:21","msg":"Uploading to 'ghcr.io/making/buildservice'..."}
{"level":"info","ts":1671256732.6457255,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterStack 'base-jammy'..."}
{"level":"info","ts":1671256739.3666627,"caller":"dependencyupdater/logger.go:21","msg":"Uploading to 'ghcr.io/making/buildservice'..."}
{"level":"info","ts":1671256750.342318,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterStack 'default'..."}
{"level":"info","ts":1671256756.9398577,"caller":"dependencyupdater/logger.go:21","msg":"Uploading to 'ghcr.io/making/buildservice'..."}
{"level":"info","ts":1671256769.5763338,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterBuilder 'base'..."}
{"level":"info","ts":1671256769.5764246,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterBuilder 'base-jammy'..."}
{"level":"info","ts":1671256769.5764647,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterBuilder 'default'..."}
{"level":"info","ts":1671256770.7320092,"caller":"controller/controller.go:550","msg":"Reconcile succeeded","knative.dev/kind":"tanzunetdependencyupdaters.buildservice.tanzu.vmware.com","knative.dev/traceid":"1ff28f78-bd49-4674-a765-65eca5cfe690","knative.dev/key":"build-service/dependency-updater","duration":107.3496843}
{"level":"info","ts":1663132459.9617548,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterStore 'default'..."}
{"level":"info","ts":1663132463.9133067,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1663132468.315304,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1663132472.4485848,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1663132476.4138098,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1663132480.417098,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1663132484.858053,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1663132488.84969,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1663132491.4091198,"caller":"dependencyupdater/logger.go:16","msg":"\tBuildpackage already exists in the store"}
{"level":"info","ts":1663132491.409171,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterStack 'base'..."}
{"level":"info","ts":1663132498.387017,"caller":"dependencyupdater/logger.go:21","msg":"Uploading to 'tap11046.azurecr.io/build-service'..."}
{"level":"info","ts":1663132506.5005634,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterStack 'default'..."}
{"level":"info","ts":1663132513.2477891,"caller":"dependencyupdater/logger.go:21","msg":"Uploading to 'tap11046.azurecr.io/build-service'..."}
{"level":"info","ts":1663132521.6199417,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterBuilder 'base'..."}
{"level":"info","ts":1663132521.620088,"caller":"dependencyupdater/logger.go:21","msg":"Importing ClusterBuilder 'default'..."}
{"level":"error","ts":1663132522.1857035,"caller":"controller/controller.go:564","msg":"Reconcile error","knative.dev/kind":"tanzunetdependencyupdaters.buildservice.tanzu.vmware.com","duration":62.287972661,"error":"Operation cannot be fulfilled on tanzunetdependencyupdaters.buildservice.tanzu.vmware.com \"dependency-updater\": the object has been modified; please apply your changes to the latest version and try again","stacktrace":"knative.dev/pkg/controller.(*Impl).handleErr\n\tknative.dev/pkg@v0.0.0-20210902173607-844a6bc45596/controller/controller.go:564\nknative.dev/pkg/controller.(*Impl).processNextWorkItem\n\tknative.dev/pkg@v0.0.0-20210902173607-844a6bc45596/controller/controller.go:541\nknative.dev/pkg/controller.(*Impl).RunContext.func3\n\tknative.dev/pkg@v0.0.0-20210902173607-844a6bc45596/controller/controller.go:477"}
{"level":"info","ts":1663132522.186615,"caller":"controller/controller.go:548","msg":"Reconcile succeeded","knative.dev/kind":"tanzunetdependencyupdaters.buildservice.tanzu.vmware.com","knative.dev/traceid":"12a2a247-bb21-4ce9-bd2f-5ffcc18ad8f2","knative.dev/key":"build-service/dependency-updater","duration":0.00081851}
ClusterStoreやClusterBuilderの状態はkp
CLIを使うと確認しやすいです。
次のコマンドでClusterStoreを確認して、paketo-community/rust
が含まれていればOKです。
$ kp clusterstore status default
Status: Ready
BUILDPACKAGE ID VERSION HOMEPAGE
paketo-community/rust 0.21.0 https://github.com/paketo-community/rust
tanzu-buildpacks/dotnet-core-lite 1.18.1 https://docs.vmware.com/en/VMware-Tanzu-Buildpacks/services/tanzu-buildpacks/GUID-dotnet-core-dotnet-core-buildpack.html
tanzu-buildpacks/go-lite 2.0.2 https://docs.pivotal.io/tanzu-buildpacks/go/go-buildpack.html
tanzu-buildpacks/java-lite 7.7.0 https://docs.vmware.com/en/VMware-Tanzu-Buildpacks/services/tanzu-buildpacks/GUID-java-java-buildpack.html
tanzu-buildpacks/java-native-image-lite 6.33.0 https://docs.vmware.com/en/VMware-Tanzu-Buildpacks/services/tanzu-buildpacks/GUID-java-native-image-java-native-image-buildpack.html
tanzu-buildpacks/nodejs-lite 1.16.0 https://docs.pivotal.io/tanzu-buildpacks/nodejs/nodejs-buildpack.html
tanzu-buildpacks/python-lite 2.1.2
tanzu-buildpacks/ruby-lite 1.1.0
tanzu-buildpacks/web-servers-lite 0.3.0
次のコマンドでClusterBuilderを確認して、paketo-community/rust@0.21.0
が含まれていればOKです。
$ kp clusterbuilder status base
...
DETECTION ORDER
Group #1
tanzu-buildpacks/ruby-lite@1.1.0
Group #2
tanzu-buildpacks/dotnet-core-lite@1.18.1
Group #3
tanzu-buildpacks/go-lite@2.0.2
Group #4
tanzu-buildpacks/python-lite@2.1.2
Group #5
tanzu-buildpacks/web-servers-lite@0.3.0
Group #6
tanzu-buildpacks/java-native-image-lite@6.33.0
Group #7
tanzu-buildpacks/java-lite@7.7.0
Group #8
tanzu-buildpacks/nodejs-lite@1.16.0
Group #9
paketo-community/rust@0.21.0
Workloadを作成します。 こちらの記事で作成したアプリを使用します。
tanzu apps workload apply hello-rust \
--app hello-rust \
--git-repo https://github.com/making/hello-rust \
--git-branch main \
--type web \
-n demo \
-y
stern でログを確認します。
stern -n demo hello-rust
次のようなログが流れ、rust buildpackでビルドされているログを確認できます。
+ hello-rust-build-1-build-pod › setup-ca-certs
hello-rust-build-1-build-pod setup-ca-certs Create certificate...
hello-rust-build-1-build-pod setup-ca-certs Populate certificate...
hello-rust-build-1-build-pod setup-ca-certs Update CA certificates...
hello-rust-build-1-build-pod setup-ca-certs Copying CA certificates...
hello-rust-build-1-build-pod setup-ca-certs Finished setting up CA certificates
- hello-rust-build-1-build-pod › setup-ca-certs
+ hello-rust-build-1-build-pod › prepare
hello-rust-build-1-build-pod prepare Build reason(s): CONFIG
hello-rust-build-1-build-pod prepare CONFIG:
hello-rust-build-1-build-pod prepare + env:
hello-rust-build-1-build-pod prepare + - name: BP_OCI_SOURCE
hello-rust-build-1-build-pod prepare + value: main/88c425454ec5274ea2ba35441bc8d18c9aad6171
hello-rust-build-1-build-pod prepare resources: {}
hello-rust-build-1-build-pod prepare - source: {}
hello-rust-build-1-build-pod prepare + source:
hello-rust-build-1-build-pod prepare + blob:
hello-rust-build-1-build-pod prepare + url: http://fluxcd-source-controller.flux-system.svc.cluster.local./gitrepository/demo/hello-rust/88c425454ec5274ea2ba35441bc8d18c9aad6171.tar.gz
hello-rust-build-1-build-pod prepare Loading secret for "ghcr.io" from secret "registry-credentials" at location "/var/build-secrets/registry-credentials"
hello-rust-build-1-build-pod prepare Loading cluster credential helpers
hello-rust-build-1-build-pod prepare Downloading fluxcd-source-controller.flux-system.svc.cluster.local./gitrepository/demo/hello-rust/88c425454ec5274ea2ba35441bc8d18c9aad6171.tar.gz...
hello-rust-build-1-build-pod prepare Successfully downloaded fluxcd-source-controller.flux-system.svc.cluster.local./gitrepository/demo/hello-rust/88c425454ec5274ea2ba35441bc8d18c9aad6171.tar.gz in path "/workspace"
- hello-rust-build-1-build-pod › prepare
+ hello-rust-build-1-build-pod › analyze
hello-rust-build-1-build-pod analyze Restoring data for SBOM from previous image
- hello-rust-build-1-build-pod › analyze
+ hello-rust-build-1-build-pod › build
hello-rust-build-1-build-pod build
hello-rust-build-1-build-pod build Paketo Buildpack for Rustup 1.7.0
hello-rust-build-1-build-pod build https://github.com/paketo-community/rustup
hello-rust-build-1-build-pod build Build Configuration:
hello-rust-build-1-build-pod build $BP_RUSTUP_ENABLED true use rustup to install Rust
hello-rust-build-1-build-pod build $BP_RUSTUP_INIT_LIBC gnu libc implementation: gnu or musl
hello-rust-build-1-build-pod build $BP_RUSTUP_INIT_VERSION 1 the rustup version
hello-rust-build-1-build-pod build $BP_RUST_PROFILE minimal the Rust profile to install
hello-rust-build-1-build-pod build $BP_RUST_TARGET an additional Rust target to install
hello-rust-build-1-build-pod build $BP_RUST_TOOLCHAIN stable the Rust toolchain or version number to install
hello-rust-build-1-build-pod build Rustup (GNU libc) 1.25.1: Contributing to layer
hello-rust-build-1-build-pod build Downloading from https://static.rust-lang.org/rustup/archive/1.25.1/x86_64-unknown-linux-gnu/rustup-init
hello-rust-build-1-build-pod build Verifying checksum
hello-rust-build-1-build-pod build Copying to /layers/paketo-community_rustup/rustup-init-gnu/bin
hello-rust-build-1-build-pod build Cargo: Contributing to layer
hello-rust-build-1-build-pod build Rustup: Contributing to layer
hello-rust-build-1-build-pod build Installing Rustup
hello-rust-build-1-build-pod build Rust: Contributing to layer
hello-rust-build-1-build-pod build Installing Rust
hello-rust-build-1-build-pod build info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
hello-rust-build-1-build-pod build info: latest update on 2022-12-15, rust version 1.66.0 (69f9c33d7 2022-12-12)
hello-rust-build-1-build-pod build info: downloading component 'cargo'
hello-rust-build-1-build-pod build info: downloading component 'rust-std'
hello-rust-build-1-build-pod build info: downloading component 'rustc'
hello-rust-build-1-build-pod build info: installing component 'cargo'
hello-rust-build-1-build-pod build info: installing component 'rust-std'
hello-rust-build-1-build-pod build info: installing component 'rustc'
rust-build-1-build-pod build
hello-rust-build-1-build-pod build stable-x86_64-unknown-linux-gnu installed - rustc 1.66.0 (69f9c33d7 2022-12-12)
hello-rust-build-1-build-pod build
hello-rust-build-1-build-pod build info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'
hello-rust-build-1-build-pod build info: checking for self-updates
hello-rust-build-1-build-pod build info: component 'rust-std' for target 'x86_64-unknown-linux-gnu' is up to date
hello-rust-build-1-build-pod build
hello-rust-build-1-build-pod build Rust Distribution Buildpack 1.13.0
hello-rust-build-1-build-pod build https://github.com/paketo-community/rust-dist
hello-rust-build-1-build-pod build
hello-rust-build-1-build-pod build Paketo Buildpack for Syft 1.23.0
hello-rust-build-1-build-pod build https://github.com/paketo-buildpacks/syft
hello-rust-build-1-build-pod build Downloading from https://github.com/anchore/syft/releases/download/v0.62.1/syft_0.62.1_linux_amd64.tar.gz
hello-rust-build-1-build-pod build Verifying checksum
hello-rust-build-1-build-pod build Writing env.build/SYFT_CHECK_FOR_APP_UPDATE.default
hello-rust-build-1-build-pod build
hello-rust-build-1-build-pod build Rust Cargo Build Pack 0.8.0
hello-rust-build-1-build-pod build https://github.com/paketo-community/cargo
hello-rust-build-1-build-pod build Build Configuration:
hello-rust-build-1-build-pod build $BP_CARGO_INSTALL_ARGS --locked additional arguments to pass to Cargo install
hello-rust-build-1-build-pod build $BP_CARGO_INSTALL_TOOLS additional tools to be add with Cargo install
hello-rust-build-1-build-pod build $BP_CARGO_INSTALL_TOOLS_ARGS additional arguments to pass to Cargo install for tools
hello-rust-build-1-build-pod build $BP_CARGO_TINI_DISABLED false Skip installing tini
hello-rust-build-1-build-pod build $BP_CARGO_WORKSPACE_MEMBERS the subset of workspace members for Cargo to install
hello-rust-build-1-build-pod build $BP_DISABLE_SBOM false Skip running SBOM scan
hello-rust-build-1-build-pod build $BP_EXCLUDE_FILES colon separated list of glob patterns, matched source files are removed
hello-rust-build-1-build-pod build $BP_INCLUDE_FILES static/*:templates/*:public/*:html/* colon separated list of glob patterns, matched source files are included
hello-rust-build-1-build-pod build Tini 0.19.0: Reusing cached layer
hello-rust-build-1-build-pod build Creating cached target directory /workspace/target
hello-rust-build-1-build-pod build Rust Application: Contributing to layer
hello-rust-build-1-build-pod build File modification times not restored
hello-rust-build-1-build-pod build File modification times not restored
hello-rust-build-1-build-pod build File modification times not restored
hello-rust-build-1-build-pod build cargo install --locked --color=never --root=/layers/paketo-community_cargo/Cargo --path=.
hello-rust-build-1-build-pod build Installing hello-rust v0.1.0 (/workspace)
hello-rust-build-1-build-pod build Updating crates.io index
hello-rust-build-1-build-pod build Downloading crates ...
hello-rust-build-1-build-pod build Downloaded zstd-safe v5.0.2+zstd.1.5.2
hello-rust-build-1-build-pod build Downloaded tokio-util v0.7.4
hello-rust-build-1-build-pod build Downloaded adler v1.0.2
hello-rust-build-1-build-pod build Downloaded rand_chacha v0.3.1
hello-rust-build-1-build-pod build Downloaded cfg-if v1.0.0
hello-rust-build-1-build-pod build Downloaded crypto-common v0.1.6
hello-rust-build-1-build-pod build Downloaded aho-corasick v0.7.19
hello-rust-build-1-build-pod build Downloaded cpufeatures v0.2.5
hello-rust-build-1-build-pod build Downloaded crc32fast v1.3.2
hello-rust-build-1-build-pod build Downloaded convert_case v0.4.0
hello-rust-build-1-build-pod build Downloaded futures-core v0.3.24
hello-rust-build-1-build-pod build Downloaded form_urlencoded v1.1.0
hello-rust-build-1-build-pod build Downloaded futures-task v0.3.24
hello-rust-build-1-build-pod build Downloaded zstd-sys v2.0.1+zstd.1.5.2
hello-rust-build-1-build-pod build Downloaded futures-sink v0.3.24
hello-rust-build-1-build-pod build Downloaded flate2 v1.0.24
hello-rust-build-1-build-pod build Downloaded httpdate v1.0.2
hello-rust-build-1-build-pod build Downloaded generic-array v0.14.6
hello-rust-build-1-build-pod build Downloaded digest v0.10.3
hello-rust-build-1-build-pod build Downloaded fnv v1.0.7
hello-rust-build-1-build-pod build Downloaded cc v1.0.73
hello-rust-build-1-build-pod build Downloaded num_threads v0.1.6
hello-rust-build-1-build-pod build Downloaded bitflags v1.3.2
hello-rust-build-1-build-pod build Downloaded pin-utils v0.1.0
hello-rust-build-1-build-pod build Downloaded percent-encoding v2.2.0
hello-rust-build-1-build-pod build Downloaded base64 v0.13.0
hello-rust-build-1-build-pod build Downloaded indexmap v1.9.1
hello-rust-build-1-build-pod build Downloaded memchr v2.5.0
hello-rust-build-1-build-pod build Downloaded miniz_oxide v0.5.4
hello-rust-build-1-build-pod build Downloaded parking_lot v0.12.1
hello-rust-build-1-build-pod build Downloaded pin-project-lite v0.2.9
hello-rust-build-1-build-pod build Downloaded mime v0.3.16
hello-rust-build-1-build-pod build Downloaded rand v0.8.5
hello-rust-build-1-build-pod build Downloaded quote v1.0.21
hello-rust-build-1-build-pod build Downloaded ppv-lite86 v0.2.16
hello-rust-build-1-build-pod build Downloaded num_cpus v1.13.1
hello-rust-build-1-build-pod build Downloaded serde_urlencoded v0.7.1
hello-rust-build-1-build-pod build Downloaded scopeguard v1.1.0
hello-rust-build-1-build-pod build Downloaded rustc_version v0.4.0
hello-rust-build-1-build-pod build Downloaded h2 v0.3.14
hello-rust-build-1-build-pod build Downloaded tinyvec_macros v0.1.0
hello-rust-build-1-build-pod build Downloaded futures-util v0.3.24
hello-rust-build-1-build-pod build Downloaded actix-web-codegen v4.1.0
hello-rust-build-1-build-pod build Downloaded actix-web v4.2.1
hello-rust-build-1-build-pod build Downloaded alloc-no-stdlib v2.0.4
hello-rust-build-1-build-pod build Downloaded unicode-ident v1.0.3
hello-rust-build-1-build-pod build Downloaded signal-hook-registry v1.4.0
hello-rust-build-1-build-pod build Downloaded slab v0.4.7
hello-rust-build-1-build-pod build Downloaded tinyvec v1.6.0
hello-rust-build-1-build-pod build Downloaded zstd v0.11.2+zstd.1.5.2
hello-rust-build-1-build-pod build Downloaded typenum v1.15.0
hello-rust-build-1-build-pod build Downloaded block-buffer v0.10.3
hello-rust-build-1-build-pod build Downloaded url v2.3.1
hello-rust-build-1-build-pod build Downloaded autocfg v1.1.0
hello-rust-build-1-build-pod build Downloaded alloc-stdlib v0.2.2
hello-rust-build-1-build-pod build Downloaded derive_more v0.99.17
hello-rust-build-1-build-pod build Downloaded itoa v1.0.3
hello-rust-build-1-build-pod build Downloaded firestorm v0.5.1
hello-rust-build-1-build-pod build Downloaded cookie v0.16.0
hello-rust-build-1-build-pod build Downloaded encoding_rs v0.8.31
hello-rust-build-1-build-pod build Downloaded time v0.3.14
hello-rust-build-1-build-pod build Downloaded version_check v0.9.4
hello-rust-build-1-build-pod build Downloaded local-waker v0.1.3
hello-rust-build-1-build-pod build Downloaded unicode-normalization v0.1.21
hello-rust-build-1-build-pod build Downloaded semver v1.0.13
hello-rust-build-1-build-pod build Downloaded tracing-core v0.1.29
hello-rust-build-1-build-pod build Downloaded language-tags v0.3.2
hello-rust-build-1-build-pod build Downloaded regex v1.6.0
hello-rust-build-1-build-pod build Downloaded time-macros v0.2.4
hello-rust-build-1-build-pod build Downloaded syn v1.0.99
hello-rust-build-1-build-pod build Downloaded serde_json v1.0.85
hello-rust-build-1-build-pod build Downloaded lock_api v0.4.8
hello-rust-build-1-build-pod build Downloaded tokio v1.21.1
hello-rust-build-1-build-pod build Downloaded libc v0.2.132
hello-rust-build-1-build-pod build Downloaded smallvec v1.9.0
hello-rust-build-1-build-pod build Downloaded once_cell v1.14.0
hello-rust-build-1-build-pod build Downloaded actix-server v2.1.1
hello-rust-build-1-build-pod build Downloaded proc-macro2 v1.0.43
hello-rust-build-1-build-pod build Downloaded tracing v0.1.36
hello-rust-build-1-build-pod build Downloaded serde v1.0.144
hello-rust-build-1-build-pod build Downloaded actix-macros v0.2.3
hello-rust-build-1-build-pod build Downloaded brotli v3.3.4
hello-rust-build-1-build-pod build Downloaded sha1 v0.10.4
hello-rust-build-1-build-pod build Downloaded regex-syntax v0.6.27
hello-rust-build-1-build-pod build Downloaded actix-router v0.5.0
hello-rust-build-1-build-pod build Downloaded local-channel v0.1.3
hello-rust-build-1-build-pod build Downloaded jobserver v0.1.24
hello-rust-build-1-build-pod build Downloaded brotli-decompressor v2.3.2
hello-rust-build-1-build-pod build Downloaded httparse v1.8.0
hello-rust-build-1-build-pod build Downloaded actix-service v2.0.2
hello-rust-build-1-build-pod build Downloaded actix-rt v2.7.0
hello-rust-build-1-build-pod build Downloaded rand_core v0.6.3
hello-rust-build-1-build-pod build Downloaded unicode-bidi v0.3.8
hello-rust-build-1-build-pod build Downloaded socket2 v0.4.7
hello-rust-build-1-build-pod build Downloaded ryu v1.0.11
hello-rust-build-1-build-pod build Downloaded bytestring v1.1.0
hello-rust-build-1-build-pod build Downloaded actix-http v3.2.2
hello-rust-build-1-build-pod build Downloaded log v0.4.17
hello-rust-build-1-build-pod build Downloaded paste v1.0.9
hello-rust-build-1-build-pod build Downloaded parking_lot_core v0.9.3
hello-rust-build-1-build-pod build Downloaded mio v0.8.4
hello-rust-build-1-build-pod build Downloaded http v0.2.8
hello-rust-build-1-build-pod build Downloaded idna v0.3.0
hello-rust-build-1-build-pod build Downloaded hashbrown v0.12.3
hello-rust-build-1-build-pod build Downloaded getrandom v0.2.7
hello-rust-build-1-build-pod build Downloaded actix-utils v3.0.0
hello-rust-build-1-build-pod build Downloaded actix-codec v0.5.0
hello-rust-build-1-build-pod build Downloaded ahash v0.7.6
hello-rust-build-1-build-pod build Downloaded bytes v1.2.1
hello-rust-build-1-build-pod build Compiling libc v0.2.132
hello-rust-build-1-build-pod build Compiling cfg-if v1.0.0
hello-rust-build-1-build-pod build Compiling autocfg v1.1.0
hello-rust-build-1-build-pod build Compiling memchr v2.5.0
hello-rust-build-1-build-pod build Compiling log v0.4.17
hello-rust-build-1-build-pod build Compiling version_check v0.9.4
hello-rust-build-1-build-pod build Compiling pin-project-lite v0.2.9
hello-rust-build-1-build-pod build Compiling futures-core v0.3.24
hello-rust-build-1-build-pod build Compiling bytes v1.2.1
hello-rust-build-1-build-pod build Compiling once_cell v1.14.0
hello-rust-build-1-build-pod build Compiling parking_lot_core v0.9.3
hello-rust-build-1-build-pod build Compiling lock_api v0.4.8
hello-rust-build-1-build-pod build Compiling scopeguard v1.1.0
hello-rust-build-1-build-pod build Compiling serde v1.0.144
hello-rust-build-1-build-pod build Compiling smallvec v1.9.0
hello-rust-build-1-build-pod build Compiling tokio v1.21.1
hello-rust-build-1-build-pod build Compiling proc-macro2 v1.0.43
hello-rust-build-1-build-pod build Compiling typenum v1.15.0
hello-rust-build-1-build-pod build Compiling jobserver v0.1.24
hello-rust-build-1-build-pod build Compiling itoa v1.0.3
hello-rust-build-1-build-pod build Compiling mio v0.8.4
hello-rust-build-1-build-pod build Compiling socket2 v0.4.7
hello-rust-build-1-build-pod build Compiling cc v1.0.73
hello-rust-build-1-build-pod build Compiling parking_lot v0.12.1
hello-rust-build-1-build-pod build Compiling signal-hook-registry v1.4.0
hello-rust-build-1-build-pod build Compiling generic-array v0.14.6
hello-rust-build-1-build-pod build Compiling futures-task v0.3.24
hello-rust-build-1-build-pod build Compiling quote v1.0.21
hello-rust-build-1-build-pod build Compiling unicode-ident v1.0.3
hello-rust-build-1-build-pod build Compiling tracing-core v0.1.29
hello-rust-build-1-build-pod build Compiling zstd-sys v2.0.1+zstd.1.5.2
hello-rust-build-1-build-pod build Compiling syn v1.0.99
hello-rust-build-1-build-pod build Compiling futures-util v0.3.24
hello-rust-build-1-build-pod build Compiling tracing v0.1.36
hello-rust-build-1-build-pod build Compiling getrandom v0.2.7
hello-rust-build-1-build-pod build Compiling percent-encoding v2.2.0
hello-rust-build-1-build-pod build Compiling pin-utils v0.1.0
hello-rust-build-1-build-pod build Compiling futures-sink v0.3.24
hello-rust-build-1-build-pod build Compiling indexmap v1.9.1
hello-rust-build-1-build-pod build Compiling slab v0.4.7
hello-rust-build-1-build-pod build Compiling alloc-no-stdlib v2.0.4
hello-rust-build-1-build-pod build Compiling zstd-safe v5.0.2+zstd.1.5.2
hello-rust-build-1-build-pod build Compiling fnv v1.0.7
hello-rust-build-1-build-pod build Compiling crc32fast v1.3.2
hello-rust-build-1-build-pod build Compiling tinyvec_macros v0.1.0
hello-rust-build-1-build-pod build Compiling local-waker v0.1.3
hello-rust-build-1-build-pod build Compiling tinyvec v1.6.0
hello-rust-build-1-build-pod build Compiling http v0.2.8
hello-rust-build-1-build-pod build Compiling aho-corasick v0.7.19
hello-rust-build-1-build-pod build Compiling alloc-stdlib v0.2.2
hello-rust-build-1-build-pod build Compiling crypto-common v0.1.6
hello-rust-build-1-build-pod build Compiling block-buffer v0.10.3
hello-rust-build-1-build-pod build Compiling rand_core v0.6.3
hello-rust-build-1-build-pod build Compiling ahash v0.7.6
hello-rust-build-1-build-pod build Compiling encoding_rs v0.8.31
hello-rust-build-1-build-pod build Compiling tokio-util v0.7.4
hello-rust-build-1-build-pod build Compiling paste v1.0.9
hello-rust-build-1-build-pod build Compiling regex-syntax v0.6.27
hello-rust-build-1-build-pod build Compiling hashbrown v0.12.3
hello-rust-build-1-build-pod build Compiling httparse v1.8.0
hello-rust-build-1-build-pod build Compiling ppv-lite86 v0.2.16
hello-rust-build-1-build-pod build Compiling adler v1.0.2
hello-rust-build-1-build-pod build Compiling rand_chacha v0.3.1
hello-rust-build-1-build-pod build Compiling miniz_oxide v0.5.4
hello-rust-build-1-build-pod build Compiling actix-service v2.0.2
hello-rust-build-1-build-pod build Compiling regex v1.6.0
hello-rust-build-1-build-pod build Compiling actix-rt v2.7.0
hello-rust-build-1-build-pod build Compiling unicode-normalization v0.1.21
hello-rust-build-1-build-pod build Compiling digest v0.10.3
hello-rust-build-1-build-pod build Compiling brotli-decompressor v2.3.2
hello-rust-build-1-build-pod build Compiling bytestring v1.1.0
hello-rust-build-1-build-pod build Compiling actix-utils v3.0.0
hello-rust-build-1-build-pod build Compiling form_urlencoded v1.1.0
hello-rust-build-1-build-pod build Compiling cookie v0.16.0
hello-rust-build-1-build-pod build Compiling num_threads v0.1.6
hello-rust-build-1-build-pod build Compiling bitflags v1.3.2
hello-rust-build-1-build-pod build Compiling firestorm v0.5.1
hello-rust-build-1-build-pod build Compiling convert_case v0.4.0
hello-rust-build-1-build-pod build Compiling serde_json v1.0.85
hello-rust-build-1-build-pod build Compiling cpufeatures v0.2.5
hello-rust-build-1-build-pod build Compiling unicode-bidi v0.3.8
hello-rust-build-1-build-pod build Compiling time-macros v0.2.4
hello-rust-build-1-build-pod build Compiling ryu v1.0.11
hello-rust-build-1-build-pod build Compiling actix-router v0.5.0
hello-rust-build-1-build-pod build Compiling idna v0.3.0
hello-rust-build-1-build-pod build Compiling time v0.3.14
hello-rust-build-1-build-pod build Compiling sha1 v0.10.4
hello-rust-build-1-build-pod build Compiling derive_more v0.99.17
hello-rust-build-1-build-pod build Compiling actix-codec v0.5.0
hello-rust-build-1-build-pod build Compiling brotli v3.3.4
hello-rust-build-1-build-pod build Compiling h2 v0.3.14
hello-rust-build-1-build-pod build Compiling flate2 v1.0.24
hello-rust-build-1-build-pod build Compiling rand v0.8.5
hello-rust-build-1-build-pod build Compiling local-channel v0.1.3
hello-rust-build-1-build-pod build Compiling num_cpus v1.13.1
hello-rust-build-1-build-pod build Compiling httpdate v1.0.2
hello-rust-build-1-build-pod build Compiling language-tags v0.3.2
hello-rust-build-1-build-pod build Compiling base64 v0.13.0
hello-rust-build-1-build-pod build Compiling mime v0.3.16
hello-rust-build-1-build-pod build Compiling actix-server v2.1.1
hello-rust-build-1-build-pod build Compiling actix-web-codegen v4.1.0
hello-rust-build-1-build-pod build Compiling url v2.3.1
hello-rust-build-1-build-pod build Compiling serde_urlencoded v0.7.1
hello-rust-build-1-build-pod build Compiling actix-macros v0.2.3
hello-rust-build-1-build-pod build Compiling zstd v0.11.2+zstd.1.5.2
hello-rust-build-1-build-pod build Compiling actix-http v3.2.2
hello-rust-build-1-build-pod build Compiling actix-web v4.2.1
hello-rust-build-1-build-pod build Compiling hello-rust v0.1.0 (/workspace)
hello-rust-build-1-build-pod build Finished release [optimized] target(s) in 2m 54s
hello-rust-build-1-build-pod build Installing /layers/paketo-community_cargo/Cargo/bin/hello-rust
hello-rust-build-1-build-pod build Installed package `hello-rust v0.1.0 (/workspace)` (executable `hello-rust`)
hello-rust-build-1-build-pod build Removing source code
- hello-rust-build-1-build-pod › build
+ hello-rust-build-1-build-pod › export
hello-rust-build-1-build-pod export Reusing layers from image 'ghcr.io/making/workloads/hello-rust-demo@sha256:38a87bb6a3aed03498e0537b704c7a0f1bcb976243ea11214fb92822bc1efd2a'
hello-rust-build-1-build-pod export Adding layer 'paketo-community/cargo:Cargo'
hello-rust-build-1-build-pod export Reusing layer 'paketo-community/cargo:tini'
hello-rust-build-1-build-pod export Reusing layer 'launch.sbom'
hello-rust-build-1-build-pod export Reusing 1/1 app layer(s)
hello-rust-build-1-build-pod export Reusing layer 'launcher'
hello-rust-build-1-build-pod export Reusing layer 'config'
hello-rust-build-1-build-pod export Reusing layer 'process-types'
hello-rust-build-1-build-pod export Adding label 'io.buildpacks.lifecycle.metadata'
hello-rust-build-1-build-pod export Adding label 'io.buildpacks.build.metadata'
hello-rust-build-1-build-pod export Adding label 'io.buildpacks.project.metadata'
hello-rust-build-1-build-pod export Setting default process type 'hello-rust'
hello-rust-build-1-build-pod export Saving ghcr.io/making/workloads/hello-rust-demo...
hello-rust-build-1-build-pod export *** Images (sha256:b251f64189e62869ea5fbe5808cfefe9d797367f376d80263f6826a270222782):
hello-rust-build-1-build-pod export ghcr.io/making/workloads/hello-rust-demo
hello-rust-build-1-build-pod export ghcr.io/making/workloads/hello-rust-demo:b1.20221219.062355
hello-rust-build-1-build-pod export Adding cache layer 'paketo-community/rustup:Cargo'
hello-rust-build-1-build-pod export Adding cache layer 'paketo-community/rustup:Rust'
hello-rust-build-1-build-pod export Adding cache layer 'paketo-community/rustup:Rustup'
hello-rust-build-1-build-pod export Adding cache layer 'paketo-community/rustup:rustup-init-gnu'
hello-rust-build-1-build-pod export Adding cache layer 'paketo-buildpacks/syft:syft'
hello-rust-build-1-build-pod export Adding cache layer 'paketo-community/cargo:Cargo'
hello-rust-build-1-build-pod export Adding cache layer 'paketo-community/cargo:Cargo Cache'
hello-rust-build-1-build-pod export Adding cache layer 'cache.sbom'
- hello-rust-build-1-build-pod › export
+ hello-rust-build-1-build-pod › completion
hello-rust-build-1-build-pod completion Build successful
- hello-rust-build-1-build-pod › completion
+ hello-rust-config-writer-r4tw5-pod › prepare
hello-rust-config-writer-r4tw5-pod prepare 2022/12/19 06:28:14 Entrypoint initialization
- hello-rust-config-writer-r4tw5-pod › prepare
+ hello-rust-config-writer-r4tw5-pod › step-main
hello-rust-config-writer-r4tw5-pod step-main ++ mktemp -d
...
hello-rust-config-writer-r4tw5-pod step-main + imgpkg_params=--registry-ca-cert-path=/tmp/tmp.HmlLb1KIOh/cert
hello-rust-config-writer-r4tw5-pod step-main + export IMGPKG_ENABLE_IAAS_AUTH=false
hello-rust-config-writer-r4tw5-pod step-main + IMGPKG_ENABLE_IAAS_AUTH=false
hello-rust-config-writer-r4tw5-pod step-main + imgpkg push --registry-ca-cert-path=/tmp/tmp.HmlLb1KIOh/cert -b ghcr.io/making/workloads/hello-rust-demo-bundle:d3a8618b-54e8-4f23-9357-68c5a111b6cc -f .
hello-rust-config-writer-r4tw5-pod step-main IMGPKG_ENABLE_IAAS_AUTH environment variable will be deprecated, please use the flag --activate-keychain to activate the needed keychains
- hello-rust-config-writer-r4tw5-pod › step-main
+ hello-rust-00001-deployment-6769b5dc68-ss798 › workload
+ hello-rust-00001-deployment-6769b5dc68-ss798 › queue-proxy
hello-rust-00001-deployment-6769b5dc68-ss798 queue-proxy {"severity":"INFO","timestamp":"2022-12-19T06:29:11.3248992Z","logger":"queueproxy","caller":"queue/main.go:197","message":"Starting queue-proxy","commit":"3666ce7","knative.dev/key":"demo/hello-rust-00001","knative.dev/pod":"hello-rust-00001-deployment-6769b5dc68-ss798"}
hello-rust-00001-deployment-6769b5dc68-ss798 queue-proxy {"severity":"INFO","timestamp":"2022-12-19T06:30:12.067173Z","logger":"queueproxy","caller":"queue/main.go:402","message":"Attached drain handler from user-container","commit":"3666ce7","knative.dev/key":"demo/hello-rust-00001","knative.dev/pod":"hello-rust-00001-deployment-6769b5dc68-ss798"}
次のコマンドでデプロイされたアプリを確認します。
$ tanzu apps workload get -n demo hello-rust
📡 Overview
name: hello-rust
type: web
💾 Source
type: git
url: https://github.com/making/hello-rust
branch: main
📦 Supply Chain
name: source-to-url
RESOURCE READY HEALTHY TIME OUTPUT
source-provider True True 11m GitRepository/hello-rust
image-provider True True 7m50s Image/hello-rust
config-provider True True 7m43s PodIntent/hello-rust
app-config True True 7m43s ConfigMap/hello-rust
service-bindings True True 7m43s ConfigMap/hello-rust-with-claims
api-descriptors True True 7m43s ConfigMap/hello-rust-with-api-descriptors
config-writer True True 7m28s Runnable/hello-rust-config-writer
🚚 Delivery
name: delivery-basic
RESOURCE READY HEALTHY TIME OUTPUT
source-provider True True 6m49s ImageRepository/hello-rust-delivery
deployer True True 6m47s App/hello-rust
💬 Messages
No messages found.
🛶 Pods
NAME READY STATUS RESTARTS AGE
hello-rust-build-1-build-pod 0/1 Completed 0 11m
hello-rust-config-writer-r4tw5-pod 0/1 Completed 0 7m41s
🚢 Knative Services
NAME READY URL
hello-rust Ready https://hello-rust-demo.127-0-0-1.sslip.io
To see logs: "tanzu apps workload tail hello-rust --namespace demo"
アプリにアクセスします。
$ curl -k https://hello-rust-demo.127-0-0-1.sslip.io
Hello world!
$ curl -k https://hello-rust-demo.127-0-0-1.sslip.io/echo -d 'Hello'
Hello
$ curl -k https://hello-rust-demo.127-0-0-1.sslip.io/hey
Hey there!
full dependenciesを使用している場合
full dependenciesのインストール方法はこちらの記事を参照してください。
次のoverlayファイルを作成します。
cat <<EOF > full-tbs-deps-add-rust-builder.yaml
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.subset({"metadata":{"name":"dependency-updater"}, "kind": "TanzuNetDependencyUpdater"})
---
spec:
inlineDescriptor:
clusterStores:
#@overlay/match by="name", missing_ok=True
- name: default
sources:
#@overlay/append
- image: docker.io/paketocommunity/rust:0.21.0
clusterBuilders:
#@overlay/match by="name", missing_ok=True
- name: base
order:
#@overlay/append
- group:
- id: paketo-community/rust
#@overlay/match by="name", missing_ok=True
- name: full
order:
#@overlay/append
- group:
- id: paketo-community/rust
#@overlay/match by="name", missing_ok=True
- name: tiny
order:
#@overlay/append
- group:
- id: paketo-community/rust
#@overlay/match by="name", missing_ok=True
- name: base-jammy
order:
#@overlay/append
- group:
- id: paketo-community/rust
#@overlay/match by="name", missing_ok=True
- name: full-jammy
order:
#@overlay/append
- group:
- id: paketo-community/rust
#@overlay/match by="name", missing_ok=True
- name: tiny-jammy
order:
#@overlay/append
- group:
- id: paketo-community/rust
EOF
次のコマンドでoverlayファイルのSecretを作成します。
kubectl -n tap-install create secret generic full-tbs-deps-add-rust-builder \
-o yaml \
--dry-run=client \
--from-file=full-tbs-deps-add-rust-builder.yaml \
| kubectl apply -f-
次のコマンドでoverlayを適用します。
kubectl -n tap-install annotate packageinstalls full-tbs-deps ext.packaging.carvel.dev/ytt-paths-from-secret-name.0=full-tbs-deps-add-rust-builder --overwrite=true
あとはlite dependencies同様です。