Skip to content

Commit

Permalink
Apply TargetNamespace to Dashboard contaner args
Browse files Browse the repository at this point in the history
  • Loading branch information
aThorp96 committed Jan 27, 2025
1 parent 97819ea commit 5c3445d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions pkg/reconciler/kubernetes/tektondashboard/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, td *v1alpha1.TektonDashb
// and hence deleting the component in the integration tests, targetNamespace was getting deleted. Hence
// filtering out the namespace here
manifest = manifest.Filter(mf.Not(mf.ByKind("Namespace")))

if err := r.installerSetClient.MainSet(ctx, td, &manifest, filterAndTransform(r.extension)); err != nil {
msg := fmt.Sprintf("Main Reconcilation failed: %s", err.Error())
logger.Error(msg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,15 +404,15 @@ spec:
app.kubernetes.io/name: dashboard
app.kubernetes.io/part-of: tekton-dashboard
app.kubernetes.io/version: v0.48.0
operator.tekton.dev/deployment-spec-applied-hash: 0d7e625dccc2efab4493c409bdc71e88
operator.tekton.dev/deployment-spec-applied-hash: e521024acd6c6a280dc53fb4de0a6725
name: tekton-dashboard
spec:
containers:
- args:
- --port=9097
- --logout-url=
- --pipelines-namespace=tekton-pipelines
- --triggers-namespace=tekton-pipelines
- --pipelines-namespace=foo-ns
- --triggers-namespace=foo-ns
- --read-only=false
- --log-level=info
- --log-format=json
Expand Down
5 changes: 4 additions & 1 deletion pkg/reconciler/kubernetes/tektondashboard/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const (
func filterAndTransform(extension common.Extension) client.FilterAndTransform {
return func(ctx context.Context, manifest *mf.Manifest, comp v1alpha1.TektonComponent) (*mf.Manifest, error) {
dashboard := comp.(*v1alpha1.TektonDashboard)
targetNamespace := dashboard.Spec.GetTargetNamespace()


images := common.ToLowerCaseKeys(common.ImagesFromEnv(common.DashboardImagePrefix))

Expand All @@ -42,6 +44,7 @@ func filterAndTransform(extension common.Extension) client.FilterAndTransform {
common.AddConfiguration(dashboard.Spec.Config),
common.AddDeploymentRestrictedPSA(),
common.DeploymentImages(images),
common.ReplaceNamespaceInDeploymentArgs([]string{dashboardDeploymentName}, targetNamespace),
}
trns = append(trns, extra...)
if dashboard.Spec.ExternalLogs != "" {
Expand All @@ -54,7 +57,7 @@ func filterAndTransform(extension common.Extension) client.FilterAndTransform {

// additional options transformer
// always execute as last transformer, so that the values in options will be final update values on the manifests
if err := common.ExecuteAdditionalOptionsTransformer(ctx, manifest, dashboard.Spec.GetTargetNamespace(), dashboard.Spec.Dashboard.Options); err != nil {
if err := common.ExecuteAdditionalOptionsTransformer(ctx, manifest, targetNamespace, dashboard.Spec.Dashboard.Options); err != nil {
return &mf.Manifest{}, err
}

Expand Down

0 comments on commit 5c3445d

Please sign in to comment.