2.12. odo CLI リファレンス

2.12.1. 基本的な odo CLI コマンド

2.12.1.1. app

OpenShift Container Platform プロジェクトに関連するアプリケーション操作を実行します。

app の使用例

  # Delete the application
  odo app delete myapp

  # Describe 'webapp' application,
  odo app describe webapp

  # List all applications in the current project
  odo app list

  # List all applications in the specified project
  odo app list --project myproject

2.12.1.2. catalog

カタログ関連の操作を実行します。

catalog の使用例

  # Get the supported components
  odo catalog list components

  # Get the supported services from service catalog
  odo catalog list services

  # Search for a component
  odo catalog search component python

  # Search for a service
  odo catalog search service mysql

  # Describe a service
  odo catalog describe service mysql-persistent

2.12.1.3. component

アプリケーションのコンポーネントを管理します。

component の使用例

# Create a new component
odo component create

# Create a local configuration and create all objects on the cluster
odo component create --now

2.12.1.4. config

config ファイル内で odo 固有の設定を変更します。

config の使用例

  # For viewing the current local configuration
  odo config view

  # Set a configuration value in the local configuration
  odo config set Type java
  odo config set Name test
  odo config set MinMemory 50M
  odo config set MaxMemory 500M
  odo config set Memory 250M
  odo config set Ignore false
  odo config set MinCPU 0.5
  odo config set MaxCPU 2
  odo config set CPU 1

  # Set an environment variable in the local configuration
  odo config set --env KAFKA_HOST=kafka --env KAFKA_PORT=6639

  # Create a local configuration and apply the changes to the cluster
  odo config set --now

  # Unset a configuration value in the local config
  odo config unset Type
  odo config unset Name
  odo config unset MinMemory
  odo config unset MaxMemory
  odo config unset Memory
  odo config unset Ignore
  odo config unset MinCPU
  odo config unset MaxCPU
  odo config unset CPU

  # Unset an env variable in the local config
  odo config unset --env KAFKA_HOST --env KAFKA_PORT

Application

Application は、コンポーネントを含める必要のあるアプリケーションの名前になります。

CPU

コンポーネントが使用できる CPU の最小数と最大数

Ignore

プッシュと監視に関連して .odoignore ファイルを考慮します。

表2.2 利用可能なローカルパラメーター:

Application

コンポーネントを含める必要のあるアプリケーションの名前

CPU

コンポーネントが使用できる CPU の最小数と最大数

Ignore

プッシュおよび監視に関連して .odoignore ファイルを考慮するかどうか

MaxCPU

コンポーネントで使用可能な最大 CPU

MaxMemory

コンポーネントで使用可能な最大メモリー

Memory

コンポーネントで使用できる最小および最大メモリー

MinCPU

コンポーネントで使用できる最小 CPU

MinMemory

コンポーネントに指定される最小メモリー

Name

コンポーネントの名前

Ports

コンポーネントで開くポート

Project

コンポーネントを含めるプロジェクトの名前

Ref

git ソースからコンポーネントを作成するために使用する Git ref

SourceLocation

パスはバイナリーファイルまたは git ソースの場所を示します。

SourceType

コンポーネントソースのタイプ: git/binary/local

Storage

コンポーネントのストレージ

Type

コンポーネントのタイプ

Url

コンポーネントにアクセスするために使用する URL

2.12.1.5. create

OpenShift Container Platform にデプロイするコンポーネントを記述する設定を作成します。コンポーネント名が指定されていない場合、これは自動的に生成されます。

デフォルトで、ビルダーイメージは現在の namespace から使用されます。namespace を明示的に指定するには、odo create namespace/name:version を使用します。バージョンが指定されていない場合、デフォルトは latestに設定されます。

odo catalog list を使用してデプロイできるコンポーネントタイプの詳細一覧を表示します。

create の使用例

  # Create new Node.js component with the source in current directory.
  odo create nodejs

  # A specific image version may also be specified
  odo create nodejs:latest

  # Create new Node.js component named 'frontend' with the source in './frontend' directory
  odo create nodejs frontend --context ./frontend

  # Create a new Node.js component of version 6 from the 'openshift' namespace
  odo create openshift/nodejs:6 --context /nodejs-ex

  # Create new Wildfly component with binary named sample.war in './downloads' directory
  odo create wildfly wildfly --binary ./downloads/sample.war

  # Create new Node.js component with source from remote git repository
  odo create nodejs --git https://github.com/openshift/nodejs-ex.git

  # Create new Node.js git component while specifying a branch, tag or commit ref
  odo create nodejs --git https://github.com/openshift/nodejs-ex.git --ref master

  # Create new Node.js git component while specifying a tag
  odo create nodejs --git https://github.com/openshift/nodejs-ex.git --ref v1.0.1

  # Create new Node.js component with the source in current directory and ports 8080-tcp,8100-tcp and 9100-udp exposed
  odo create nodejs --port 8080,8100/tcp,9100/udp

  # Create new Node.js component with the source in current directory and env variables key=value and key1=value1 exposed
  odo create nodejs --env key=value,key1=value1

  # For more examples, visit: https://github.com/openshift/odo/blob/master/docs/examples.adoc
  odo create python --git https://github.com/openshift/django-ex.git

  # Passing memory limits
  odo create nodejs --memory 150Mi
  odo create nodejs --min-memory 150Mi --max-memory 300 Mi

  # Passing cpu limits
  odo create nodejs --cpu 2
  odo create nodejs --min-cpu 200m --max-cpu 2

2.12.1.6. delete

既存のコンポーネントを削除します。

delete の使用例

  # Delete component named 'frontend'.
  odo delete frontend
  odo delete frontend --all

2.12.1.7. describe

指定のコンポーネントについて説明します。

describe の使用例

  # Describe nodejs component
  odo describe nodejs

2.12.1.9. list

現在のアプリケーションのすべてのコンポーネントを一覧表示します。

list の使用例

  # List all components in the application
  odo list

2.12.1.10. log

指定のコンポーネントのログを取得します。

log の使用例

  # Get the logs for the nodejs component
  odo log nodejs

2.12.1.11. login

クラスターにログインします。

login の使用例

  # Log in interactively
  odo login

  # Log in to the given server with the given certificate authority file
  odo login localhost:8443 --certificate-authority=/path/to/cert.crt

  # Log in to the given server with the given credentials (basic auth)
  odo login localhost:8443 --username=myuser --password=mypass

  # Log in to the given server with the given credentials (token)
  odo login localhost:8443 --token=xxxxxxxxxxxxxxxxxxxxxxx

2.12.1.12. logout

現在の OpenShift Container Platform セッションからログアウトします。

logout の使用例

  # Log out
  odo logout

2.12.1.13. preference

グローバル設定ファイル内の odo 固有の設定内容を変更します。

preference の使用例

  # For viewing the current preferences
  odo preference view

  # Set a preference value in the global preference
  odo preference set UpdateNotification false
  odo preference set NamePrefix "app"
  odo preference set Timeout 20

  # Unset a preference value in the global preference
  odo preference unset  UpdateNotification
  odo preference unset  NamePrefix
  odo preference unset  Timeout

注記

デフォルトで、グローバル設定ファイルへのパスは ~/.odo/preferece.yaml であり、これは環境変数 GLOBALODOCONFIG に保存されます。環境変数の値を新規の設定パスに設定し、カスタムパスをセットアップできます (例: GLOBALODOCONFIG="new_path/preference.yaml")。

表2.3 利用可能なパラメーター:

NamePrefix

デフォルトのプレフィックスは、現在のディレクトリー名です。この値を使用して、デフォルトの名前のプレフィックスを設定します。

Timeout

OpenShift Container Platform サーバー接続チェックのタイムアウト (秒単位) です。

UpdateNotification

更新通知が表示されるかどうかを制御します。

2.12.1.14. project

プロジェクト操作を実行します。

project の使用例

  # Set the active project
  odo project set

  # Create a new project
  odo project create myproject

  # List all the projects
  odo project list

  # Delete a project
  odo project delete myproject

  # Get the active project
  odo project get

2.12.1.15. push

ソースコードをコンポーネントにプッシュします。

push の使用例

  # Push source code to the current component
  odo push

  # Push data to the current component from the original source.
  odo push

  # Push source code in ~/mycode to component called my-component
  odo push my-component --context ~/mycode

2.12.1.16. service

サービスカタログ操作を実行します。

service の使用例

  # Create new postgresql service from service catalog using dev plan and name my-postgresql-db.
  odo service create dh-postgresql-apb my-postgresql-db --plan dev -p postgresql_user=luke -p postgresql_password=secret

  # Delete the service named 'mysql-persistent'
  odo service delete mysql-persistent

  # List all services in the application
  odo service list

2.12.1.17. storage

ストレージ操作を実行します。

storage の使用例

  # Create storage of size 1Gb to a component
  odo storage create mystorage --path=/opt/app-root/src/storage/ --size=1Gi
  # Delete storage mystorage from the currently active component
  odo storage delete mystorage

  # Delete storage mystorage from component 'mongodb'
  odo storage delete mystorage --component mongodb
  # List all storage attached or mounted to the current component and
  # all unattached or unmounted storage in the current application
  odo storage list

2.12.1.19. update

コンポーネントのソースコードパスを更新します。

update の使用例

  # Change the source code path of a currently active component to local (use the current directory as a source)
  odo update --local

  # Change the source code path of the frontend component to local with source in ./frontend directory
  odo update frontend --local ./frontend

  # Change the source code path of a currently active component to git
  odo update --git https://github.com/openshift/nodejs-ex.git

  # Change the source code path of the component named node-ex to git
  odo update node-ex --git https://github.com/openshift/nodejs-ex.git

  # Change the source code path of the component named wildfly to a binary named sample.war in ./downloads directory
  odo update wildfly --binary ./downloads/sample.war

2.12.1.20. url

コンポーネントを外部に公開します。

url の使用例

  # Create a URL for the current component with a specific port
  odo url create --port 8080

  # Create a URL with a specific name and port
  odo url create example --port 8080

  # Create a URL with a specific name by automatic detection of port (only for components which expose only one service port)
  odo url create example

  # Create a URL with a specific name and port for component frontend
  odo url create example --port 8080 --component frontend

  # Delete a URL to a component
  odo url delete myurl

  # List the available URLs
  odo url list

  # Create a URL in the configuration and apply the changes to the cluster
  odo url create --now

このコマンドを使用して生成される URL は、クラスター外からデプロイされたコンポーネントにアクセスするために使用できます。

2.12.1.21. utils

ターミナルコマンドのユーティリティーおよび odo 設定の変更

utils の使用例

  # Bash terminal PS1 support
  source <(odo utils terminal bash)

  # Zsh terminal PS1 support
  source <(odo utils terminal zsh)

2.12.1.22. version

クライアントバージョンの情報を出力します。

version の使用例

  # Print the client version of odo
  odo version

2.12.1.23. watch

odo は変更の有無の監視を開始し、変更時にコンポーネントを自動的に更新します。

watch の使用例

  # Watch for changes in directory for current component
  odo watch

  # Watch for changes in directory for component called frontend
  odo watch frontend