Method: Gitlab::Client::ProjectClusters#add_project_cluster

Defined in:
lib/gitlab/client/project_clusters.rb

#add_project_cluster(project, name, options = {}) ⇒ Gitlab::ObjectifiedHash

Adds an existing Kubernetes cluster to the project.

Examples:

Gitlab.add_project_cluster(5, 'cluster-5', { enabled: false, platform_kubernetes_attributes: { api_url: 'https://35.111.51.20', token: '12345', ca_cert: "-----BEGIN CERTIFICATE-----\r\nhFiK1L61owwDQYJKoZIhvcNAQELBQAw\r\nLzEtMCsGA1UEAxMkZDA1YzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM4ZDBj\r\nMB4XDTE4MTIyNzIwMDM1MVoXDTIzMTIyNjIxMDM1MVowLzEtMCsGA1UEAxMkZDA1\r\nYzQ1YjctNzdiMS00NDY0LThjNmEtMTQ0ZDJkZjM.......-----END CERTIFICATE-----", namespace: 'cluster-5-namespace', authorization_type: 'rbac' } })
Gitlab.add_project_cluster(5, 'cluster-5', { platform_kubernetes_attributes: { api_url: 'https://35.111.51.20', token: '12345' } })

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • name (String)

    The name of the existing cluster.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :enabled(optional) (Boolean)

    Determines if cluster is active or not, defaults to true

  • :platform_kubernetes_attributes (Hash)

    A customizable set of Kubernetes platform attributes

Returns:



47
48
49
50
# File 'lib/gitlab/client/project_clusters.rb', line 47

def add_project_cluster(project, name, options = {})
  body = { name: name }.merge(options)
  post("/projects/#{url_encode project}/clusters/user", body: body)
end