Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading