Skip to content

Commit

Permalink
Make global lock ConfigMap removable (#1530)
Browse files Browse the repository at this point in the history
In the current setup the `nativelink-image-tags` configmap acts as a
global lock for the nativelink kustomization. This means that it's not
possible to change toolchain configurations after the fact.

This change makes the config map name configurable to allow for setups
that need more flexibility, such as multi-toolchain setups or setups
where worker types change over time.
  • Loading branch information
aaronmondal authored Dec 9, 2024
1 parent 2c1643d commit 8782c0b
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 4 deletions.
5 changes: 4 additions & 1 deletion kubernetes/components/operator/flux-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ spec:
name: nativelink-webhook
eventMetadata:
flakeOutput: github:TraceMachina/nativelink#image
configMapName: nativelink-image-tags
---
apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Alert
Expand All @@ -50,6 +51,7 @@ spec:
name: nativelink-webhook
eventMetadata:
flakeOutput: github:TraceMachina/nativelink#nativelink-worker-init
configMapName: nativelink-image-tags
---
apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Alert
Expand All @@ -66,6 +68,7 @@ spec:
name: nativelink-webhook
eventMetadata:
flakeOutput: "PLACEHOLDER_NATIVELINK_WORKER"
configMapName: nativelink-image-tags
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
Expand Down Expand Up @@ -117,7 +120,7 @@ metadata:
namespace: default
spec:
interval: 2m
path: "./kubernetes/components/tekton-resources"
path: "./kubernetes/resources/tekton"
prune: true
force: true
retryInterval: 20s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- cosign-verify.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ spec:
image.
- "github:<user>/<repo>?ref=pull/<PR_NUMBER>/head#<PACKAGE>" to use
an image from a pull request of a repository on GitHub.
- name: configMapName
type: string
description: |
The name of the ConfigMap that we write the image tag to.
Other parts of the cluster may refer to this configmap to get the
pre-evaluated tag of the image.
- name: registry
type: string
description: |
Expand Down Expand Up @@ -172,6 +179,8 @@ spec:
value: "$(tasks.get-image-info.results.imageName)"
- name: imageTag
value: "$(tasks.get-image-info.results.imageTag)"
- name: configMapName
value: "$(params.configMapName)"
runAfter:
- copy-verified-prebuilt-image
- copy-nix-built-image
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ spec:
image.
- "github:<user>/<repo>?ref=pull/<PR_NUMBER>/head#<PACKAGE>" to use
an image from a pull request of a repository on GitHub.
- name: configMapName
description: |
The name of the ConfigMap that we write the image tag to.
Other parts of the cluster may refer to this configmap to get the
pre-evaluated tag of the image.
resourcetemplates:
- apiVersion: tekton.dev/v1beta1
kind: PipelineRun
Expand All @@ -76,6 +82,8 @@ spec:
params:
- name: flakeOutput
value: "$(tt.params.flakeOutput)"
- name: configMapName
value: "$(tt.params.configMapName)"
- name: registry
value: "kind-registry:5000"
- name: destTLSverify
Expand All @@ -91,6 +99,8 @@ spec:
params:
- name: flakeOutput
value: "$(body.metadata.flakeOutput)"
- name: configMapName
value: "$(body.metadata.configMapName)"
---
apiVersion: v1
kind: ServiceAccount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ spec:
params:
- name: imageName
- name: imageTag
- name: configMapName
steps:
- name: update-configmap
image: bitnami/kubectl
env:
- name: CM_NAME
value: "nativelink-image-tags"
value: "$(params.configMapName)"
script: |
#!/bin/bash
set -e
Expand Down

0 comments on commit 8782c0b

Please sign in to comment.