Skip to content

Commit

Permalink
fix: remove PodSweeperWithinWorkloadLauncher feature flag (#15079)
Browse files Browse the repository at this point in the history
  • Loading branch information
subodh1810 committed Jan 23, 2025
1 parent 76ed278 commit 346b299
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
2 changes: 0 additions & 2 deletions airbyte-featureflag/src/main/kotlin/FlagDefinitions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ object NodeSelectorOverride : Temporary<String>(key = "platform.node-selector-ov

object ReportConnectorDiskUsage : Temporary<Boolean>(key = "platform.report-connector-disk-usage", default = false)

object PodSweeperWithinWorkloadLauncher : Temporary<Boolean>(key = "platform.pod-sweeper-within-workload-launcher", default = false)

object PlatformInitContainerImage : Temporary<String>(key = "platform.init-container-image", default = "")

object SubOneHourSyncSchedules : Permanent<Boolean>(key = "platform.allow-sub-one-hour-sync-frequency", default = true)
Expand Down
10 changes: 0 additions & 10 deletions airbyte-workload-launcher/src/main/kotlin/PodSweeper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package io.airbyte.workload.launcher

import dev.failsafe.Failsafe
import dev.failsafe.RetryPolicy
import io.airbyte.featureflag.Connection
import io.airbyte.featureflag.FeatureFlagClient
import io.airbyte.featureflag.PodSweeperWithinWorkloadLauncher
import io.airbyte.metrics.lib.MetricAttribute
import io.airbyte.metrics.lib.MetricClient
import io.airbyte.metrics.lib.OssMetricsRegistry
Expand Down Expand Up @@ -35,13 +32,11 @@ import kotlin.time.toJavaDuration
* @param unsuccessfulTtl If non-null, failed/unknown pods older than now - unsuccessfulTtl will be deleted
*/
private val logger = KotlinLogging.logger {}
private const val DUMMY_CONNECTION_ID = "a213d2df-d98e-44f8-a1a9-79b5e1a3d3b6"

@Singleton
class PodSweeper(
private val kubernetesClient: KubernetesClient,
private val metricClient: MetricClient,
private val featureFlagClient: FeatureFlagClient,
private val clock: Clock,
@Value("\${airbyte.worker.job.kube.namespace}") private val namespace: String,
@Named("kubernetesClientRetryPolicy") private val kubernetesClientRetryPolicy: RetryPolicy<Any>,
Expand All @@ -53,11 +48,6 @@ class PodSweeper(
fun sweepPods() {
logger.info { "Starting pod sweeper cycle in namespace [$namespace]..." }

if (!featureFlagClient.boolVariation(PodSweeperWithinWorkloadLauncher, Connection(DUMMY_CONNECTION_ID))) {
logger.info { "Feature flag is disabled, sweeper cycle ended." }
return
}

val now = Instant.ofEpochMilli(clock.millis())
val runningCutoff = runningTtl?.minutes?.let { now.minus(it.toJavaDuration()) }
val succeededCutoff = succeededTtl?.minutes?.let { now.minus(it.toJavaDuration()) }
Expand Down
14 changes: 8 additions & 6 deletions airbyte-workload-launcher/src/test/kotlin/PodSweeperTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import dev.failsafe.RetryPolicy
import io.airbyte.featureflag.FeatureFlagClient
import io.airbyte.featureflag.PodSweeperWithinWorkloadLauncher
import io.airbyte.featureflag.TestClient
import io.airbyte.metrics.lib.MetricClient
import io.airbyte.metrics.lib.NotImplementedMetricClient
import io.airbyte.workload.launcher.PodSweeper
Expand All @@ -27,7 +24,6 @@ class PodSweeperTest {

private val mockRetryPolicy: RetryPolicy<Any> = RetryPolicy.ofDefaults()
private val mockMetricClient: MetricClient = NotImplementedMetricClient()
private val mockFeatureFlagClient: FeatureFlagClient = TestClient(mapOf(PodSweeperWithinWorkloadLauncher.key to true))

private lateinit var client: KubernetesClient

Expand Down Expand Up @@ -271,8 +267,14 @@ class PodSweeperTest {
unSucceededTtl: Long?,
): PodSweeper {
return PodSweeper(
client, mockMetricClient, mockFeatureFlagClient,
Clock.systemUTC(), "default", mockRetryPolicy, runningTtL, succeededTtl, unSucceededTtl,
client,
mockMetricClient,
Clock.systemUTC(),
"default",
mockRetryPolicy,
runningTtL,
succeededTtl,
unSucceededTtl,
)
}
}

0 comments on commit 346b299

Please sign in to comment.