13.3.2. 为 OpenShift Container Platform OAuth 服务器创建额外的路由


当使用 Red Hat Advanced Cluster Security for Kubernetes 门户将 OpenShift Container Platform OAuth 服务器配置为身份提供程序时,RHACS 仅为 OAuth 服务器配置一个路由。但是,您可以通过在 Central 自定义资源中将路由指定为注解来创建其他路由。

流程

  • 如果您使用 RHACS Operator 安装 RHACS:

    1. 创建一个 CENTRAL_ADDITIONAL_ROUTES 环境变量,其中包含中央自定义资源的补丁:

      $ CENTRAL_ADDITIONAL_ROUTES='
      spec:
        central:
          exposure:
            loadBalancer:
              enabled: false
              port: 443
            nodePort:
              enabled: false
            route:
              enabled: true
          persistence:
            persistentVolumeClaim:
              claimName: stackrox-db
        customize:
          annotations:
            serviceaccounts.openshift.io/oauth-redirecturi.main: sso/providers/openshift/callback 
      1
      
            serviceaccounts.openshift.io/oauth-redirectreference.main: "{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"central\"}}" 
      2
      
            serviceaccounts.openshift.io/oauth-redirecturi.second: sso/providers/openshift/callback 
      3
      
            serviceaccounts.openshift.io/oauth-redirectreference.second: "{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"second-central\"}}" 
      4
      
      '
      Copy to Clipboard Toggle word wrap
      1
      用于设置主路由的重定向 URI。
      2
      主路由的重定向 URI 引用。
      3
      用于设置第二路由的重定向。
      4
      第二个路由的重定向引用。
    2. CENTRAL_ADDITIONAL_ROUTES 补丁应用到中央自定义资源:

      $ oc patch centrals.platform.stackrox.io \
        -n <namespace> \ 
      1
      
        <custom-resource> \ 
      2
      
        --patch "$CENTRAL_ADDITIONAL_ROUTES" \
        --type=merge
      Copy to Clipboard Toggle word wrap
      1
      <namespace > 替换为包含 Central 自定义资源的项目的名称。
      2
      <custom-resource > 替换为 Central 自定义资源的名称。
  • 或者,如果使用 Helm 安装 RHACS:

    1. values-public.yaml 文件中添加以下注解:

      customize:
        central:
          annotations:
            serviceaccounts.openshift.io/oauth-redirecturi.main: sso/providers/openshift/callback 
      1
      
            serviceaccounts.openshift.io/oauth-redirectreference.main: "{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"central\"}}" 
      2
      
            serviceaccounts.openshift.io/oauth-redirecturi.second: sso/providers/openshift/callback 
      3
      
            serviceaccounts.openshift.io/oauth-redirectreference.second: "{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"second-central\"}}" 
      4
      Copy to Clipboard Toggle word wrap
      1
      用于设置主路由的重定向。
      2
      对主路由进行重定向引用。
      3
      用于设置第二路由的重定向。
      4
      第二个路由的重定向引用。
    2. 使用 helm upgrade 将自定义注解应用到中央自定义资源:

      $ helm upgrade -n stackrox \
        stackrox-central-services rhacs/central-services \
        -f <path_to_values_public.yaml> 
      1
      Copy to Clipboard Toggle word wrap
      1
      使用 -f 选项指定 values-public.yaml 配置文件的路径。
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部