Configmap-角度 [英] Configmaps - Angular

查看:112
本文介绍了Configmap-角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个configmap config.json

So i have a configmap config.json

{
"apiUrl": "http://application.cloudapp.net/",
"test": "1232"
}

称为连续部署"

豆荚Yaml

    apiVersion: v1
kind: Pod
metadata:
  name: continuousdeployment-ui
spec:
  containers:
  - name: continuousdeployment-ui
    image: release.azurecr.io/release.ccf.ui:2758
    volumeMounts:
    - name: config-volume
      mountPath: app/wwwroot/assets/config
  volumes:
  - name: config-volume
    configMap:
      name: continuousdeployment

没有配置映射集,我可以在转到IP地址./assets/config/config.json时看到配置文件,并且可以很好地查看它.当我应用配置映射时,然后可以看到的json的唯一部分是:

Without the config map set i can see the config file when going to the IP address ./assets/config/config.json and i can view it all fine. when i apply the config map the only part of the json i can then see is:

    {
"apiUrl": 

有什么想法吗?

更新-只需将config.json修改为以下内容

Update - Just amended the config.json to the following

{ 
"test":"1232", 
"apiUrl":"http://applictaion.cloudapp.net/"
}

在浏览器中,我可以看到

and in the browser i can see

{ 
    "test":"1232",

configmap

configmap

    {
  "kind": "ConfigMap",
  "apiVersion": "v1",
  "metadata": {
    "name": "continuousdeployment-ccf-ui-config",
    "namespace": "default",
    "selfLink": "/api/v1/namespaces/default/configmaps/continuousdeployment-ccf-ui-config",
    "uid": "94ee863c-42b3-11e9-8872-36a65af8d9e4",
    "resourceVersion": "235988",
    "creationTimestamp": "2019-03-09T21:37:47Z"
  },
  "data": {
    "config.json": "{\n    \"apiUrl\": \"http://application.cloudapp.net/\"\n}"
  }
}

甚至尝试过

{
  "kind": "ConfigMap",
  "apiVersion": "v1",
  "metadata": {
    "name": "continuousdeployment-ccf-ui-config1",
    "namespace": "default",
    "selfLink": "/api/v1/namespaces/default/configmaps/continuousdeployment-ccf-ui-config1",
    "uid": "ee50ad25-42c0-11e9-8872-36a65af8d9e4",
    "resourceVersion": "243585",
    "creationTimestamp": "2019-03-09T23:13:21Z"
  },
  "data": {
    "config.json": "{\r\n    \"apiUrl\": \"http://application.cloudapp.net/\"\r\n}"
  }
}

因此,如果我删除所有奇数字符并只使用字母,那么当我查看config.json时,它会变成'q'

So if i remove all odd characters and just do the alphabet, when i view the config.json it gets to 'q'

{
  "kind": "ConfigMap",
  "apiVersion": "v1",
  "metadata": {
    "name": "continuousdeployment-ccf-ui-config1",
    "namespace": "default",
    "selfLink": "/api/v1/namespaces/default/configmaps/continuousdeployment-ccf-ui-config1",
    "uid": "ee50ad25-42c0-11e9-8872-36a65af8d9e4",
    "resourceVersion": "244644",
    "creationTimestamp": "2019-03-09T23:13:21Z"
  },
  "data": {
    "config.json": "{abcdefghijklmnopqrstuvwxyz}"
  }
}

推荐答案

将其排序!

volumeMounts:
- mountPath: /app/wwwroot/assets/config/config.json
  name: config-volume
  subPath: config.json

必须将以下内容放入广告连播中,现在json可见并且可以使用

Had to put the following in the pod and now the json is visable and works

这篇关于Configmap-角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆