You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/SDDs/pages/0032-compile-pipeline-gitlab.adoc
+24-15Lines changed: 24 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -105,20 +105,25 @@ spec:
105
105
106
106
=== Tenant CRD
107
107
108
-
We add a new field to the `Tenant` CRD, under the `.spec` key, called `compilePipeline`.
108
+
We add new fields to the `Tenant` CRD: `spec.compilePipeline` and `status.compilePipeline`
109
109
110
-
The `compilePipeline` field contains configuration pertaining to the automatic setup of the compile pipeline on the tenant repository.
110
+
The `spec.compilePipeline` field contains configuration pertaining to the automatic setup of the compile pipeline on the tenant repository.
111
111
It is optional.
112
-
Absence of the field disables automatic setup and management of the compile pipeline.
113
112
114
-
The `compilePipeline` field contains a dict with the following fields:
113
+
The `spec.compilePipeline` field contains a dict with the following fields:
115
114
116
-
* `clusters`: List of cluster IDs of clusters for which the compile pipeline should be executed.
117
-
This field is managed by the operator.
115
+
* `enabled`: Boolean field which enables or disables automatic setup of compile pipelines for this tenant (regardless of whether it is enabled on the tenant's clusters).
118
116
* `pipelineFiles`: Dictionary containing file paths as keys, and file contents as values.
119
117
These files will be added to the tenant's `gitRepoTemplate.templateFiles` by the Lieutenant operator.
120
118
This field is optional; if absent, no new template files are added to the `gitRepoTemplate`.
121
119
120
+
`spec.compilePipeline` is optional. Its absence disables automatic setup of compile pipelines for the tenant, as does setting `spec.compilePipeline.enabled` to `false`.
121
+
122
+
The `status.compilePipeline` field contains a dict with one field:
123
+
124
+
* `clusters`: List of cluster IDs of clusters for which the compile pipeline should be executed.
125
+
This field is managed by the operator.
126
+
122
127
[source,yaml]
123
128
----
124
129
apiVersion: syn.tools/v1alpha1
@@ -127,14 +132,16 @@ metadata:
127
132
name: t-my-tenant
128
133
spec:
129
134
compilePipeline:
130
-
clusters:
131
-
- c-my-cluster
132
135
pipelineFiles:
133
136
.gitlab-ci.yml: |
134
137
include:
135
138
- project: syn/commodore-compile-pipeline
136
139
ref: master
137
140
file: /.gitlab/commodore-common.yml
141
+
status:
142
+
compilePipeline:
143
+
clusters:
144
+
- c-my-cluster
138
145
----
139
146
140
147
=== Operator
@@ -151,6 +158,8 @@ The operator will reconcile *GitRepos* as follows:
151
158
The operator also runs a scheduled job which refreshes these tokens when they are close to expiring, or when they no longer exist on the repository host.
152
159
* The content of `.spec.ciVariables` is written to the repository's configuration on the Git host.
153
160
In the case of GitLab, it is written as CI/CD variables.
161
+
If the content of `.spec.ciVariables` changes, the corresponding configuration on the Git host should be updated.
162
+
A scheduled job in the ooperator regularly checks for drift between `.spec.ciVariables` and the configuration on the Git host, and updates the latter if necessary.
154
163
155
164
NOTE: If the GitRepo is of type `unmanaged`, none of these steps will be executed.
156
165
@@ -159,13 +168,13 @@ The operator will reconcile *Clusters* as follows:
159
168
* When `.spec.enableCompilePipeline` is set to `true`, the tenant's `spec.compilePipeline.clusters` is updated to contain the cluster ID.
160
169
* Similarly, when the field is set to `false` or missing, the tenant's `spec.compilePipeline.clusters` is updated to not contain the cluster ID.
161
170
162
-
The operator will reconcile *Tenants* as follows:
171
+
The operator will reconcile *Tenants* as follows, if and only if `spec.compilePipeline.enabled` is set to `true`:
163
172
164
-
* When `.spec.compilePipeline` exists and isn't empty, the following entries are added to the tenant repository GitRepo's `.spec.ciVariables`:
173
+
* The following entries are added to the tenant repository GitRepo's `.spec.ciVariables`:
165
174
** `COMMODORE_API_URL`, containing the URL at which the Lieutenant API can be accessed.
166
175
** `COMMODORE_API_TOKEN`, containing a reference to the secret which contains the tenant's access token for the Lieutenant API.
167
-
** `CLUSTERS`, containing a space-separated list of cluster IDs taken directly from `.spec.compilePipeline.clusters`.
168
-
* For each entry in `.spec.compilePipeline.clusters`, another entry is added to the tenant repository GitRepo's `spec.ciVariabes`.
176
+
** `CLUSTERS`, containing a space-separated list of cluster IDs taken directly from `.status.compilePipeline.clusters`.
177
+
* For each entry in `.status.compilePipeline.clusters`, another entry is added to the tenant repository GitRepo's `spec.ciVariabes`.
169
178
The key is `ACCESS_TOKEN_CLUSTERNAME`, where `CLUSTERNAME` is the ID of a specific cluster, with `-` replaced by `_`.
170
179
The value is a reference to the secret containing the access token to access that cluster's catalog repository, taken from the secret specified in the catalog GitRepo configuration under `.spec.accessTokenSecretName`.
171
180
* For each entry in `.spec.compilePipeline.pipelineFiles`, a new corresponding entry is added to the tenant's `.spec.gitRepoTemplate.templateFiles`.
@@ -178,12 +187,12 @@ The implementation takes care to gracefully skip the CI steps if not on GitLab.
178
187
We leave the implementation extensible enough to add further Git management tools and CI systems without needing breaking changes.
179
188
180
189
Existing compile pipeline configuration::
181
-
If a setup already includes a bunch of tenant repositories with manually configured CI/CD, some care has to be taken to ensure the new implementation can "adopt" this configuration.
190
+
If a setup already includes a bunch of tenant repositories with manually configured CI/CD, in the general case, the new implementation can "adopt" this configuration.
182
191
+
183
-
In particular, these repositories would already have a working `.gitlab-ci.yml` that probably can be left as-is.
192
+
In particular, these repositories would already have a working `.gitlab-ci.yml` that probably could be left as-is, but can also be replaced by a lieutenant-managed one.
184
193
+
185
194
Any existing manually created Project Access Tokens will be superseded by new auto-generated ones.
186
-
This will lead to a bunch of now-unused tokens needing to be cleaned up.
195
+
This will lead to a bunch of now-unused tokens needing to be cleaned up, but should otherwise work without requiring extra effort.
187
196
188
197
External Catalog Repositories::
189
198
There may be cases where the catalog repositories are not hosted on the same repository host as the tenant repository, in which case API access for the purpose of creating Project Access Tokens is unavailable.
0 commit comments