Skip to content

Commit 03fb3f8

Browse files
committed
Delete hound-search PVC on termination
Complete the cleanup of hound-search by deleting its persistent volume claim when the service is disabled. Change-Id: I4e8e77d13454cd8d983aa9211358dc759e3fc927
1 parent e9b9ef0 commit 03fb3f8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

controllers/hound-search.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
)
1616

1717
const houndSearchIdent = "hound-search"
18+
const houndSearchData = "hound-search-data"
1819
const houndSearchImage = "quay.io/software-factory/hound:0.5.1-3"
1920

2021
func MkHoundSearchContainer(corporateCMExists bool, openshiftUser bool) apiv1.Container {
@@ -26,7 +27,7 @@ func MkHoundSearchContainer(corporateCMExists bool, openshiftUser bool) apiv1.Co
2627
container.ReadinessProbe = base.MkReadinessHTTPProbe("/healthz", 6080)
2728
container.VolumeMounts = []apiv1.VolumeMount{
2829
{
29-
Name: "hound-search-data",
30+
Name: houndSearchData,
3031
MountPath: "/var/lib/hound",
3132
},
3233
{
@@ -66,7 +67,12 @@ func (r *SFController) TerminateHoundSearch() {
6667
Namespace: r.ns,
6768
},
6869
})
69-
// todo: delete pvc
70+
r.DeleteR(&apiv1.PersistentVolumeClaim{
71+
ObjectMeta: metav1.ObjectMeta{
72+
Name: houndSearchData,
73+
Namespace: r.ns,
74+
},
75+
})
7076
}
7177

7278
func (r *SFController) DeployHoundSearch() bool {
@@ -76,7 +82,7 @@ func (r *SFController) DeployHoundSearch() bool {
7682
// Check if Corporate Certificate exists
7783
corporateCM, corporateCMExists := r.CorporateCAConfigMapExists()
7884

79-
pvc := base.MkPVC("hound-search-data", r.ns, r.getStorageConfOrDefault(r.cr.Spec.Codesearch.Storage), apiv1.ReadWriteOnce)
85+
pvc := base.MkPVC(houndSearchData, r.ns, r.getStorageConfOrDefault(r.cr.Spec.Codesearch.Storage), apiv1.ReadWriteOnce)
8086
container := MkHoundSearchContainer(corporateCMExists, r.isOpenShift)
8187
container.Env = []apiv1.EnvVar{
8288
base.MkEnvVar("CONFIG_REPO_BASE_URL", r.configBaseURL),

0 commit comments

Comments
 (0)