refactor(tekton): own shared CI policies in platform
This commit is contained in:
1 parent
67356b1489
commit
083eae7f8c
5 files changed
+91
-8
No files matched your search
@@ -13,10 +13,6 @@ spec:
|
|||||||
- server: https://kubernetes.default.svc
|
- server: https://kubernetes.default.svc
|
||||||
namespace: tekton-ci
|
namespace: tekton-ci
|
||||||
namespaceResourceWhitelist:
|
namespaceResourceWhitelist:
|
||||||
- group: ""
|
|
||||||
kind: ResourceQuota
|
|
||||||
- group: ""
|
|
||||||
kind: LimitRange
|
|
||||||
- group: ""
|
- group: ""
|
||||||
kind: ServiceAccount
|
kind: ServiceAccount
|
||||||
- group: rbac.authorization.k8s.io
|
- group: rbac.authorization.k8s.io
|
||||||
|
|||||||
@@ -87,6 +87,50 @@ service-state/
|
|||||||
Tekton controllers stay in `tekton-pipelines`. Application PipelineRuns and
|
Tekton controllers stay in `tekton-pipelines`. Application PipelineRuns and
|
||||||
their credentials run in the isolated `tekton-ci` namespace.
|
their credentials run in the isolated `tekton-ci` namespace.
|
||||||
|
|
||||||
|
The `tekton-ci` namespace is shared by all service CI applications. Its
|
||||||
|
ResourceQuota and LimitRange are owned by the `tekton-config` Argo CD Application
|
||||||
|
from `platform/tekton/config/ci-resource-policy.yaml`. Their legacy resource name
|
||||||
|
`lolympus-ci` is retained to transfer ownership without recreating either object;
|
||||||
|
it does not restrict the policies to the lolympus service. The service `ci`
|
||||||
|
AppProject does not permit ResourceQuota or LimitRange resources.
|
||||||
|
|
||||||
|
The shared quota permits at most 15 PipelineRuns, 15 PVCs requesting a total of
|
||||||
|
150 GiB, and 150 TaskRuns. The job-based pruner runs at minute 00, 15, 30, and 45
|
||||||
|
of every hour and retains the newest 10 completed PipelineRuns per namespace,
|
||||||
|
across pipeline names and success/failure outcomes. Running and pending runs are
|
||||||
|
protected and are additional to the retained completed history. Child TaskRuns,
|
||||||
|
Pods, and workspace PVCs follow their owning PipelineRun's deletion; TaskRuns
|
||||||
|
are not pruned independently. If 15 runs accumulate before pruning frees a slot,
|
||||||
|
the quota rejects further PipelineRun creation.
|
||||||
|
|
||||||
|
### Transferring the shared resource policies
|
||||||
|
|
||||||
|
This transfer spans two repositories with independent automatic synchronization.
|
||||||
|
Do not rely on Application sync waves to order commits across the repositories.
|
||||||
|
For an existing cluster where `lolympus-tournament-support-ci` owns the policies:
|
||||||
|
|
||||||
|
1. Wait for active sync operations to finish. Temporarily disable automated sync
|
||||||
|
on `platform-root`, `tekton-config`, and `lolympus-tournament-support-ci`,
|
||||||
|
preserving their existing sync policy for restoration.
|
||||||
|
2. Record the UID and tracking annotation of both existing `lolympus-ci` objects
|
||||||
|
in `tekton-ci`. Add the temporary resource annotation
|
||||||
|
`argocd.argoproj.io/sync-options: Prune=false` to both objects.
|
||||||
|
3. Publish the service-state removal and platform-state adoption commits. Sync
|
||||||
|
`lolympus-tournament-support-ci` to the removal commit first. The protected
|
||||||
|
policies must remain present even though they are no longer desired there.
|
||||||
|
4. Sync `tekton-config` to the adoption commit. Verify both objects retain their
|
||||||
|
UIDs and now have tracking IDs beginning with `tekton-config:`. Verify the
|
||||||
|
quota values and the generated pruner CronJob's schedule and keep arguments.
|
||||||
|
5. Refresh the old Application and confirm it no longer tracks either policy.
|
||||||
|
Remove only the temporary `Prune=false` annotation after adoption succeeds.
|
||||||
|
6. Restore automated sync on the child Applications, then sync `platform-root`
|
||||||
|
to apply the tightened `ci` AppProject permissions and restore its automation.
|
||||||
|
Confirm all three Applications are Synced and Healthy.
|
||||||
|
|
||||||
|
If adoption fails, leave the existing policies protected and avoid syncing the
|
||||||
|
new AppProject restrictions until ownership is resolved. Do not delete and
|
||||||
|
recreate the policies or remove unrelated sync-option annotations.
|
||||||
|
|
||||||
## Registering Additional Service CI
|
## Registering Additional Service CI
|
||||||
|
|
||||||
CI directories in `service-state` are registered explicitly; the service
|
CI directories in `service-state` are registered explicitly; the service
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# Preserve the existing names so Argo CD can adopt the shared policies in place.
|
||||||
|
# These policies apply to all services in tekton-ci, not only lolympus.
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ResourceQuota
|
||||||
|
metadata:
|
||||||
|
name: lolympus-ci
|
||||||
|
namespace: tekton-ci
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: tekton-ci
|
||||||
|
app.kubernetes.io/part-of: tekton-ci
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
spec:
|
||||||
|
hard:
|
||||||
|
pods: "20"
|
||||||
|
# Reserve room for new runs between pruning the completed history to 10 runs.
|
||||||
|
persistentvolumeclaims: "15"
|
||||||
|
# Tekton steps run sequentially, but quota sums their container limits.
|
||||||
|
# Bound compute requests here; retain per-container limits in Tasks/LimitRange.
|
||||||
|
requests.cpu: "8"
|
||||||
|
requests.memory: 16Gi
|
||||||
|
requests.storage: 150Gi
|
||||||
|
count/pipelineruns.tekton.dev: "15"
|
||||||
|
count/taskruns.tekton.dev: "150"
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: LimitRange
|
||||||
|
metadata:
|
||||||
|
name: lolympus-ci
|
||||||
|
namespace: tekton-ci
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: tekton-ci
|
||||||
|
app.kubernetes.io/part-of: tekton-ci
|
||||||
|
app.kubernetes.io/managed-by: argocd
|
||||||
|
spec:
|
||||||
|
limits:
|
||||||
|
- type: Container
|
||||||
|
defaultRequest:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 256Mi
|
||||||
|
default:
|
||||||
|
cpu: "2"
|
||||||
|
memory: 4Gi
|
||||||
@@ -4,3 +4,4 @@ resources:
|
|||||||
- tektonconfig.yaml
|
- tektonconfig.yaml
|
||||||
- ingress.yaml
|
- ingress.yaml
|
||||||
- eventlistener-rbac.yaml
|
- eventlistener-rbac.yaml
|
||||||
|
- ci-resource-policy.yaml
|
||||||
@@ -9,9 +9,9 @@ spec:
|
|||||||
readonly: false
|
readonly: false
|
||||||
pruner:
|
pruner:
|
||||||
disabled: false
|
disabled: false
|
||||||
schedule: "15 * * * *"
|
schedule: "*/15 * * * *"
|
||||||
resources:
|
resources:
|
||||||
- taskrun
|
|
||||||
- pipelinerun
|
- pipelinerun
|
||||||
keep: 5
|
# Keep the newest completed runs across each namespace; child resources follow their owner.
|
||||||
prune-per-resource: true
|
keep: 10
|
||||||
|
prune-per-resource: false
|
||||||
Reference in new issue
Block a user