package Ġorg . ac as ict f . ctf . operator . provision er . kubernetes Ċ Ċ import Ġio . fabric 8 . kubernetes . client . Kubernetes Client Ċ import Ġorg . ac as ict f . ctf . operator . model . kubernetes . v 1 alpha 1 . Environment Ċ import Ġorg . ac as ict f . ctf . operator . model . kubernetes . v 1 alpha 1 . Environment List Ċ import Ġorg . ac as ict f . ctf . operator . provision er . Pur ger Ċ import Ġjava . time . Instant Ċ import Ġjava . time . temporal . Ch rono Unit Ċ Ċ class ĠKubernetes Pur ger ( kube : ĠKubernetes Client ) Ġ: ĠPur ger Ġ{ ĊĠ Ġprivate Ġval Ġenv Client Ġ= Ġkube . resources ( Environment :: class . java , ĠEnvironment List :: class . java ) ĊĊĠ Ġoverride Ġfun Ġpurge (): ĠInt Ġ{ ĊĠĠĠ Ġval Ġenv List Ġ= Ġenv Client . list () ĊĠĠĠ Ġval Ġenv sTo Delete Ġ= Ġenv List . items . filter Ġ{ ĊĠĠĠĠĠ Ġval Ġcreation Ġ= ĠInstant . parse ( it . metadata . creation Timestamp ) ĊĠĠĠĠĠ Ġval Ġexpiry Ġ= Ġcreation . plus ( 1 , ĠCh rono Unit . HOUR S ) ĊĠĠĠĠĠ Ġexpiry Ġ< ĠInstant . now () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġenv Client . delete ( envs ToDelete ) ĊĊĠĠĠ Ġreturn Ġenv sTo Delete . size ĊĠ Ġ} Ċ } Ċ