-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into minio-storage-class
- Loading branch information
Showing
70 changed files
with
225 additions
and
539 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...builder-server/src/main/java/io/airbyte/connector_builder/config/MetricClientFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2020-2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.connector_builder.config; | ||
|
||
import io.airbyte.metrics.lib.MetricClient; | ||
import io.airbyte.metrics.lib.MetricEmittingApps; | ||
import io.micronaut.context.annotation.Factory; | ||
import io.micronaut.context.annotation.Replaces; | ||
import jakarta.inject.Singleton; | ||
|
||
/** | ||
* Micronaut singleton factory for the creation and initialization of the {@link MetricClient}. | ||
*/ | ||
@Factory | ||
public class MetricClientFactory { | ||
|
||
/** | ||
* Creates and initializes the {@link MetricClient}. | ||
* | ||
* @return The initialized {@link MetricClient}. | ||
*/ | ||
@Singleton | ||
@Replaces(MetricClient.class) | ||
public MetricClient metricClient() { | ||
// Initialize the metric client | ||
io.airbyte.metrics.lib.MetricClientFactory.initialize(MetricEmittingApps.CONNECTOR_BUILDER_SERVER); | ||
return io.airbyte.metrics.lib.MetricClientFactory.getMetricClient(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#/bin/bash | ||
until curl --output /dev/null --head --fail http://${KEYCLOAK_INTERNAL_HOST}/auth/health/ready; do sleep 1; done; | ||
/app/airbyte-app/bin/airbyte-keycloak-setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM bitnami/kubectl:1.31.4 | ||
|
||
# Create the Airbyte User | ||
USER root | ||
RUN groupadd --gid 1000 airbyte && useradd --uid 1000 -g airbyte --create-home --no-log-init airbyte | ||
|
||
USER airbyte:airbyte | ||
|
||
COPY --chown=airbyte:airbyte sweep-pod.sh /app/sweep-pod.sh | ||
RUN chmod +x /app/sweep-pod.sh | ||
|
||
ENTRYPOINT "/app/sweep-pod.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
plugins { | ||
id("io.airbyte.gradle.docker") | ||
id("io.airbyte.gradle.publish") | ||
} | ||
|
||
airbyte { | ||
docker { | ||
imageName = "pod-sweeper" | ||
} | ||
} | ||
|
||
val copyScripts = tasks.register<Copy>("copyScripts") { | ||
from("scripts") | ||
into("build/airbyte/docker/") | ||
} | ||
|
||
tasks.named("dockerCopyDistribution") { | ||
dependsOn(copyScripts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
get_job_pods () { | ||
kubectl -n ${KUBE_NAMESPACE} -L airbyte -l airbyte=job-pod \ | ||
get pods \ | ||
-o=jsonpath='{range .items[*]} {.metadata.name} {.status.phase} {.status.conditions[0].lastTransitionTime} {.status.startTime}{"\n"}{end}' | ||
} | ||
delete_pod() { | ||
printf "From status '%s' since '%s', " $2 $3 | ||
echo "$1" | grep -v "STATUS" | awk '{print $1}' | xargs --no-run-if-empty kubectl -n ${KUBE_NAMESPACE} delete pod | ||
} | ||
while : | ||
do | ||
echo "Starting pod sweeper cycle:" | ||
|
||
if [ -n "${RUNNING_TTL_MINUTES}" ]; then | ||
# Time window for running pods | ||
RUNNING_DATE_STR=`date -d "now - ${RUNNING_TTL_MINUTES} minutes" --utc -Ins` | ||
RUNNING_DATE=`date -d $RUNNING_DATE_STR +%s` | ||
echo "Will sweep running pods from before ${RUNNING_DATE_STR}" | ||
fi | ||
|
||
if [ -n "${SUCCEEDED_TTL_MINUTES}" ]; then | ||
# Shorter time window for succeeded pods | ||
SUCCESS_DATE_STR=`date -d "now - ${SUCCEEDED_TTL_MINUTES} minutes" --utc -Ins` | ||
SUCCESS_DATE=`date -d $SUCCESS_DATE_STR +%s` | ||
echo "Will sweep succeeded pods from before ${SUCCESS_DATE_STR}" | ||
fi | ||
|
||
if [ -n "${UNSUCCESSFUL_TTL_MINUTES}" ]; then | ||
# Longer time window for unsuccessful pods (to debug) | ||
NON_SUCCESS_DATE_STR=`date -d "now - ${UNSUCCESSFUL_TTL_MINUTES} minutes" --utc -Ins` | ||
NON_SUCCESS_DATE=`date -d $NON_SUCCESS_DATE_STR +%s` | ||
echo "Will sweep unsuccessful pods from before ${NON_SUCCESS_DATE_STR}" | ||
fi | ||
( | ||
IFS=$'\n' | ||
for POD in `get_job_pods`; do | ||
IFS=' ' | ||
POD_NAME=`echo $POD | cut -d " " -f 1` | ||
POD_STATUS=`echo $POD | cut -d " " -f 2` | ||
POD_DATE_STR=`echo $POD | cut -d " " -f 3` | ||
POD_START_DATE_STR=`echo $POD | cut -d " " -f 4` | ||
POD_DATE=`date -d ${POD_DATE_STR:-$POD_START_DATE_STR} '+%s'` | ||
if [ -n "${RUNNING_TTL_MINUTES}" ] && [ "$POD_STATUS" = "Running" ]; then | ||
if [ "$POD_DATE" -lt "$RUNNING_DATE" ]; then | ||
delete_pod "$POD_NAME" "$POD_STATUS" "$POD_DATE_STR" | ||
fi | ||
elif [ -n "${SUCCEEDED_TTL_MINUTES}" ] && [ "$POD_STATUS" = "Succeeded" ]; then | ||
if [ "$POD_DATE" -lt "$SUCCESS_DATE" ]; then | ||
delete_pod "$POD_NAME" "$POD_STATUS" "$POD_DATE_STR" | ||
fi | ||
elif [ -n "${UNSUCCESSFUL_TTL_MINUTES}" ] && [ "$POD_STATUS" != "Running" ] && [ "$POD_STATUS" != "Succeeded" ]; then | ||
if [ "$POD_DATE" -lt "$NON_SUCCESS_DATE" ]; then | ||
delete_pod "$POD_NAME" "$POD_STATUS" "$POD_DATE_STR" | ||
fi | ||
fi | ||
done | ||
) | ||
echo "Completed pod sweeper cycle. Sleeping for 60 seconds..." | ||
sleep 60 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.