Skip to content

Commit

Permalink
Merge pull request #233 from adambkaplan/set-tekton-pruner
Browse files Browse the repository at this point in the history
fix: Set TektonConfig Pruner
  • Loading branch information
openshift-merge-bot[bot] authored Dec 12, 2024
2 parents cc83aee + 57738a4 commit 4d84444
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/tekton/tekton.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ func IsTektonConfigPresent(ctx context.Context, client tektonoperatorclientv1alp
// CreateTektonConfigWithProfileAndTargetNamespace creates a TektonConfig object with the given
// profile and target namespace for Tekton components.
func CreateTektonConfigWithProfileAndTargetNamespace(ctx context.Context, client tektonoperatorclientv1alpha1.OperatorV1alpha1Interface, profile string, targetNamepsace string) (*tektonoperatorv1alpha1.TektonConfig, error) {
// If creating a TektonConfig, enable the pruner with default keep of 100
// This matches the Tekton operator default
keep := uint(100)
tektonConfig := &tektonoperatorv1alpha1.TektonConfig{
ObjectMeta: metav1.ObjectMeta{
Name: "config",
Expand All @@ -111,6 +114,10 @@ func CreateTektonConfigWithProfileAndTargetNamespace(ctx context.Context, client
CommonSpec: tektonoperatorv1alpha1.CommonSpec{
TargetNamespace: targetNamepsace,
},
Pruner: tektonoperatorv1alpha1.Prune{
Disabled: false,
Keep: &keep,
},
},
}
return client.TektonConfigs().Create(ctx, tektonConfig, metav1.CreateOptions{})
Expand Down
2 changes: 2 additions & 0 deletions pkg/tekton/tekton_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ func TestReconcileTekton(t *testing.T) {
g.Expect(tektonConfig.Name).To(o.Equal("config"))
g.Expect(tektonConfig.Spec.Profile).To(o.Equal("lite"))
g.Expect(tektonConfig.Spec.TargetNamespace).To(o.Equal("tekton-pipelines"))
g.Expect(tektonConfig.Spec.Pruner.Disabled).To(o.Equal(false))
g.Expect(tektonConfig.Spec.Pruner.Keep).NotTo(o.BeNil())
}
})
}
Expand Down

0 comments on commit 4d84444

Please sign in to comment.