Skip to content

Commit cad58c8

Browse files
authored
Ability for the SDK API to handle being installed in a KOTS airgap scenario (#110)
* Ability for the SDK API to handle being installed in a KOTS airgap scenario
1 parent db8a1b9 commit cad58c8

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.github/actions/validate-endpoints/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ runs:
114114
fi
115115
116116
- name: Validate /app/updates endpoint
117-
if: ${{ inputs.is-airgap == 'false' }}
118117
shell: bash
119118
run: |
120119
updatesLength=$(curl -s --fail --show-error localhost:8888/api/v1/app/updates | jq '. | length' | tr -d '\n')

.github/workflows/main.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ jobs:
9292
exit 1
9393
fi
9494
95+
output=$(helm template oci://ttl.sh/automated-${{ github.run_id }}/replicated --version 0.0.0 --set isAirgap=true)
96+
97+
if ! echo $output | grep -q 'name: DISABLE_OUTBOUND_CONNECTIONS value: "true"'; then
98+
printf "'DISABLE_OUTBOUND_CONNECTIONS' env var should be set to to 'true' in airgap mode:\n\n%s\n\n" "$output"
99+
exit 1
100+
fi
101+
95102
output=$(helm template oci://ttl.sh/automated-${{ github.run_id }}/replicated --version 0.0.0 --set serviceAccountName=foo)
96103
97104
if echo $output | grep -q 'kind: ServiceAccount'; then

pkg/handlers/app.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ func GetCurrentAppInfo(w http.ResponseWriter, r *http.Request) {
126126
}
127127

128128
func GetAppUpdates(w http.ResponseWriter, r *http.Request) {
129+
if util.IsAirgap() {
130+
JSON(w, http.StatusOK, []upstreamtypes.ChannelRelease{})
131+
return
132+
}
133+
129134
clientset, err := k8sutil.GetClientset()
130135
if err != nil {
131136
logger.Error(errors.Wrap(err, "failed to get clientset"))

0 commit comments

Comments
 (0)