Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

3.3.3.4. アノテーション

各ルートにはアノテーションを割り当てることができます。各アノテーションは名前と値のみで設定されます。

apiVersion: v1
kind: Route
metadata:
  annotations:
    haproxy.router.openshift.io/timeout: 5500ms
[...]

名前は既存のアノテーションと競合しないものにできます。値は文字列です。文字列では複数のトークンをスペースで区切ることができます (例: aa bb cc)。このテンプレートは {{index}} を使用してアノテーションの値を抽出します。以下に例を示します。

{{$balanceAlgo := index $cfg.Annotations "haproxy.router.openshift.io/balance"}}

この例は、これをどのようにクライアントの相互認証に使用できるかを示しています。

{{ with $cnList := index $cfg.Annotations "whiteListCertCommonName" }}
  {{   if ne $cnList "" }}
    acl test ssl_c_s_dn(CN) -m str {{ $cnList }}
    http-request deny if !test
  {{   end }}
{{ end }}

このコマンドを使用してホワイトリストの CN を処理できます。

$ oc annotate route <route-name> --overwrite whiteListCertCommonName="CN1 CN2 CN3"

詳細は、ルート固有のアノテーション を参照してください。