Configuring catalog items through manifest.yml file

蓝咒 提交于 2019-12-13 20:47:54

问题


Using spring-cloud-cloudfoundry-service-broker we developed a service broker.
Initially we defined catalog items within application.yml file which gets bundled inside jar and this all works great.

Instead of bundling catalog items within jar file, we thought of supplying through manifest.yml file while pushing the service to cloud foundry. But unfortunately application is not getting the catalog items specified in manigest.yml file. Could you please let us know how do we supply catalog items through manifest.yml file?

I have copied my code snippet here.

CatalogConfig.java

@ConfigurationProperties(prefix = "catalog")
@Component
public class CatalogConfig {
private List<ServiceDefinitionProxy> services;

public CatalogConfig() {
    super();
}

@Bean
Catalog catalog() {
    return new Catalog(services.stream().map(s -> s.unproxy())
            .collect(Collectors.toList()));
}

public CatalogConfig(List<ServiceDefinitionProxy> services) {
    super();
    this.services = services;
}

public List<ServiceDefinitionProxy> getServices() {
    return services;
}

public void setServices(List<ServiceDefinitionProxy> services) {
    this.services = services;
}

public ServiceDefinitionProxy findServiceDefinition(String serviceId) {
    return services.stream().filter(s -> s.getId().equals(serviceId))
            .findFirst().get();
}
}    

Manifest.yml

---
applications:
- name: my-service-broker
  memory: 512M
  instances: 1
  host: my-service-broker
  path: target/my-service-broker-1.0.0-SNAPSHOT.jar
  env: 
    SPRING_PROFILES_DEFAULT: cloud
catalog:
    services:
      - id: f1478faa-d980-11e5-b5d2-0a1d41d68578
        name: api-marketpace
        description: API Marketplace
        bindable: true
        planUpdatable: true
        head-type: api
        tags:
          - api
          - Manage API Marketplace
        metadata:
          displayName: API Marketplace
          imageUrl: https://my-service-broker.cf.com/images/logo.PNG
          longDescription: API Marketplace.
          providerDisplayName: API Team
          documentationUrl: https://wikihub.com/display/ASC/Training
          supportUrl: https://wikihub.com/display/ASC/Training
        plans:
          - id: f1478faa-d980-11e5-b5d2-0a1d41d68579
            name: unlimited
            description: free
            metadata:
              costs:
                - amount:
                    usd: 0.00
                  unit: PER MONTH
              bullets:
                - Basic Unlimited
        dashboardClient:
          id: api-marketpace
          secret: secret
          redirectUrl: https://api.cf.com/

回答1:


That won't work.

The manifest.yml file is used exclusively by the cf CLI to provide options when pushing apps to CF. Deployed applications never see this file or any of its contents. In fact the CF platform itself never sees the file or its contents - it is purely processed by the CLI on the client side.

The application.yml file is used by Spring Boot and the contents are provided to the app via @ConfigurationProperties and other means.

These are two completely separate concepts and mechanisms, both of which happen to use the YAML data format.



来源:https://stackoverflow.com/questions/35641240/configuring-catalog-items-through-manifest-yml-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!