4.9. Operator SDK CLI リファレンス
以下では、Operator SDK CLI コマンドおよびそれらの構文について説明します。
$ operator-sdk <command> [<subcommand>] [<argument>] [<flags>]
4.9.1. build
operator-sdk build
コマンドはコードをコンパイルし、実行可能プロジェクトをビルドします。build
が完了すると、イメージはローカルコンテナーエンジンを使用してビルドされます。これは次にリモートレジストリーにプッシュされる必要があります。
引数 | 説明 |
---|---|
|
ビルドされるコンテナーイメージ (例: |
フラグ | 説明 |
---|---|
| テストバイナリーをイメージに追加することにより、クラスター内でのテストを有効にします。 |
|
テスト用の namespace を使用したリソースマニフェストのパス。デフォルト: |
|
テストの場所。デフォルト: |
| 使用方法についてのヘルプの出力。 |
--enable-tests
が設定される場合、build
コマンドはテストバイナリーもビルドし、これをコンテナーイメージに追加して、ユーザーがテストをクラスター上で Pod として実行できるように deploy/test-pod.yaml
ファイルを生成します。
以下は例になります。
$ operator-sdk build quay.io/example/operator:v0.0.1
出力例
building example-operator... building container quay.io/example/operator:v0.0.1... Sending build context to Docker daemon 163.9MB Step 1/4 : FROM alpine:3.6 ---> 77144d8c6bdc Step 2/4 : ADD tmp/_output/bin/example-operator /usr/local/bin/example-operator ---> 2ada0d6ca93c Step 3/4 : RUN adduser -D example-operator ---> Running in 34b4bb507c14 Removing intermediate container 34b4bb507c14 ---> c671ec1cff03 Step 4/4 : USER example-operator ---> Running in bd336926317c Removing intermediate container bd336926317c ---> d6b58a0fcb8c Successfully built d6b58a0fcb8c Successfully tagged quay.io/example/operator:v0.0.1