summaryrefslogtreecommitdiff
path: root/docs/gl_objects/clusters.rst
blob: ff39dcc89f39a0f65d636b3789f2d723e907959c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#####################
Clusters (DEPRECATED) 
#####################

.. warning::
   Cluster support was deprecated in GitLab 14.5 and disabled by default as of
   GitLab 15.0


Reference
---------

* v4 API:

  + :class:`gitlab.v4.objects.ProjectCluster`
  + :class:`gitlab.v4.objects.ProjectClusterManager`
  + :attr:`gitlab.v4.objects.Project.clusters`
  + :class:`gitlab.v4.objects.GroupCluster`
  + :class:`gitlab.v4.objects.GroupClusterManager`
  + :attr:`gitlab.v4.objects.Group.clusters`

* GitLab API: https://docs.gitlab.com/ee/api/project_clusters.html
* GitLab API: https://docs.gitlab.com/ee/api/group_clusters.html

Examples
--------

List clusters for a project::

    clusters = project.clusters.list()

Create an cluster for a project::

    cluster = project.clusters.create(
    {
        "name": "cluster1",
        "platform_kubernetes_attributes": {
            "api_url": "http://url",
            "token": "tokenval",
        },
    })

Retrieve a specific cluster for a project::

    cluster = project.clusters.get(cluster_id)

Update an cluster for a project::

    cluster.platform_kubernetes_attributes = {"api_url": "http://newurl"}
    cluster.save()

Delete an cluster for a project::

    cluster = project.clusters.delete(cluster_id)
    # or
    cluster.delete()


List clusters for a group::

    clusters = group.clusters.list()

Create an cluster for a group::

    cluster = group.clusters.create(
    {
        "name": "cluster1",
        "platform_kubernetes_attributes": {
            "api_url": "http://url",
            "token": "tokenval",
        },
    })

Retrieve a specific cluster for a group::

    cluster = group.clusters.get(cluster_id)

Update an cluster for a group::

    cluster.platform_kubernetes_attributes = {"api_url": "http://newurl"}
    cluster.save()

Delete an cluster for a group::

    cluster = group.clusters.delete(cluster_id)
    # or
    cluster.delete()