TAP 文章系列-10 | 从应用感知能力谈 TAP 的约定服务

Tanzu Application Platform (TAP),VMware 在2022年1月正式发布的新一代PaaS平台,该平台一大特色即为应用感知能力,即在应用程序CICD的过程中平台将自动感知应用程序的开发框架及开发语言,那么在应用部署的过程中平台将根据以上自动判断的信息自动将应用部署的配置中注入最佳实践,比如应用安全加固、应用监控、应用自愈等约定,这种自动化的过程在TAP我们称其为约定服务(Convention Service)。可见其最大的优势及价值为通过应用感知、控制翻转、自动注入等设计理念及技术实现,可大幅减少应用运维团队及开发团队的在部署应用时的工作负担。

看到这里,相信您一定在思考一些问题,应用程序在 Kubernetes 上运行,应该如何遵循最佳约定,应该遵循哪些约定?

在解答您的疑惑之前,我们先一起来看一个普遍的场景,假设需要在Kubernetes集群中启动一个Nginx的服务,我们会怎么做,如下所示应该是解题思路之一吧?

第一步,编写nginx.yaml , 如下

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  selector:
    matchLabels:
      run: my-nginx
  replicas: 1
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
        - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  name: my-nginx
  labels:
    run: my-nginx
spec:
  ports:
  - port: 80
    protocol: TCP
  selector:
    run: my-nginx

第二步,kubectl apply -f nginx.yaml

这样,您就可以为 Kubernetes 节点中分配一个端口并在浏览器中访问 nginx。但是,看到这里一些应用运维的专家就不同意了,并大吼到这不能在生产环境中使用,并解释道:这种启动方式存在以下问题:

  • http通信根本没有加密,已经公开了

  • 由于 NodePort 将端口暴露给主机端,因此会产生主机被劫持的风险。

  • 如果在外部发布,应该创建一个 Ingress 资源对象。

  • 容器中的应用程序已经以root用户启动。

  • 没有设置资源限制,因此存在无限 CPU / 内存使用的风险。

  • 文件系统挂载应尽可能设置为只读。

  • ……

然后,我们将以上发现的问题逐一解决编写到yaml文件中,但问题是这些设置不能为其他的容器统一设置并共用。在这种情况下,您需要在考虑其他应用程序“的特性的同时重复考虑如何优化使用最佳的推荐约定设置。您还需要了解特定框架所需的约定,即使它是像 nginx 这样的简单应用程序。

那么有没有一种自动化的方案,能够帮助开发人员以及应用运维人员简化这一块的操作呢?

答案当然是肯定的,让我们来深入的感受一下我们的TAP的约定服务吧!

1.约定服务概述

TAP的约定服务是实现“App-Aware Platform = 了解应用特性的平台”的功能之一,TAP应用感知平台根据这些应用程序特征为应用在部署过程中自动注入并设置这些最佳约定的机制。VMware认为,为在 Kubernetes 上运行的应用程序注入推荐约定应该是平台的工作,平台自动确定开发语言和框架并进入最佳约定的注入,而不是应用运维手册。

Convention Service as App-Aware 的特点是它不仅扫描 Kubernetes 脚本的有效性,还扫描容器镜像本身,主要使用 SBoM(Software Bills of Materials),在搜索了实际应用程序使用的库及其版本之后,约定服务将自动为应用程序的配置注入最佳约定。

​Convention Service 在TAP Cartographer 软件供应链中的位置,如下所示,在完成CI流程后,供应链会进行平台装配的工作,并通过启动PodIntent的资源对象将约定注入至配置文件中。

当 Supply Chain Choreographer 为工作负载创建或更新 PodIntent 时,Convention Service从包含工作负载镜像中检索 OCI 镜像元数据并将其注入在 PodIntent 中。 在所有服务器完成处理工作负载的 PodIntent 后,约定控制器使用最新版本的 PodTemplateSpec 更新 PodIntent 并设置 PodIntent.status.conditions[].status=True 其中 PodIntent.status.conditions[].type=Ready。这种状态变化向 Supply Chain Choreographer 发出 Convention Service 已完成其工作的信号。

目前,TAP 1.1 提供以下几类约定:

  • Developer convention service

  • Spring Boot convention service

  • Application Live View convention service

  • Service intent convention service

2体验约定服务

2.1Developer Convention Service

Developer Conventions是一组使您的工作负载能够支持实时热更新和调试操作的约定。 它与 Tanzu CLI Apps plug-in和 Tanzu Dev Tools for VSCode IDE extension起使用。

Developer Conventions会修改您的工作负载以在以下任一情况下启用实时更新:

  • 您可以使用 Tanzu CLI Apps plug-in部署工作负载并包含标志 --live-update=true。

  • 您可以通过 Tanzu Dev Tools for VSCode IDE extension使用 Tanzu: Live Update Start 选项部署工作负载。

当上述任一动作发生时,Developer Conventions约定的行为如下:

  • 在与工作负载关联的 PodTemplateSpec 上查找 apps.tanzu.vmware.com/live-update=true 注释。

  • 验证应用了约定的镜像是否包含可以实时更新的进程,即检查创建 Cloud Native Buildpacks 的镜像是否支持 Process Reloading。

  • 如满足以上两条,Developer Convention Service向 PodTemplateSpec 添加注释以修改 Knative 属性 minScale 和 maxScale ,使得 pod 的最小和最大数量为 1。这确保最终运行的 pod 在实时更新会话期间不会缩小到 0。

满足以上条件之后,现在让我们看一下Developer Conventions的 LiveUpdate 功能,让我们通过以下两个测试,看看约定服务是如何工作的。

  • 支持进程重载的 Java Buildpack 的行为

  • 不支持进程重新加载的 NodeJS 构建包的行为

首先,让我们看一下在 Cloud Native Buildpacks 中支持 Process Reloading的 Java Buildpacks 的行为。让我们使用以下命令创建一个工作负载,重要的参数是“–live-update = true”。

tanzu apps workload create tanzu-java-web-app \
--git-repo https://github.com/HugoXiao1984/tanzu-java-web-app \
--git-branch main \
--type web \
--live-update=true \
--yes

创建工作负载后,如果您检查 PodIntent文件,则发现 minScale: 1 和 maxScale: 1,这意味着Developer Conventions已按预期自动注入。

status:
  conditions:
  - lastTransitionTime: "2022-06-27T08:27:44Z"
    message: ""
    reason: Applied
    status: "True"
    type: ConventionsApplied
  - lastTransitionTime: "2022-06-27T08:27:44Z"
    message: ""
    reason: ConventionsApplied
    status: "True"
    type: Ready
  observedGeneration: 1
  template:
    metadata:
      annotations:
        apps.tanzu.vmware.com/live-update: "true"
        autoscaling.knative.dev/maxScale: "1"
        autoscaling.knative.dev/minScale: "1"
        boot.spring.io/actuator: http://:8081/actuator
        boot.spring.io/version: 2.5.13
        conventions.apps.tanzu.vmware.com/applied-conventions: |-
          developer-conventions/live-update-convention
          developer-conventions/add-source-image-label
          spring-boot-convention/spring-boot
          spring-boot-convention/spring-boot-graceful-shutdown
          spring-boot-convention/spring-boot-web
          spring-boot-convention/spring-boot-actuator
          appliveview-sample/app-live-view-connector
          appliveview-sample/app-live-view-appflavours
          appliveview-sample/app-live-view-systemproperties
        developer.apps.tanzu.vmware.com/image-source-digest: main/8aa9479d5355aa51588d39e04005a76609d08624
        developer.conventions/target-containers: workload
      labels:
        app.kubernetes.io/component: run
        apps.tanzu.vmware.com/workload-type: myweb
        carto.run/workload-name: tanzu-java-web-app
        conventions.apps.tanzu.vmware.com/framework: spring-boot
        tanzu.app.live.view: "true"
        tanzu.app.live.view.application.actuator.port: "8081"
        tanzu.app.live.view.application.flavours: spring-boot
        tanzu.app.live.view.application.name: demo
    spec:
      containers:
      - env:
        - name: JAVA_TOOL_OPTIONS
          value: -Dmanagement.endpoint.health.probes.add-additional-paths="true" -Dmanagement.endpoint.health.show-details=always
            -Dmanagement.endpoints.web.base-path="/actuator" -Dmanagement.endpoints.web.exposure.include=*
            -Dmanagement.health.probes.enabled="true" -Dmanagement.server.port="8081"
            -Dserver.port="8080" -Dserver.shutdown.grace-period="24s"
        image: index.docker.io/znluo/tanzu-java-web-app-default@sha256:d1fce7c186233920c697ca1722e17fd86db2151e27c1af0534378c5d27ca1371
        name: workload
        ports:
        - containerPort: 8080
          protocol: TCP
        resources: {}
        securityContext:
          runAsUser: 1000
      serviceAccountName: default

接下来,我们来看看Cloud Native Buildpacks 中不支持Process Reloading 的 NodeJS Buildpacks 的行为。让我们使用以下命令创建一个工作负载。同样重要的是“–live-update = true”参数。

tanzu apps workload create tanzu-nodejs-web-app \
--git-repo  https://github.com/HugoXiao1984/nodejs-hello-world \
--git-branch master \
--type web \
--live-update=true \
--yes

创建工作负载后,当检查 Kubernetes Yaml时,minScale / maxScale 并没有被自动注入。虽然标签为apps.tanzu.vmware.com/live-update=true,但Convention Service 检测到镜像中的SBoM 不支持Process Reloading。因此,未设置 minScale / maxScale,但这也是预期的行为。

status:
  conditions:
  - lastTransitionTime: "2022-06-27T09:42:12Z"
    message: ""
    reason: Applied
    status: "True"
    type: ConventionsApplied
  - lastTransitionTime: "2022-06-27T09:42:12Z"
    message: ""
    reason: ConventionsApplied
    status: "True"
    type: Ready
  observedGeneration: 1
  template:
    metadata:
      annotations:
        apps.tanzu.vmware.com/live-update: "true"
        conventions.apps.tanzu.vmware.com/applied-conventions: developer-conventions/add-source-image-label
        developer.apps.tanzu.vmware.com/image-source-digest: master/a837c6c25edc412fedcc501a4e6fef50d878adb5
        developer.conventions/target-containers: workload
      labels:
        app.kubernetes.io/component: run
        apps.tanzu.vmware.com/workload-type: myweb
        carto.run/workload-name: tanzu-nodejs-web-app
    spec:
      containers:
      - env:
        - name: JAVA_TOOL_OPTIONS
          value: -Dmanagement.endpoint.health.probes.add-additional-paths="true" -Dmanagement.health.probes.enabled="true"
        image: index.docker.io/znluo/tanzu-nodejs-web-app-default@sha256:8efdc874bf8251d0eee9cdf75f67ccb29a1653e7e64bf62db2e095a91f9122b6
        name: workload
        resources: {}
        securityContext:
          runAsUser: 1000
      serviceAccountName: default

如本演示所示,Developer Conventions Service 检测镜像是否基于 Cloud Native Buildpacks Java / NodeJS,。平台透明地自动注入了根据应用程序自身特征的推荐约定。

2.2 Spring Boot Convention Service

2.2.1 Spring Boot convention

如果依赖项下的 SBOM 文件的元数据中存在以下任何依赖项,则 Spring Boot Convention将应用于 PodTemplateSpec 对象:

  • spring-boot

Spring Boot Convention在 PodTemplateSpec 中添加一个标签 (conventions.apps.tanzu.vmware.com/framework: spring-boot) 来描述与工作负载相关的框架,并添加一个注解 (boot.spring.io/version: VERSION-NO) 描述依赖项的 Spring Boot 版本。

应用约定后的 PodIntent 示例:

apiVersion: conventions.apps.tanzu.vmware.com/v1alpha1
kind: PodIntent
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"conventions.apps.tanzu.vmware.com/v1alpha1","kind":"PodIntent","metadata":{"annotations":{},"name":"spring-sample","namespace":"default"},"spec":{"template":{"spec":{"containers":[{"image":"springio/petclinic","name":"workload"}]}}}}

...

status:
  conditions:
  - lastTransitionTime: "..." # This status indicates that all worked as expected
    status: "True"
    type: ConventionsApplied
  - lastTransitionTime: "..."
    status: "True"
    type: Ready
  observedGeneration: 1
  template:
    metadata:
      annotations:
        boot.spring.io/version: 2.3.3.RELEASE
        conventions.apps.tanzu.vmware.com/applied-conventions: |-
          spring-boot-convention/spring-boot
      labels:
        conventions.apps.tanzu.vmware.com/framework: spring-boot
    spec:
      containers:
      - image: index.docker.io/springio/petclinic@sha256:...
        name: workload
        resources: {}

2.2.2 Spring boot graceful shut down convention

如果依赖项下的 SBOM 文件的元数据中存在以下任何依赖项,则将 Spring Boot graceful shut down约定应用于 PodTemplateSpec 对象:

  • spring-boot-starter-tomcat

  • spring-boot-starter-jetty

  • spring-boot-starter-reactor-netty

  • spring-boot-starter-undertow

  • tomcat-embed-core

Graceful Shutdown Convention spring-boot-graceful-shutdown 在环境变量 JAVA_TOOL_OPTIONS 中添加一个带有 key server.shutdown.grace-period 的属性。 .target.Spec.TerminationGracePeriodSeconds 中设置的值的 80%, .target.Spec.TerminationGracePeriodSeconds 的默认值为 30 秒。

应用约定后的 PodIntent 示例:

apiVersion: conventions.apps.tanzu.vmware.com/v1alpha1
kind: PodIntent
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"conventions.apps.tanzu.vmware.com/v1alpha1","kind":"PodIntent","metadata":{"annotations":{},"name":"spring-sample","namespace":"default"},"spec":{"template":{"spec":{"containers":[{"image":"springio/petclinic","name":"workload"}]}}}}

...

status:
  conditions:
  - lastTransitionTime: "..." # This status indicates that all worked as expected
    status: "True"
    type: ConventionsApplied
  - lastTransitionTime: "..."
    status: "True"
    type: Ready
  observedGeneration: 1
  template:
    metadata:
      annotations:
        boot.spring.io/version: 2.3.3.RELEASE
        conventions.apps.tanzu.vmware.com/applied-conventions: |-
          spring-boot-convention/spring-boot
          spring-boot-convention/spring-boot-graceful-shutdown
      labels:
        conventions.apps.tanzu.vmware.com/framework: spring-boot
    spec:
      containers:
      - env:
        - name: JAVA_TOOL_OPTIONS
          value: -Dserver.shutdown.grace-period="24s"
        image: index.docker.io/springio/petclinic@sha256:...
        name: workload
        resources: {}

2.2.3 Spring Boot Web convention

如果依赖项下的 SBOM 文件的元数据中存在以下任何依赖项,则 Spring Boot Web convention将应用于 PodTemplateSpec 对象:

  • spring-boot

  • spring-boot-web

Web 约定 spring-boot-web 从 JAVA_TOOL_OPTIONS 环境变量中获取 server.port 属性,并将其设置为 PodTemplateSpec 中的端口。 如果 JAVA_TOOL_OPTIONS 环境变量不包含 server.port 属性或值,则约定添加该属性并将值设置为 Spring Boot 的默认值8080。

应用约定后的 PodIntent 示例:

apiVersion: conventions.apps.tanzu.vmware.com/v1alpha1
kind: PodIntent
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"conventions.apps.tanzu.vmware.com/v1alpha1","kind":"PodIntent","metadata":{"annotations":{},"name":"spring-sample","namespace":"default"},"spec":{"template":{"spec":{"containers":[{"image":"springio/petclinic","name":"workload"}]}}}}

...


status:
  conditions:
  - lastTransitionTime: "..." # This status indicates that all worked as expected
    status: "True"
    type: ConventionsApplied
  - lastTransitionTime: "..."
    status: "True"
    type: Ready
  observedGeneration: 1
  template:
    metadata:
      annotations:
        boot.spring.io/version: 2.3.3.RELEASE
        conventions.apps.tanzu.vmware.com/applied-conventions: |-
          spring-boot-convention/spring-boot
          spring-boot-convention/spring-boot-web
      labels:
        conventions.apps.tanzu.vmware.com/framework: spring-boot
    spec:
      containers:
      - env:
        - name: JAVA_TOOL_OPTIONS
          value: -Dserver.port="8080"
        image: index.docker.io/springio/petclinic@sha256:...
        name: workload
        ports:
        - containerPort: 8080
          protocol: TCP
        resources: {}

2.2.4 Spring Boot Actuator convention

如果依赖项下的 SBOM 文件的元数据中存在以下任何依赖项,则 Spring Boot Actuator convention将应用于 PodTemplateSpec 对象:

  • spring-boot-actuator

Spring Boot Actuator convention 执行以下操作:

  • 将 JAVA_TOOL_OPTIONS 环境变量中的管理端口设置为 8081。

  • 将 JAVA_TOOL_OPTIONS 环境变量中的基本路径设置为 /actuator。

  • 在访问Actuator的位置添加注释 boot.spring.io/actuator。

应用约定后的 PodIntent 示例:

apiVersion: conventions.apps.tanzu.vmware.com/v1alpha1
kind: PodIntent
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"conventions.apps.tanzu.vmware.com/v1alpha1","kind":"PodIntent","metadata":{"annotations":{},"name":"spring-sample","namespace":"default"},"spec":{"template":{"spec":{"containers":[{"image":"springio/petclinic","name":"workload"}]}}}}

...

status:
  conditions:
  - lastTransitionTime: "..." # This status indicates that all worked as expected
    status: "True"
    type: ConventionsApplied
  - lastTransitionTime: "..."
    status: "True"
    type: Ready
  observedGeneration: 1
  template:
    metadata:
      annotations:
        boot.spring.io/actuator: http://:8080/actuator
        boot.spring.io/version: 2.3.3.RELEASE
        conventions.apps.tanzu.vmware.com/applied-conventions: |-
          spring-boot-convention/spring-boot
          spring-boot-convention/spring-boot-web
          spring-boot-convention/spring-boot-actuator
      labels:
        conventions.apps.tanzu.vmware.com/framework: spring-boot
    spec:
      containers:
      - env:
        - name: JAVA_TOOL_OPTIONS
          value: Dmanagement.endpoints.web.base-path="/actuator" -Dmanagement.server.port="8081" -Dserver.port="8080"
        image: index.docker.io/springio/petclinic@sha256:...
        name: workload
        ports:
        - containerPort: 8080
          protocol: TCP
        resources: {}

2.2.5 Spring Boot Actuator Probes convention

在满足以下所有条件时, Spring Boot Actuator Probes convention将会被应用:

  • spring-boot-actuator 依赖存在且版本>= 2.6

  • JAVA_TOOL_OPTIONS 环境变量不包含以下属性,或者,如果包含其中任何一个属性,则将其设置为 true 值:

           o -Dmanagement.health.probes.enabled

           o -Dmanagement.endpoint.health.probes.add-additional-paths

Spring Boot Actuator Probes convention执行以下操作:

  • 使用主服务器端口(即 JAVA_TOOL_OPTIONS 上的 server.port 值)来设置 liveness 和 readiness 探针。

  • 将以下属性和值添加到 JAVA_TOOL_OPTIONS 环境变量:

          o -Dmanagement.health.probes.enabled="true"

          o -Dmanagement.endpoint.health.probes.add-additional-paths="true"

应用此约定时,探针的暴露方式如下:

  • Liveness probe: /livez

  • Readiness probe: /readyz

应用约定后的 PodIntent 示例:

apiVersion: conventions.apps.tanzu.vmware.com/v1alpha1
kind: PodIntent
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"conventions.apps.tanzu.vmware.com/v1alpha1","kind":"PodIntent","metadata":{"annotations":{},"name":"spring-sample","namespace":"default"},"spec":{"template":{"spec":{"containers":[{"image":"springio/petclinic","name":"workload"}]}}}}

...

status:
  conditions:
  - lastTransitionTime: "..." # This status indicates that all worked as expected
    status: "True"
    type: ConventionsApplied
  - lastTransitionTime: "..."
    status: "True"
    type: Ready
  observedGeneration: 1
  template:
    metadata:
      annotations:
        boot.spring.io/actuator: http://:8080/actuator
        boot.spring.io/version: 2.6.0
        conventions.apps.tanzu.vmware.com/applied-conventions: |-
          spring-boot-convention/spring-boot
          spring-boot-convention/spring-boot-web
          spring-boot-convention/spring-boot-actuator
      labels:
        conventions.apps.tanzu.vmware.com/framework: spring-boot
    spec:
      containers:
      - env:
        - name: JAVA_TOOL_OPTIONS
          value: -Dmanagement.endpoint.health.probes.add-additional-paths="true" -Dmanagement.endpoints.web.base-path="/actuator" -Dmanagement.health.probes.enabled="true" -Dmanagement.server.port="8081" -Dserver.port="8080"
        image: index.docker.io/springio/petclinic@sha256:...
        name: workload
        livenessProbe:
          httpGet:
            path: /livez
            port: 8080
            scheme: HTTP
        ports:
        - containerPort: 8080
          protocol: TCP
        readinessProbe:
          httpGet:
            path: /readyz
            port: 8080
            scheme: HTTP
        resources: {}

2.3Application Live View convention service

Application Live View convention执行以下操作:

  • 在 PodTemplateSpec 中添加一个标签tanzu.app.live.view: "true"

  • 在 PodTemplateSpec 中添加一个标签tanzu.app.live.view.application.name: APP-NAME

  • 将以下属性和值添加到 JAVA_TOOL_OPTIONS 环境变量:

             o -Dmanagement.endpoint.health.show-details=always

             o -Dmanagement.endpoints.web.exposure.include=*

应用约定后的 PodIntent 示例:

status:
conditions:
- lastTransitionTime: "2021-10-26T11:26:35Z"
  status: "True"
  type: ConventionsApplied
- lastTransitionTime: "2021-10-26T11:26:35Z"
  status: "True"
  type: Ready
observedGeneration: 1
template:
  metadata:
    annotations:
      conventions.apps.tanzu.vmware.com/applied-conventions: |-
        appliveview-sample/app-live-view-connector
        appliveview-sample/app-live-view-appflavours
        appliveview-sample/app-live-view-systemproperties
    labels:
      tanzu.app.live.view: "true"
      tanzu.app.live.view.application.flavours: spring-boot
      tanzu.app.live.view.application.name: petclinic
  spec:
    containers:
    - env:
      - name: JAVA_TOOL_OPTIONS
        value: -Dmanagement.endpoint.health.show-details=always -Dmanagement.endpoints.web.exposure.include=*
    image: index.docker.io/kdvolder/alv-spring-petclinic:latest@sha256:1aa7bd228137471ea38ce36cbf5ffcd629eabeb8ce047f5533b7b9176ff51f98
    name: workload
    resources: {}

在注入约定后,应用可在TAP的Live View页面进行实时监控,如下所示 :

2.4Service intent conventions

Service intent conventions不会改变最终部署的行为,但您可以将它们用作附加信息以在供应链中进行处理。 例如,当应用程序需要绑定到数据库服务时,此约定为每个检测到的依赖项添加注释和标签到 PodTemplateSpec, 还向conventions.apps.tanzu.vmware.com/applied-conventions 添加注释和标签。

当您应用 Pod Intent 并且镜像包含依赖项(例如 MySQL)时,约定的输出将是:

apiVersion: conventions.apps.tanzu.vmware.com/v1alpha1
  kind: PodIntent
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"conventions.apps.tanzu.vmware.com/v1alpha1","kind":"PodIntent","metadata":{"annotations":{},"name":"spring-sample","namespace":"default"},"spec":{"template":{"spec":{"containers":[{"image":"springio/petclinic","name":"workload"}]}}}}
    creationTimestamp: "..."
    generation: 1
    name: spring-sample
    namespace: default
    resourceVersion: "..."
    uid: ...
  spec:
    serviceAccountName: default
    template:
      metadata: {}
      spec:
        containers:
        - image: springio/petclinic
          name: workload
          resources: {}
  status:
    conditions:
    - lastTransitionTime: "..." # This status indicates that all worked as expected
      status: "True"
      type: ConventionsApplied
    - lastTransitionTime: "..."
      status: "True"
      type: Ready
    observedGeneration: 1
    template:
      metadata:
        annotations:
          boot.spring.io/actuator: http://:8080/actuator
          boot.spring.io/version: 2.3.3.RELEASE
          conventions.apps.tanzu.vmware.com/applied-conventions: |-
            spring-boot-convention/spring-boot
            spring-boot-convention/spring-boot-web
            spring-boot-convention/spring-boot-actuator
            spring-boot-convention/service-intent-mysql
          services.conventions.apps.tanzu.vmware.com/mysql: mysql-connector-java/8.0.21
        labels:
          conventions.apps.tanzu.vmware.com/framework: spring-boot
          services.conventions.apps.tanzu.vmware.com/mysql: workload
      spec:
        containers:
        - env:
          - name: JAVA_TOOL_OPTIONS
            value: Dmanagement.endpoints.web.base-path="/actuator" -Dmanagement.server.port="8081" -Dserver.port="8080"
          image: index.docker.io/springio/petclinic@sha256:...
          name: workload
          ports:
          - containerPort: 8080
            protocol: TCP
          resources: {}

3.价值总结

通过对TAP约定服务的实现机制及4类约定服务的详细介绍,相信您现在一定对其的能力有了进一步的了解,让我们在此对它能为开发测试及应用运维人员带来的核心价值进行深入的总结。

Tanzu Application Platform通过供应链编排帮助开发人员及应用运维人员通过 URL 将其代码转换为容器化工作负载。约定服务是供应链编排工作机制中的关键组成部分,它使应用运维人员能够有效地运用他们的专业知识,在平台上创建工作负载时为其组织指定运行时最佳实践、策略和约定。 当组织的约定被一致地、大规模地应用并且不妨碍应用程序开发人员的开发效率时,这个组件的价值就变得显而易见了。

我们会在后续的系列文章中进一步介绍 TAP 的其它组件,敬请关注与期待!

如果您有任何反馈,也请联系我们!

4.作者介绍

肖林,VMware 现代化应用平台高级解决方案架构师,主要负责VMware Tanzu云原生技术解决方案的架构与设计;在此之前,在IBM任职负责大中华区云原生技术解决方案架构,主导了多个云原生解决方案的设计。

个人从业16年, Cloud Native拥护者&Agile实践者, 在容器,大规模分布式服务及治理,应用现代化、Spring等领域都有技术积累,同时具备CNCF CKA、CNCF CKS、Spring Professional等认证。

来源|公众号:VMwareTanzu云原生

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值