小编Ath*_*kla的帖子

如何删除添加到 JSON 的神秘“默认”字段?

我有以下jsondata.json文件:

{
    "name": "John",
    "age": 30,
    "car": "ferrari"
}
Run Code Online (Sandbox Code Playgroud)

在同一目录中,我有一个打字稿文件,main.ts其中我只是congole.log来自jsondata.json

import * as j from './jsondata.json';

console.log(j);
Run Code Online (Sandbox Code Playgroud)

结果令人惊讶:

{
  name: 'John',
  age: 30,
  car: 'ferrari',
  default: { name: 'John', age: 30, car: 'ferrari' }
}
Run Code Online (Sandbox Code Playgroud)

default那个字段是什么?为什么会出现,我该如何摆脱它?


作为参考,这是我的tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "sourceMap": true,
    "outDir": "./out",
    "strict": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "forceConsistentCasingInFileNames": true
  }
}
Run Code Online (Sandbox Code Playgroud)

json typescript

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

Airflow 中的 KubernetesPodOperator 特权 security_context

我在 Google 的 Cloud Composer 上运行 Airflow。我现在用的是KubernetesPodOperator并想通过一个谷歌存储桶安装到目录荚gcsfuse。似乎要做到这一点,我需要提供此处指定的 k8s 特权安全上下文。似乎气流最近向 KubernetesPodOperator 添加了 security_context 参数。我在操作符中指定的安全上下文是:

security_context = {
  'securityContext': {
    'privileged': True,
    'capabilities':
      {'add': ['SYS_ADMIN']}
  }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试airflow test dag_id task_id date在气流工作器中运行时,pod 启动,当代码尝试通过 gcsfuse 挂载存储桶时,它会引发错误"fusermount: fuse device not found, try 'modprobe fuse' first"。这使得它看起来好像 security_context 不起作用(例如)。

我是否误解了运算符中的 security_context 参数和/或我的 securityContext 字典定义是否无效?

kubernetes google-kubernetes-engine airflow google-cloud-composer

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