Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass launchdarkly api environment variable to orchestrator #22428

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class OrchestratorConstants {
private static final String S3_PATH_STYLE_ACCESS = "S3_PATH_STYLE_ACCESS";
private static final String FEATURE_FLAG_CLIENT = "FEATURE_FLAG_CLIENT";
private static final String FEATURE_FLAG_PATH = "FEATURE_FLAG_PATH";
private static final String LAUNCHDARKLY_KEY = "LAUNCHDARKLY_KEY";

// set of env vars necessary for the container orchestrator app to run
public static final Set<String> ENV_VARS_TO_TRANSFER = new ImmutableSet.Builder<String>()
Expand Down Expand Up @@ -76,7 +75,7 @@ public class OrchestratorConstants {
EnvVariableFeatureFlags.FIELD_SELECTION_WORKSPACES,
FEATURE_FLAG_CLIENT,
FEATURE_FLAG_PATH,
LAUNCHDARKLY_KEY,
EnvConfigs.LAUNCHDARKLY_KEY,
EnvConfigs.SOCAT_KUBE_CPU_LIMIT,
EnvConfigs.SOCAT_KUBE_CPU_REQUEST))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ private Map<String, String> getWorkerMetadata() {
EnvVariableFeatureFlags.APPLY_FIELD_SELECTION, String.valueOf(featureFlags.applyFieldSelection()),
EnvVariableFeatureFlags.FIELD_SELECTION_WORKSPACES, featureFlags.fieldSelectionWorkspaces(),
EnvConfigs.SOCAT_KUBE_CPU_LIMIT, configs.getSocatSidecarKubeCpuLimit(),
EnvConfigs.SOCAT_KUBE_CPU_REQUEST, configs.getSocatSidecarKubeCpuRequest());
EnvConfigs.SOCAT_KUBE_CPU_REQUEST, configs.getSocatSidecarKubeCpuRequest(),
EnvConfigs.LAUNCHDARKLY_KEY, configs.getLaunchDarklyKey());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class AirbyteIntegrationLauncherTest {
EnvVariableFeatureFlags.APPLY_FIELD_SELECTION, String.valueOf(FEATURE_FLAGS.applyFieldSelection()),
EnvVariableFeatureFlags.FIELD_SELECTION_WORKSPACES, FEATURE_FLAGS.fieldSelectionWorkspaces(),
EnvConfigs.SOCAT_KUBE_CPU_REQUEST, CONFIGS.getSocatSidecarKubeCpuRequest(),
EnvConfigs.SOCAT_KUBE_CPU_LIMIT, CONFIGS.getSocatSidecarKubeCpuLimit());
EnvConfigs.SOCAT_KUBE_CPU_LIMIT, CONFIGS.getSocatSidecarKubeCpuLimit(),
EnvConfigs.LAUNCHDARKLY_KEY, CONFIGS.getLaunchDarklyKey());

private WorkerConfigs workerConfigs;
@Mock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,13 @@ public interface Configs {
*/
String getOtelCollectorEndpoint();

/**
* If using a LaunchDarkly feature flag client, this API key will be used.
*
* @return LaunchDarkly API key as a string.
*/
String getLaunchDarklyKey();

/**
* Defines a default map of environment variables to use for any launched job containers. The
* expected format is a JSON encoded String -> String map. Make sure to escape properly. Defaults to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public class EnvConfigs implements Configs {

public static final int DEFAULT_FAILED_JOBS_IN_A_ROW_BEFORE_CONNECTION_DISABLE = 100;
public static final int DEFAULT_DAYS_OF_ONLY_FAILED_JOBS_BEFORE_CONNECTION_DISABLE = 14;
public static final String LAUNCHDARKLY_KEY = "LAUNCHDARKLY_KEY";

private final Function<String, String> getEnv;
private final Supplier<Set<String>> getAllEnvKeys;
Expand Down Expand Up @@ -848,6 +849,11 @@ public String getOtelCollectorEndpoint() {
return getEnvOrDefault(OTEL_COLLECTOR_ENDPOINT, "");
}

@Override
public String getLaunchDarklyKey() {
return getEnvOrDefault(LAUNCHDARKLY_KEY, "");
}

/**
* There are two types of environment variables available to the job container:
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public ContainerOrchestratorConfig kubernetesContainerOrchestratorConfig(
environmentVariables.put(DATA_PLANE_SERVICE_ACCOUNT_EMAIL_ENV_VAR, dataPlaneServiceAccountEmail);

final Configs configs = new EnvConfigs();
environmentVariables.put(EnvConfigs.LAUNCHDARKLY_KEY, configs.getLaunchDarklyKey());
environmentVariables.put(EnvConfigs.SOCAT_KUBE_CPU_LIMIT, configs.getSocatSidecarKubeCpuLimit());
environmentVariables.put(EnvConfigs.SOCAT_KUBE_CPU_REQUEST, configs.getSocatSidecarKubeCpuRequest());

Expand Down