我需要有关部署Spring Cloud数据流服务器的帮助。我想使用头盔部署应用程序并将流部署到不同的名称空间中。即使我使用多个帐户和名称空间更新了船长配置图,但检查流平台仍显示具有我部署了Spring Cloud和Skipper的名称空间的帐户。似乎它忽略了spring.application.json中的名称空间值。有人可以帮我吗?
这是我部署到集群的模板:
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "scdf.fullname" . }}-skipper
labels:
app: {{ template "scdf.name" . }}
component: skipper
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
data:
spring.application.json:
'{"spring.cloud.skipper.server.enableLocalPlatform" : false,
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformName }}.environmentVariables" :
"SPRING_RABBITMQ_HOST=${{ printf "{" }}{{ template "scdf.envrelease" .
}}_RABBITMQ_SERVICE_HOST},SPRING_RABBITMQ_PORT=${{ printf "{" }}{{
template "scdf.envrelease" .
}}_RABBITMQ_SERVICE_PORT_AMQP},SPRING_RABBITMQ_USERNAME={{
.Values.rabbitmq.rabbitmqUsername }},
SPRING_RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformName }}.memory" : "{{
.Values.deployer.resourceLimits.memory }}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformName }}.cpu" : "{{
.Values.deployer.resourceLimits.cpu }}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformName }}.createDeployment" : true,
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameDev }}.environmentVariables" :
"SPRING_RABBITMQ_HOST=${{ printf "{" }}{{ template "scdf.envrelease" .
}}_RABBITMQ_SERVICE_HOST}, SPRING_RABBITMQ_PORT=${{ printf "{" }}{{
template "scdf.envrelease" .
}}_RABBITMQ_SERVICE_PORT_AMQP},SPRING_RABBITMQ_USERNAME={{
.Values.rabbitmq.rabbitmqUsername
}},SPRING_RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameDev }}.memory" : "{{
.Values.deployer.resourceLimits.memory }}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameDev }}.cpu" : "{{
.Values.deployer.resourceLimits.cpu }}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameDev }}.createDeployment" : true,
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameDev }}.namespace" : "str-runtime-dev",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNamePreview }}.environmentVariables" :
"SPRING_RABBITMQ_HOST=${{ printf "{" }}{{ template "scdf.envrelease" .
}}_RABBITMQ_SERVICE_HOST}, SPRING_RABBITMQ_PORT=${{ printf "{" }}{{
template "scdf.envrelease" .
}}_RABBITMQ_SERVICE_PORT_AMQP},SPRING_RABBITMQ_USERNAME={{
.Values.rabbitmq.rabbitmqUsername
}},SPRING_RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNamePreview }}.memory" : "{{
.Values.deployer.resourceLimits.memory }}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNamePreview }}.cpu" : "{{
.Values.deployer.resourceLimits.cpu }}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNamePreview }}.createDeployment" : true,
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNamePreview }}.namespace" : "str",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameUat }}.environmentVariables" :
"SPRING_RABBITMQ_HOST=${{ printf "{" }}{{ template "scdf.envrelease" .
}}_RABBITMQ_SERVICE_HOST}, SPRING_RABBITMQ_PORT=${{ printf "{" }}{{
template "scdf.envrelease" .
}}_RABBITMQ_SERVICE_PORT_AMQP},SPRING_RABBITMQ_USERNAME={{
.Values.rabbitmq.rabbitmqUsername
}},SPRING_RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameUat }}.memory" : "{{
.Values.deployer.resourceLimits.memory }}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameUat }}.cpu" : "{{
.Values.deployer.resourceLimits.cpu }}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameUat }}.createDeployment" : true,
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameUat }}.namespace" : "str-runtime-uat",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameProd }}.environmentVariables" :
"SPRING_RABBITMQ_HOST=${{ printf "{" }}{{ template "scdf.envrelease" .
}}_RABBITMQ_SERVICE_HOST}, SPRING_RABBITMQ_PORT=${{ printf "{" }}{{
template "scdf.envrelease" .
}}_RABBITMQ_SERVICE_PORT_AMQP},SPRING_RABBITMQ_USERNAME={{
.Values.rabbitmq.rabbitmqUsername
}},SPRING_RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameProd }}.memory" : "{{
.Values.deployer.resourceLimits.memory }}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameProd }}.cpu" : "{{
.Values.deployer.resourceLimits.cpu }}",
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameProd }}.createDeployment" : true,
"spring.cloud.skipper.server.platform.kubernetes.accounts.{{
.Values.skipper.platformNameProd }}.namespace" : "str-runtime-prod"}'
这是流平台的输出:
runtime-uat │kubernetes│master url = [https://10.96.0.1:443/], namespace = [str], api version = [v1]║
runtime-prod│kubernetes│master url = [https://10.96.0.1:443/], namespace = [str], api version = [v1]║
preview │kubernetes│master url = [https://10.96.0.1:443/], namespace = [str], api version = [v1]║
minikube │kubernetes│master url = [https://10.96.0.1:443/], namespace = [str], api version = [v1]║
runtime-dev │kubernetes│master url = [https://10.96.0.1:443/], namespace = [str], api version = [v1]║e
编辑:我尝试了以下值,结果如下:
Skipper部署Yaml文件:
- name: SPRING_APPLICATION_JSON
value: '{"spring.cloud.skipper.server.enableLocalPlatform" : false,"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_ENVIRONMENT_VARIABLES" :"SPRING_RABBITMQ_HOST=${RABBITMQ_SERVICE_HOST},SPRING_RABBITMQ_PORT=${RABBITMQ_SERVICE_PORT}","SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_MEMORY" : "1024Mi","SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_CREATE_DEPLOYMENT" : true,"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_NAMESPACE" : "namespace1","SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_ENVIRONMENT_VARIABLES" : "SPRING_RABBITMQ_HOST=${RABBITMQ_SERVICE_HOST},SPRING_RABBITMQ_PORT=${RABBITMQ_SERVICE_PORT}","SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_MEMORY" : "1024Mi","SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_CREATE_DEPLOYMENT" : true,"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_NAMESPACE" : "namespace2"}'
1-船长舱的Env变量
SPRING_APPLICATION_JSON= .
{"spring.cloud.skipper.server.enableLocalPlatform" :
false,"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_ENVIRONMENT_VARIABLES":"SPRING_RABBITMQ_HOST=${RABBITMQ_SERVICE_HOST},SPRING_RABBITMQ_PORT=${RABBITMQ_SERVICE_PORT}","SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_MEMORY" : "1024Mi","SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_CREATE_DEPLOYMENT" : true,"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_NAMESPACE" : "namespace1","SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_ENVIRONMENT_VARIABLES" : "SPRING_RABBITMQ_HOST=${RABBITMQ_SERVICE_HOST},SPRING_RABBITMQ_PORT=${RABBITMQ_SERVICE_PORT}","SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_MEMORY" : "1024Mi","SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_CREATE_DEPLOYMENT" : true,"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_NAMESPACE" : "namespace2"}
2-平台的屏幕截图 Output of the stream platform-list
答案 0 :(得分:0)
不清楚如何以及在何处为不同的平台配置文件设置namespace
。如果您可以编辑帖子以澄清这一点,则可以与手头的问题联系起来。
通常,要创建具有不同“部署者属性”的多个平台配置文件[请参见KubernetesDeployerProperties],包括为每个配置文件使用不同的namespace
,通常会在Skipper的部署YAML中对其进行更改。例如,下面是skipper-deployment.yaml的value
部分示例。
value: "{\"spring.cloud.skipper.server.enableLocalPlatform\" : false, \"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_ENVIRONMENT_VARIABLES\" : \"SPRING_RABBITMQ_HOST=${RABBITMQ_SERVICE_HOST},SPRING_RABBITMQ_PORT=${RABBITMQ_SERVICE_PORT}\",\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_MEMORY\" : \"1024Mi\",\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_CREATE_DEPLOYMENT\" : true,\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_NAMESPACE\" : namespace1,\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_ENVIRONMENT_VARIABLES\" : \"SPRING_RABBITMQ_HOST=${RABBITMQ_SERVICE_HOST},SPRING_RABBITMQ_PORT=${RABBITMQ_SERVICE_PORT}\",\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_MEMORY\" : \"1024Mi\",\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_CREATE_DEPLOYMENT\" : true,\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_NAMESPACE\" : namespace2,\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[cf-dev]_CONNECTION_URL\" : \"https://api.run.pivotal.io\",\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[cf-dev]_CONNECTION_ORG\" : \"scdf-ci\",\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[cf-dev]_CONNECTION_SPACE\" : \"space-sabby\",\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[cf-dev]_CONNECTION_DOMAIN\" : \"cfapps.io\",\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[cf-dev]_CONNECTION_USERNAME\" : \"TEST@TEST.io\",\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[cf-dev]_CONNECTION_PASSWORD\" : \"***\",\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[cf-dev]_CONNECTION_SKIP_SSL_VALIDATION\" : false,\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[cf-dev]_DEPLOYMENT_DELETE_ROUTES\" : false,\"SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_CLOUDFOUNDRY_ACCOUNTS[cf-dev]_DEPLOYMENT_SERVICES\" : \"rabbit\"}"
此示例中有3个平台配置文件。 1)k8s-dev
2)k8s-qa
和3)cf-dev
。
对于#1和#2,请注意,我们有SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-dev]_NAMESPACE
和SPRING_CLOUD_SKIPPER_SERVER_PLATFORM_KUBERNETES_ACCOUNTS[k8s-qa]_NAMESPACE
分别指向“ namespace1”和“ namespace2”。除非您使用每个平台配置文件的显式命名空间设置来建立配置,否则它不会反映这些设置-它会恢复为默认设置。
但是,掌舵经验并不能提供灵活性来覆盖这样的精细设置。您仍然可以直接更新configmap,但是必须确保覆盖与每个名称空间相关的所有部署程序属性。