8.4.2. レジストリー認証情報の保存
ブローカー設定は、ブローカーによるレジストリー認証情報の読み取り方法を決定します。レジストリー認証情報は、registry セクションの user 値と pass 値から読み取ることができます。 以下は例になります。
registry:
- name: isv
type: openshift
url: https://registry.connect.redhat.com
user: <user>
pass: <password>
これらの認証情報にパブリックにアクセスできないようにするには、registry セクションの auth_type フィールドを secret または file タイプに設定します。secret タイプは、ブローカーの namespace からシークレットを使用するようにレジストリーを設定します。 一方、file タイプは、ボリュームとしてマウントされているシークレットを使用するようにレジストリーを設定します。
secret または file タイプを使用するには、以下を実行します。
関連するシークレットには、
usernameとpasswordの値が定義されている必要があります。シークレットを使用する場合は、openshift-ansible-service-brokernamespace が存在していることを確認する必要があります。 シークレットはこの namespace から読み取られるためです。たとえば、reg-creds.yaml ファイルを作成します。
$ cat reg-creds.yaml --- username: <user_name> password: <password>このファイルから
openshift-ansible-service-brokernamespace にシークレットを作成します。$ oc create secret generic \ registry-credentials-secret \ --from-file reg-creds.yaml \ -n openshift-ansible-service-brokersecretまたはfileのどちらのタイプを使用するか選択します。secretタイプを使用するには、以下を実行します。ブローカー設定で、
auth_typeをsecretに、auth_nameをシークレットの名前に設定します。registry: - name: isv type: openshift url: https://registry.connect.redhat.com auth_type: secret auth_name: registry-credentials-secretシークレットが置かれている namespace を設定します。
openshift: namespace: openshift-ansible-service-broker
fileタイプを使用するには、以下を実行します。asbデプロイメント設定を編集し、ファイルを /tmp/registry-credentials/reg-creds.yaml にマウントします。$ oc edit dc/asb -n openshift-ansible-service-brokercontainers.volumeMountsセクションに、以下を追加します。volumeMounts: - mountPath: /tmp/registry-credentials name: reg-authvolumesセクションに、以下を追加します。volumes: - name: reg-auth secret: defaultMode: 420 secretName: registry-credentials-secretブローカー設定で、
auth_typeをfileに、auth_typeをファイルの場所に設定します。registry: - name: isv type: openshift url: https://registry.connect.redhat.com auth_type: file auth_name: /tmp/registry-credentials/reg-creds.yaml