26.2. Helm chart-verifier ツールの実行
chart-verifier ツールを実行するための推奨ディレクトリー構造は次のとおりです。
.
└── src
├── Chart.yaml
├── README.md
├── templates
│ ├── deployment.yaml
│ ├── _helpers.tpl
│ ├── hpa.yaml
│ ├── ingress.yaml
│ ├── NOTES.txt
│ ├── serviceaccount.yaml
│ ├── service.yaml
│ └── tests
│ └── test-connection.yaml
├── values.schema.json
└── values.yaml
前提条件
- Podman または Docker CLI がインストールされているコンテナーエンジン
- イメージが Red Hat 認定されていることを確認するためのインターネット接続
- OpenShift Helm チャートリポジトリー にチャートを送信するための GitHub プロファイル
- Red Hat OpenShift Container Platform クラスター
chart-verifier ツールを実行する前に、以下のコマンドを使用して Helm チャートをパッケージ化
$ helm package <helmchart folder>このコマンドは、Helm チャートをアーカイブし、
.tgzファイル形式に変換します。
手順
次の 2 つの方法を使用して、chart-verifier ツールの完全なセットを実行できます。
26.2.1. Podman または Docker を使用する方法 リンクのコピーリンクがクリップボードにコピーされました!
kube config ファイルが
${HOME}/.kube:ロケーションにあると仮定し、ユニバーサルリソース識別子 (uri) を使用して、リモートで利用可能なチャートに対して利用可能なすべてのチェックを実行します。$ podman run --rm -i \ -e KUBECONFIG=/.kube/config \ -v "${HOME}/.kube":/.kube \ "quay.io/redhat-certification/chart-verifier" \ verify \ <chart-uri>このコマンドの chart-uri は、https uri で利用可能なチャートアーカイブの場所です。アーカイブが
.tgz形式である必要があることを確認してください。チャートが現在のディレクトリーで利用可能であり、kube config ファイルが
${HOME}/.kubeロケーションで利用可能であると仮定して、システム上でローカルに利用可能なチャートに対して利用可能なチェックをすべて実行します。$ podman run --rm \ -e KUBECONFIG=/.kube/config \ -v "${HOME}/.kube":/.kube \ -v $(pwd):/charts \ "quay.io/redhat-certification/chart-verifier" \ verify \ /charts/<chart>このコマンドの chart-uri は、ローカルディレクトリーで利用可能なチャートアーカイブの場所です。アーカイブが
.tgz形式である必要があることを確認してください。次の verify コマンドを実行して、コマンドに関連付けられている使用可能なオプションのリストとその使用方法を取得します。
$ podman run -it --rm quay.io/redhat-certification/chart-verifier verify --helpコマンドの出力は次の例のようになります。
Verifies a Helm chart by checking some of its characteristics Usage: chart-verifier verify <chart-uri> [flags] Flags: -S, --chart-set strings set values for the chart (can specify multiple or separate values with commas: key1=val1,key2=val2) -G, --chart-set-file strings set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) -X, --chart-set-string strings set STRING values for the chart (can specify multiple or separate values with commas: key1=val1,key2=val2) -F, --chart-values strings specify values in a YAML file or a URL (can specify multiple) --debug enable verbose output -x, --disable strings all checks will be enabled except the informed ones -e, --enable strings only the informed checks will be enabled --helm-install-timeout duration helm install timeout (default 5m0s) -h, --help help for verify --kube-apiserver string the address and the port for the Kubernetes API server --kube-as-group stringArray group to impersonate for the operation, this flag can be repeated to specify multiple groups. --kube-as-user string username to impersonate for the operation --kube-ca-file string the certificate authority file for the Kubernetes API server connection --kube-context string name of the kubeconfig context to use --kube-token string bearer token used for authentication --kubeconfig string path to the kubeconfig file -n, --namespace string namespace scope for this request -V, --openshift-version string set the value of certifiedOpenShiftVersions in the report -o, --output string the output format: default, json or yaml -k, --pgp-public-key string file containing gpg public key of the key used to sign the chart -W, --web-catalog-only set this to indicate that the distribution method is web catalog only (default: true) --registry-config string path to the registry config file (default "/home/baiju/.config/helm/registry.json") --repository-cache string path to the file containing cached repository indexes (default "/home/baiju/.cache/helm/repository") --repository-config string path to the file containing repository names and URLs (default "/home/baiju/.config/helm/repositories.yaml") -s, --set strings overrides a configuration, e.g: dummy.ok=false -f, --set-values strings specify application and check configuration values in a YAML file or a URL (can specify multiple) -E, --suppress-error-log suppress the error log (default: written to ./chartverifier/verifier-<timestamp>.log) --timeout duration time to wait for completion of chart install and test (default 30m0s) -w, --write-to-file write report to ./chartverifier/report.yaml (default: stdout) Global Flags: --config string config file (default is $HOME/.chart-verifier.yaml)チェックのサブセットを実行します。
$ podman run --rm -i \ -e KUBECONFIG=/.kube/config \ -v "${HOME}/.kube":/.kube \ "quay.io/redhat-certification/chart-verifier" \ verify -enable images-are-certified,helm-lint \ <chart-uri>サブセットを除くすべてのチェックを実行します。
$ podman run --rm -i \ -e KUBECONFIG=/.kube/config \ -v "${HOME}/.kube":/.kube \ "quay.io/redhat-certification/chart-verifier" \ verify -disable images-are-certified,helm-lint \ <chart-uri>注記チェックのサブセットを実行することは、開発のフィードバックループを減らすことを目的としています。チャートを認定するには、必要なチェックをすべて実行する必要があります。
chart-override 値を指定します。
$ podman run --rm -i \ -e KUBECONFIG=/.kube/config \ -v "${HOME}/.kube":/.kube \ "quay.io/redhat-certification/chart-verifier" \ verify –chart-set default.port=8080 \ <chart-uri>現在のディレクトリーにあるファイルから chart-override 値を指定します。
$ podman run --rm -i \ -e KUBECONFIG=/.kube/config \ -v "${HOME}/.kube":/.kube \ -v $(pwd):/values \ "quay.io/redhat-certification/chart-verifier" \ verify –chart-values /values/overrides.yaml \ <chart-uri>
26.2.1.1. タイムアウトオプションの設定 リンクのコピーリンクがクリップボードにコピーされました!
chart-testing プロセスが遅延する場合は、タイムアウト値を増やします。デフォルトでは、chart-testing プロセスが完了するまでに約 30 分かかります。
$ podman run --rm -i \
-e KUBECONFIG=/.kube/config \
-v "${HOME}/.kube":/.kube \
-v $(pwd):/values \
"quay.io/redhat-certification/chart-verifier" \
verify --timeout 40m \
<chart-uri>
chart-testing プロセスに遅れが見られる場合は、Red Hat では、検証のためにレポートを Red Hat 認定チームに提出することを推奨しています。
26.2.1.2. レポートの保存 リンクのコピーリンクがクリップボードにコピーされました!
chart-testing プロセスが完了すると、デフォルトでレポートメッセージが表示されます。レポートは、ファイルにリダイレクトすることで保存できます。
以下に例を示します。
$ podman run --rm -i \
-e KUBECONFIG=/.kube/config \
-v "${HOME}/.kube":/.kube \
"quay.io/redhat-certification/chart-verifier" \
verify –enable images-are-certified,helm-lint \
<chart-uri> > report.yaml
このコマンドとともに -w オプションを使用して、レポートを ./chartverifier/report.yaml ファイルに直接書き込みます。このファイルを取得するには、ファイルを /app/chartverifer にボリュームマウントする必要があります。
以下に例を示します。
$ podman run --rm -i \
-e KUBECONFIG=/.kube/config \
-v "${HOME}/.kube":/.kube \
-v $(pwd)/chartverifier:/app/chartverifier \
-w \
"quay.io/redhat-certification/chart-verifier" \
verify –enable images-are-certified,helm-lint \
<chart-uri>
ファイルがすでに存在する場合は、新しいレポートによって上書きされます。
26.2.1.3. エラーログの設定 リンクのコピーリンクがクリップボードにコピーされました!
デフォルトでは、エラーログが生成され、./chartverifier/verify-<timestamp>.yaml ファイルに保存されます。これには、エラーメッセージ、各チェックの結果、チャートテストに関する追加情報が含まれます。エラーログのコピーを取得するには、ファイルを /app/chartverifer にボリュームマウントする必要があります。
以下に例を示します。
$ podman run --rm -i \
-e KUBECONFIG=/.kube/config \
-v "${HOME}/.kube":/.kube \
-v $(pwd)/chartverifier:/app/chartverifier \
"quay.io/redhat-certification/chart-verifier" \
verify –enable images-are-certified,helm-lint \
<chart-uri> > report.yaml
複数のログを同じディレクトリーに保存する場合は、一度に最大 10 個のログファイルを保存できます。ファイルの最大制限に達すると、古いログファイルが新しいログファイルに自動的に置き換えられます。
エラーログ出力を抑制するには、-E または –suppress-error-log オプションを使用します。
エラーおよび警告メッセージは標準エラー出力メッセージであり、-E または –suppress-error-log オプションを使用しても抑制されません。
26.2.2. バイナリーファイルを使用する場合 リンクのコピーリンクがクリップボードにコピーされました!
この方法は Linux システムにのみ適用できます。
- リリース ページから最新の chart-verifier バイナリーをダウンロードしてインストールします。
次のコマンドを使用して、tarball バイナリーを展開します。
$ tar zxvf <tarball>展開したディレクトリーで次のコマンドを実行して、すべての Helm チャートチェックを実行します。
$ ./chart-verifier verify <chart-uri>このコマンドでは、
chart-uriはサーバー上で利用可能なチャートアーカイブの場所です。アーカイブが.tgz形式である必要があることを確認してください。デフォルトでは、chart-verifier ツールは、kube config ファイルがデフォルトの$HOME/.kubeロケーションにあると想定します。ファイルがデフォルトのロケーションにない場合は、環境変数をKUBECONFIGに設定します。chart-verifier ツールの出力には、実行されたテストの詳細と各テストの結果ステータスが含まれます。また、各テストが Red Hat 認定に必須であるか、推奨されているかも示します。詳細は、Helm チャートチェックのタイプ を参照してください。