小编vkr*_*vkr的帖子

导出docker容器内的环境变量

env_var.sh我正在尝试在 docker 容器内运行 shell 脚本。脚本的内容如下所示。它本质上是尝试从特定配置文件中获取访问密钥

echo "# Environment for AWS profile dev"

echo export AWS_PROFILE=dev
echo export AWS_ACCESS_KEY_ID=(aws configure get aws_access_key_id --profile dev)
echo export AWS_SECRET_ACCESS_KEY=(aws configure get aws_secret_access_key --profile dev)
echo export AWS_DEFAULT_REGION=(aws configure get region --profile dev)

echo "dev environment variables exported"
Run Code Online (Sandbox Code Playgroud)

这是我的 dockerfile

FROM docker:17.04.0-ce

RUN apk update && apk add python && apk add py-pip && apk add bash

RUN pip install pip --upgrade && pip install setuptools --upgrade && pip install awscli && pip …
Run Code Online (Sandbox Code Playgroud)

docker aws-cli dockerfile

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

TeamCity 构建链配置

我有一个包含 4 个配置的 TeamCity 项目,构建链需要如下所示:

\n\n

构建链设置

\n\n

构建可以手动触发并执行 .bat 脚本,该脚本编译一堆工件以供部署和测试拾取。

\n\n

部署和测试 \xe2\x80\x93 区域 1对构建配置有工件依赖性。

\n\n

部署和测试 \xe2\x80\x93 区域 2对构建配置有工件依赖性。

\n\n

由于我希望 Region1 和 Region2 在构建成功后立即并行运行,因此我在构建配置上添加了对Deploy and TEST \xe2\x80\x93 Region 1Deploy and TEST \xe2\x80\x93 Region 2 的快照依赖项

\n\n

现在我需要配置测试状态配置只是为了报告先前配置(部署和测试配置)的失败/成功。

\n\n

如何才能实现这一目标?另外,我是否需要针对我想要实现的用例在任何地方调整我的设置?

\n

build-automation teamcity continuous-integration build-chain

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

将 AWS 角色提供的凭证传递给 docker 容器

我正在尝试运行安装了 aws cli 和 cfdeployment 的 docker-container。我正在尝试在本地计算机上运行 docker 容器。我在 ~/.aws/config 文件中本地设置了一个 AWS 配置文件

[profile dev]
role_arn = arn:aws:iam::****:role/test-deploy-role
source_profile = default
Run Code Online (Sandbox Code Playgroud)

我需要使用 docker 容器内此角色提供的临时凭据来执行 CF 模板。

这是我的 Dockerfile

FROM docker:17.04.0-ce

RUN apk update && apk add python && apk add py-pip && apk add bash

RUN pip install pip --upgrade && pip install setuptools --upgrade && pip install awscli && pip install cfdeployment==0.2.3 --extra-index-url https://dn2h7gel4xith.cloudfront.net

ADD test.sh /root/test.sh

VOLUME /tmp/work
VOLUME /root/.aws


ENTRYPOINT ["/root/test.sh", "cfdeployment"]
CMD ["--version"]
Run Code Online (Sandbox Code Playgroud)

amazon-iam docker aws-cli dockerfile docker-compose

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

使用node.js从json文件读取值

我是 Node.js 的新手,有点被困在这里。我有一个类似于此的 json 文件 keyValue.json

[ {
    "key": "key1",
    "value": "value1"
  },   
  {
    "key": "key2",
    "value": "value2"
  } 
]
Run Code Online (Sandbox Code Playgroud)

对于特定的键,我需要获取其值。

function filterValue() {
  const category = {};
  category.filter = "key1" //this is not static value. This changes dynamically
  category.value = //Need to read the keyValue.json file and pick the value for key1 - which is value1
  return category;
}
Run Code Online (Sandbox Code Playgroud)

在node.js 中如何实现这一点?感谢您的帮助。

javascript node.js

4
推荐指数
1
解决办法
9638
查看次数

使用 Secretsmanager Terraform 设置 aws 访问密钥和秘密密钥

我有下面的 terraform 模板,它创建用户、访问密钥并存储在秘密管理器中。

resource "aws_iam_user" "test" {
  name = "test"
}

resource "aws_iam_access_key" "test" {
  user = aws_iam_user.test.name
}

resource "aws_secretsmanager_secret" "test" {
  name = "credentials"
  description = "My credentials"
}

resource "aws_secretsmanager_secret_version" "test" {
  secret_id     = "${aws_secretsmanager_secret.test.id}"
  secret_string = "{\"AccessKey\": data.aws_iam_access_key.test.id,\"SecretAccessKey\": data.aws_iam_access_key.test.secret}"
}
Run Code Online (Sandbox Code Playgroud)

Secret_string 中的值未设置。这是正确的用法吗?请帮助我设置正确的值

secret_string = "{\"AccessKey\": data.aws_iam_access_key.test.id,\"SecretAccessKey\": data.aws_iam_access_key.test.secret}"
Run Code Online (Sandbox Code Playgroud)

terraform terraform-provider-aws

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

策略包含具有一个或多个无效委托人的语句 - AWS Cloudformation 错误

我有一个CF模板,如下所示

 AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: gtm platform Lampda application deployment for ELasticCloud
Parameters:
  SystemUserAccount:
    Description: The syatem user account used to assume deployment role
    Type: String
    Default: usr-test1
  DeploymentRoleName:
    Description: The deployment role used to deploy cloudformation template
    Type: String
    Default: gtm-platform-deployment-role
  GTMPlatformLambdaRoleName:
    Description: The execution role for gtm platform
    Type: String
    Default: gtm-platform-lambda-role
  GTMPlatformKMSKeyAliasName:
    Description: The lambda function name for gtm platform
    Type: String
    Default: gtm-platform-kms-key
Resources:
  GTMPlatformLambdaRole:
    Type: AWS::IAM::Role
    DependsOn:
      - GTMPlatformKMSKey
    Properties:
      RoleName: !Ref GTMPlatformLambdaRoleName
      AssumeRolePolicyDocument: …
Run Code Online (Sandbox Code Playgroud)

aws-cloudformation aws-lambda amazon-kms aws-serverless

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

AWS CLI 创建 ECR 存储库

我正在尝试使用 AWS cli 中的标签列表创建 ECR 存储库。这是我正在运行的命令。我需要将标签作为 JSON 传递

aws ecr create-repository \
    --repository-name alpha/sample-repo \
    --region us-west-2 \
    --tags [{"Key":"env","Value":"dev"},{"Key":"team","Value":"finance"}]
Run Code Online (Sandbox Code Playgroud)

并收到以下错误

Error parsing parameter '--tags': Invalid JSON:
[Key:env]
Run Code Online (Sandbox Code Playgroud)

我在这里缺少什么?如何让它发挥作用?

amazon-web-services aws-cli amazon-ecr

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

启用了Spark Streaming Checkpoint的java.io.NotSerializableException

我在火花流应用程序中启用了检查点,并且在作为依赖项下载的类上遇到此错误。

没有检查点,该应用程序运行良好。

错误:

com.fasterxml.jackson.module.paranamer.shaded.CachingParanamer
Serialization stack:
    - object not serializable (class: com.fasterxml.jackson.module.paranamer.shaded.CachingParanamer, value: com.fasterxml.jackson.module.paranamer.shaded.CachingParanamer@46c7c593)
    - field (class: com.fasterxml.jackson.module.paranamer.ParanamerAnnotationIntrospector, name: _paranamer, type: interface com.fasterxml.jackson.module.paranamer.shaded.Paranamer)
    - object (class com.fasterxml.jackson.module.paranamer.ParanamerAnnotationIntrospector, com.fasterxml.jackson.module.paranamer.ParanamerAnnotationIntrospector@39d62e47)
    - field (class: com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair, name: _secondary, type: class com.fasterxml.jackson.databind.AnnotationIntrospector)
    - object (class com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair, com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair@7a925ac4)
    - field (class: com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair, name: _primary, type: class com.fasterxml.jackson.databind.AnnotationIntrospector)
    - object (class com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair, com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair@203b98cf)
    - field (class: com.fasterxml.jackson.databind.cfg.BaseSettings, name: _annotationIntrospector, type: class com.fasterxml.jackson.databind.AnnotationIntrospector)
    - object (class com.fasterxml.jackson.databind.cfg.BaseSettings, com.fasterxml.jackson.databind.cfg.BaseSettings@78c34153)
    - field (class: com.fasterxml.jackson.databind.cfg.MapperConfig, name: _base, type: class com.fasterxml.jackson.databind.cfg.BaseSettings)
    - …
Run Code Online (Sandbox Code Playgroud)

scala apache-spark spark-streaming

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

当 Kubernetes 中的 configmap 更新时刷新 daemonset pod

更新配置映射后,如何自动重启与 Daemonsets 关联的 Kubernetes pod?

根据configmap 卷挂载更新时的kubernetes文档,它会自动更新 pod。但是,我认为 Daemonsets 不会发生这种情况。我错过了什么?

下面是我的配置图

apiVersion: v1
kind: ConfigMap
metadata:
  name: fluent-bit-update
  namespace: default
  labels:
    k8s-app: fluent-bit
data:
  # Configuration files: server, input, filters and output
  # ======================================================
  fluent-bit.conf: |
    [SERVICE]
        Flush         1
        Log_Level     info
        Daemon        off
        Parsers_File  parsers.conf


    @INCLUDE input-kubernetes.conf
    @INCLUDE filter-kubernetes.conf
    @INCLUDE output-logaggregator.conf

  input-kubernetes.conf: |
    [INPUT]
        Name              tail
        Tag               kube.*
        Path              /var/log/containers/abc.log
        Parser            docker
        DB                /var/log/tail-containers-state.db
        DB.Sync           Normal
        Mem_Buf_Limit     5MB
        Skip_Long_Lines   On
        Refresh_Interval  10
        Rotate_Wait      60
        Docker_Mode      On

  filter-kubernetes.conf: | …
Run Code Online (Sandbox Code Playgroud)

kubernetes kubernetes-pod configmap

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