openshift/ansible-service-broker

Broker fails to discover HELM charts if absolute URL is not present in index.yaml

ddskit opened this issue · 3 comments

This form is for bug reports and feature requests. Major features will go through a spec process.

Feature:

Bug:

I was trying to use ansible service broker with private HELM repository. There is a code written in ansible service broker to get the chart url details from index.yaml in order to create the bundle spec and bundle plan in following file:

func (r *HelmAdapter) FetchSpecs(imageNames []string) ([]*bundle.Spec, error) {

 		if len(chart.URLs) > 0 {
			resp, err := http.Get(chart.URLs[0])
			if err != nil {
				continue
			}
			defer resp.Body.Close()

			values = r.loadArchive(resp.Body)
		}

There can be scenarios where this url is not a absolute url in index.yaml or the url is not directly accessible from openshift cluster but accessible through a proxy . If the url or path given in index.yaml is not accessible from openshift cluster directly, then helm chart discovery fails.

Broker logs:

Using config file mounted to /etc/ansible-service-broker/config.yaml
============================================================
== Creating Ansible Service Broker... ==
============================================================
time="2019-12-17T12:54:04Z" level=info msg="Ansible Service Broker Version: 1.3.21"
time="2019-12-17T12:54:04Z" level=info msg="Initializing clients..."
time="2019-12-17T12:54:04Z" level=debug msg="Connecting to Cluster"
time="2019-12-17T12:54:04Z" level=info msg="OpenShift version: v3.11.0+0731b2f-347"
time="2019-12-17T12:54:04Z" level=debug msg="plugin for the network - redhat/openshift-ovs-subnet"
time="2019-12-17T12:54:04Z" level=info msg="Kubernetes version: v1.11.0+d4cacc0"
time="2019-12-17T12:54:04Z" level=debug msg="Connecting Dao"
time="2019-12-17T12:54:04Z" level=debug msg="Connecting Registry"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get user from config"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get pass from config"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get token from config"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get org from config"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get tag from config"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get images from config"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get namespaces from config"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get fail_on_error from config"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get black_list from config"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get auth_type from config"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get auth_name from config"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get skip_verify_tls from config"
time="2019-12-17T12:54:04Z" level=info msg="Empty AuthType. Assuming credentials are defined in the config... "
time="2019-12-17T12:54:04Z" level=info msg="== REGISTRY CX == "
time="2019-12-17T12:54:04Z" level=info msg="Name: stable"
time="2019-12-17T12:54:04Z" level=info msg="Type: helm"
time="2019-12-17T12:54:04Z" level=info msg="Url: http://:8084/nexus/repository/my-helm-release/ "
time="2019-12-17T12:54:04Z" level=debug msg="Creating filter for registry: stable"
time="2019-12-17T12:54:04Z" level=debug msg="whitelist: [.*]"
time="2019-12-17T12:54:04Z" level=debug msg="blacklist: []"
time="2019-12-17T12:54:04Z" level=debug msg="Initializing WorkEngine"
time="2019-12-17T12:54:04Z" level=debug msg="Creating AnsibleBroker"
time="2019-12-17T12:54:04Z" level=debug msg="Unable to get dashboard_redirector from config"
============================================================
== Starting Ansible Service Broker... ==
============================================================
time="2019-12-17T12:54:04Z" level=info msg="Initiating Recovery Process"
time="2019-12-17T12:54:04Z" level=info msg="Recovery complete"
time="2019-12-17T12:54:04Z" level=info msg="recover called"
time="2019-12-17T12:54:04Z" level=info msg="Broker configured to bootstrap on startup"
time="2019-12-17T12:54:04Z" level=info msg="Attempting bootstrap..."
time="2019-12-17T12:54:04Z" level=info msg="AnsibleBroker::Bootstrap"
time="2019-12-17T12:54:04Z" level=debug msg="Dao::BatchGetSpecs"
time="2019-12-17T12:54:04Z" level=debug msg="Dao::BatchGetBundleInstances"
time="2019-12-17T12:54:04Z" level=debug msg="markedSpecs: map[]\n"
time="2019-12-17T12:54:04Z" level=info msg="0 specs deleted"
time="2019-12-17T12:54:04Z" level=debug msg="Dao::BatchGetSpecs"
time="2019-12-17T12:54:04Z" level=debug msg="converting []*Spec to SpecManifest successful"
time="2019-12-17T12:54:04Z" level=debug msg="Filter applied against registry: stable"
time="2019-12-17T12:54:04Z" level=debug msg="Bundles passing white/blacklist filter:"
time="2019-12-17T12:54:04Z" level=debug msg="-> mysql"
time="2019-12-17T12:54:04Z" level=debug msg="-> redis"
time="2019-12-17T12:54:04Z" level=info msg="Validating specs..."
time="2019-12-17T12:54:04Z" level=info msg="All specs passed validation!"
time="2019-12-17T12:54:04Z" level=info msg="Broker successfully bootstrapped on startup"
time="2019-12-17T12:54:04Z" level=debug msg="RefreshInterval: 10m0s"
time="2019-12-17T12:54:04Z" level=debug msg="calling NewSecureServingOptions"
time="2019-12-17T12:54:05Z" level=debug msg="Creating k8s apiserver"
time="2019-12-17T12:54:05Z" level=info msg="Listening on https://[::]:1338"
time="2019-12-17T12:54:05Z" level=info msg="Ansible Service Broker Starting"
time="2019-12-17T12:56:51Z" level=debug msg="Unable to find originating origin header"

What happened:
In the logs, image names were discovered from helm repository but because the relative path is given in index.yaml , spec and plan creation fails for these images and they are not added in crd or etcd to be fetched by service catalog.

index.yaml:

apiVersion: v1
entries:
  redis:
  - apiVersion: v1
    appVersion: 5.0.7
    created: 2019-12-16T12:28:36.013725518Z
    description: Open source, advanced key-value store. It is often referred to as
      a data structure server since keys can contain strings, hashes, lists, sets
      and sorted sets.
    digest: eac28bbdddfcf493aca06379cb70bdfa390e83a41b4096278962f15bffda2612
    engine: gotpl
    home: http://redis.io/
    icon: https://bitnami.com/assets/stacks/redis/img/redis-stack-220x234.png
    keywords:
    - redis
    - keyvalue
    - database
    maintainers:
    - email: containers@bitnami.com
      name: Bitnami
    - email: cedric@desaintmartin.fr
      name: desaintmartin
    name: redis
    sources:
    - https://github.com/bitnami/bitnami-docker-redis
    urls:
    - redis-10.2.1.tgz
    version: 10.2.1

What you expected to happen:

If there is a relative path given in index.yaml, it should be appended with the url of the repository given in the broker-config with helm registry type.
If there is another url given in index.yaml and if it not accessible directly from the openshift cluster, then it should be replaced with the url given in broker-config with helm registry from where the image names were fetched in first place.

/close please reopen if this is still an issue.

/close

@jmrodri: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.