Marketplace API overview

The Marketplace API uses Kubernetes custom resources and relies on the Kubernetes Resource Model. The APIs are used for the provisioning and administration of the Marketplace services in a given project through actions that include installing, upgrading, and uninstalling. The GDC Marketplace APIs are also used to see available versions, create, modify, or delete objects in your project to install, upgrade, or uninstall instances of a service.

Service endpoint and discovery document

The following URL is the API endpoint for the Marketplace APIs: https://MANAGEMENT_API_SERVER_ENDPOINT/apis/marketplace.gdc.goog/v1 where MANAGEMENT_API_SERVER_ENDPOINT is the endpoint of the Management API server.

Using the kubectl proxy command, you can access that URL in your browser or with a tool such as curl to get the discovery document for the Marketplace API. The kubectl proxy command opens up a proxy to the Kubernetes API server on your local machine. When the command is running, access the document at the following URL:

http://127.0.0.1:8001/apis/marketplace.gdc.goog/v1

Service instance manifest format

The following is the format of a ServiceInstance resource:

apiVersion: marketplace.gdc.goog/v1
kind: ServiceInstance
metadata:
  name: INSTANCE_NAME
spec:
  clusterRef:
    name: CLUSTER_NAME
    namespace: CLUSTER_NAMESPACE
  serviceVersionRef:
    name: SERVICE_VERSION_NAME
    namespace: mkt-system

Replace the following:

  • INSTANCE_NAME: a name for your new application instance
  • CLUSTER_NAME: the name of the target user cluster where you want to install the application
  • CLUSTER_NAMESPACE: the namespace of the cluster (for example, production-cluster)
  • SERVICE_VERSION_NAME: the name of the ServiceVersion to install (for example, dataproc-1.0.0)

To install a service, create this object in a project's namespace with kubectl apply, as described in Install a Distributed Cloud marketplace software package. To upgrade a service instance, modify it to indicate which version of that service. You can modify the object directly with an HTTP client or by using the kubectl apply, kubectl patch, or kubectl edit commands. To uninstall a service instance, delete the object with kubectl delete.

Example KRM

The following is an example of a ServiceInstance object in the Marketplace API of Dataproc Container for Spark:

apiVersion: marketplace.gdc.goog/v1
kind: ServiceInstance
metadata:
  name: dataproc-service
spec:
  clusterRef:
    name: production
    namespace: production-cluster
  serviceVersionRef:
    name: dataproc-1.0.0
    namespace: mkt-system
status:
  # Currently installed version of the service
  installedVersion: 1.0.0
  # Current conditions of the service (see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#condition-v1-meta)
  conditions:
    ...