小编m9m*_*m9m的帖子

如何在 helm 图表中从 value.yaml 获取值到 _helpers.tpl

这是values.yaml 文件。它包含以下内容,当我尝试将其放入 _helper.tpl 时,我得到了Helm template failed. Error: render error in "windows/templates/ingresses/windows.yaml": template: windows/templates/_helpers.tpl:38:18: executing "windows.certificate" at <.Values.ingress.enab...>: can't evaluate field ingress in type interface {} : exit status 1

值.yaml

ingress:
    enabled: true
    tls: true
    certificate: ''
    issuer:
        name: letsencrypt-staging
    hosts:
        windows:
            - name: ''
            path: /
Run Code Online (Sandbox Code Playgroud)

_helpers.tpl

 {{/*
 Calculate certificate
 */}}
 {{- define "windows.certificate" }}
 {{- printf .Values.ingress.enabled }}  // error line is this. line no 38
 {{- end }}
Run Code Online (Sandbox Code Playgroud)

在 windows.yaml 中

    - secretName: {{ template "windows.certificate" …
Run Code Online (Sandbox Code Playgroud)

yaml kubernetes-helm

7
推荐指数
2
解决办法
1万
查看次数

6
推荐指数
1
解决办法
933
查看次数

如何处理在 puppeteer 中的 ajax 请求后加载的元素

我正在尝试使用 puppeteer 进行网络抓取。我最近需要处理负载的元素。当我单击搜索按钮时,结果会在 AJAX 中加载,我需要选择我尝试选择的元素在搜索结果中但不在页面的初始加载中。它生成的页面截图也包含搜索结果,如果它输出 HTML 源代码,我也可以在那里看到该元素。但不知道为什么我不能选择它。

javascript puppeteer

5
推荐指数
1
解决办法
3822
查看次数

压缩所需的外部js文件

Gtmetrix用来测试我的页面加载时间.我gzip通过添加代码在我的网站上启用了压缩.htaccess

.htaccess代码:

<ifModule mod_gzip.c>

mod_gzip_on Yes

mod_gzip_dechunk Yes

mod_gzip_item_include file .(html?|txt|css|js|php|pl)$

mod_gzip_item_include handler ^cgi-script$

mod_gzip_item_include mime ^text/.*

mod_gzip_item_include mime ^application/x-javascript.*

mod_gzip_item_exclude mime ^image/.*

mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

</ifModule>
Run Code Online (Sandbox Code Playgroud)

但Gtmetrix仍显示以下警告

压缩http://s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js可以节省453.6KiB(减少71%).这是一个外部js文件.我怎么压缩这个?

compression gzip pagespeed

3
推荐指数
1
解决办法
3721
查看次数

如何将组件中的道具传递给FlatList renderItem

我的组件中有一个函数作为道具,并且必须将此函数道具传递给FlastList中renderItem中的另一个组件。怎么做?这是我的代码。

import React, { Component } from 'react';
import { View } from 'native-base';
import PropTypes from 'prop-types';
import { FlatList } from 'react-native';
import AddPlayers from '../AddPlayers/AddPlayers';
import League from '../League/League';
export default class InviteLeagues extends Component {
  static propTypes = {
    invitedLeagues: PropTypes.Array,
    label: PropTypes.string.isRequired,
    InvitedLeaguesList: PropTypes.Array,
    onPress: PropTypes.func.isRequired
  };

  static defaultProps = {
    InvitedLeaguesList: [
      { name: 'Howdy', createdBy: 'email1@gamil.com', status: 'Join' },
      { name: 'Lorem', createdBy: 'email@gmail.com', status: 'Join' }
    ]
  };

  renderLeague(item) {
    return <League …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-flatlist

3
推荐指数
2
解决办法
1422
查看次数

如何在FlatList extraData中传递多个对象或值

我有一种情况,我需要在FlatList extraData中同时传递State和Props。

我尝试了类似的方法,但是没有用

 <FlatList
      numColumns={1}
      data={this.props.artists}
      renderItem={this.renderArtistItem}
      initialNumToRender={15}
      keyExtractor={item => item.id}
      extraData={(this.state, this.props.league)}
    />
Run Code Online (Sandbox Code Playgroud)

怎么做?

react-native react-native-flatlist

2
推荐指数
1
解决办法
834
查看次数

如何从keycloak中的自定义客户端获取角色?

为了获得自定义客户端中的角色,我知道我需要执行两个 API。一种是获取访问令牌,一种是获取角色。我的疑问是,我应该通过在标头中发送 admin-CLI 详细信息来获取 accessToken 还是因为我想要我创建的自定义客户端的角色?因为,我在尝试获取角色时收到unknown_error。

获取accessToken:

curl -X POST \
  http://localhost:8080/auth/realms/test-keycloak-example/protocol/openid-connect/token \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -d 'grant_type=client_credentials&client_id=test-keycloak-example&client_secret=shhh'
Run Code Online (Sandbox Code Playgroud)

获取角色:

curl -X GET \
  http://localhost:8080/auth/admin/realms/test-keycloak-example/clients/cb11fd17-46df-419a-9c67-4a69d1be66ae/roles \
  -H 'authorization: Bearer <token received from previous call> \
  -H 'cache-control: no-cache' \
  -H 'postman-token: 248fef6b-9c24-3aa3-91ae-a6f11e01e55c'
Run Code Online (Sandbox Code Playgroud)

响应是:

{
   "error": "unknown_error"
}
Run Code Online (Sandbox Code Playgroud)

keycloak keycloak-rest-api

2
推荐指数
1
解决办法
1万
查看次数