-
Notifications
You must be signed in to change notification settings - Fork 199
/
gitlab.yml
135 lines (125 loc) · 4.29 KB
/
gitlab.yml
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
- name: Deploy gitlab on OCP
hosts: localhost
gather_facts: false
tasks:
- name: Create cert-manager-operator namespace
redhat.openshift.k8s:
name: cert-manager-operator
api_version: v1
kind: Namespace
state: present
- name: Create OperatorGroup object for cert-manager-operator
redhat.openshift.k8s:
state: present
definition:
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: cert-manager-operator-operatorgroup
namespace: cert-manager-operator
spec:
targetNamespaces:
- cert-manager-operator
- name: Create cert-manager-operator subscription
redhat.openshift.k8s:
state: present
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
labels:
operators.coreos.com/openshift-cert-manager-operator.cert-manager-operator: ''
name: openshift-cert-manager-operator
namespace: cert-manager-operator
spec:
channel: stable-v1
installPlanApproval: Automatic
name: openshift-cert-manager-operator
source: redhat-operators
sourceNamespace: openshift-marketplace
- name: Create gitlab-system namespace
redhat.openshift.k8s:
name: gitlab-system
api_version: v1
kind: Namespace
state: present
- name: Create OperatorGroup object for gitlab-operator-kubernetes
redhat.openshift.k8s:
state: present
definition:
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: gitlab-operator-kubernetes-operatorgroup
namespace: gitlab-system
spec:
targetNamespaces:
- gitlab-system
- name: Create gitlab subscription
redhat.openshift.k8s:
state: present
definition:
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
labels:
operators.coreos.com/gitlab-operator-kubernetes.gitlab-system: ''
name: gitlab-operator-kubernetes
namespace: gitlab-system
spec:
channel: stable
installPlanApproval: Automatic
name: gitlab-operator-kubernetes
source: community-operators
sourceNamespace: openshift-marketplace
- name: Wait for gitlab operator to install
kubernetes.core.k8s_info:
api_version: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
name: gitlabs.apps.gitlab.com
register: crd_gitlab
until: crd_gitlab.resources | list | length == 1
retries: 10
delay: 30
- name: Wait until gitlab-operator is up
kubernetes.core.k8s_info:
api_version: v1
kind: Deployment
name: gitlab-controller-manager
namespace: gitlab-system
register: pod_list
until: pod_list | json_query('resources[*].status.readyReplicas') | unique >= [1]
retries: 10
delay: 30
- name: Grab url for Gitlab spec
ansible.builtin.set_fact:
cluster_domain: "apps{{ lookup('ansible.builtin.env', 'K8S_AUTH_HOST') | regex_search('\\.[^:]*') }}"
when: cluster_domain is undefined
- name: Deploy a GitLab instance
redhat.openshift.k8s:
state: present
definition:
apiVersion: apps.gitlab.com/v1beta1
kind: GitLab
metadata:
name: gitlab
namespace: gitlab-system
spec:
chart:
version: "{{ gitlab_chart_version }}"
values:
nginx-ingress:
enabled: false
certmanager:
install: false
global:
hosts:
domain: "{{ cluster_domain }}" # apps.cluster-9xrlv.9xrlv.sandbox644.opentlc.com
ingress:
class: none
configureCertmanager: true
annotations:
route.openshift.io/termination: "edge"
certmanager-issuer:
email: "{{ cert_email | default('nobody@nowhere.nosite') }}"