2.4.13. カスタムアドオンの作成
カスタムアドオンを作成するには、ディレクトリーを作成し、そのディレクトリーに、拡張子 .addon で少なくとも 1 つのテキストファイルを作成する必要があります (例: admin-role.addon)。
このファイルには、アドオンの一部として実行するコマンドと、Name および Description メタデータフィールドが含まれている必要があります。
以下の例は、開発者ユーザーに cluster-admin 権限を付与するアドオンの定義を示しています。
例: admin-role のアドオン定義
Name: admin-role Description: Gives the developer user cluster-admin privileges
# Name: admin-role
# Description: Gives the developer user cluster-admin privileges
oc adm policy add-role-to-user cluster-admin developer
アドオンを定義したら、以下を実行してインストールできます。
minishift addons install <ADDON_DIR_PATH>
$ minishift addons install <ADDON_DIR_PATH>
複数の行でメタデータを作成することもできます。
例: 複数行の説明が含まれるアドオン定義
Name: prometheus Description: This template creates a Prometheus instance preconfigured to gather OpenShift and Kubernetes platform and node metrics and report them to admins. It is protected by an OAuth proxy that only allows access for users who have view access to the prometheus namespace. You may customize where the images (built from openshift/prometheus and openshift/oauth-proxy) are pulled from via template parameters. Url: https://prometheus.io/
# Name: prometheus
# Description: This template creates a Prometheus instance preconfigured to gather OpenShift and
# Kubernetes platform and node metrics and report them to admins. It is protected by an
# OAuth proxy that only allows access for users who have view access to the prometheus
# namespace. You may customize where the images (built from openshift/prometheus
# and openshift/oauth-proxy) are pulled from via template parameters.
# Url: https://prometheus.io/
CDK アドオンインストールディレクトリー $MINISHIFT_HOME/addons で、アドオンを直接編集することもできます。アドオンにエラーがある場合は、addons
コマンドの実行時には表示されませんが、これは minishift start
プロセス中は適用されないことに注意してください。
アドオンの削除手順を提供するには、拡張子 .addon.remove でテキストファイルを作成できます (例: admin-user.addon.remove)。.addon ファイルと同様に、Name および Description メタデータフィールドが必要です。.addon.remove ファイルが存在する場合は、remove
コマンドで適用できます。