Skip to content

get stored secrets and configmaps from packet without dependency on c… #2500

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

Merged
merged 2 commits into from
Aug 16, 2021
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 @@ -17,7 +17,6 @@
import oracle.kubernetes.operator.DomainStatusUpdater;
import oracle.kubernetes.operator.MakeRightDomainOperation;
import oracle.kubernetes.operator.ProcessingConstants;
import oracle.kubernetes.operator.calls.AsyncRequestStep;
import oracle.kubernetes.operator.calls.CallResponse;
import oracle.kubernetes.operator.helpers.EventHelper.EventData;
import oracle.kubernetes.operator.helpers.EventHelper.EventItem;
Expand Down Expand Up @@ -80,12 +79,7 @@ public NextAction onSuccess(Packet packet, CallResponse<V1SecretList> callRespon
}

static List<V1Secret> getSecrets(Packet packet) {
return Optional.ofNullable(getSecretsIfContinue(packet)).orElse(new ArrayList<>());
}

@SuppressWarnings("unchecked")
private static List<V1Secret> getSecretsIfContinue(Packet packet) {
return packet.get(AsyncRequestStep.CONTINUE) != null ? (List<V1Secret>) packet.get(SECRETS) : null;
return (List<V1Secret>) Optional.ofNullable(packet.get(SECRETS)).orElse(new ArrayList<>());
}
}

Expand All @@ -105,12 +99,7 @@ public NextAction onSuccess(Packet packet, CallResponse<V1ConfigMapList> callRes
}

static List<V1ConfigMap> getConfigMaps(Packet packet) {
return Optional.ofNullable(getConfigMapsIfContinue(packet)).orElse(new ArrayList<>());
}

@SuppressWarnings("unchecked")
private static List<V1ConfigMap> getConfigMapsIfContinue(Packet packet) {
return packet.get(AsyncRequestStep.CONTINUE) != null ? (List<V1ConfigMap>) packet.get(CONFIGMAPS) : null;
return (List<V1ConfigMap>) Optional.ofNullable(packet.get(CONFIGMAPS)).orElse(new ArrayList<>());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
import static java.net.HttpURLConnection.HTTP_OK;
import static java.net.HttpURLConnection.HTTP_UNAVAILABLE;
import static oracle.kubernetes.operator.calls.AsyncRequestStep.CONTINUE;
import static oracle.kubernetes.operator.calls.AsyncRequestStep.RESPONSE_COMPONENT_NAME;

@SuppressWarnings("WeakerAccess")
Expand Down Expand Up @@ -1205,6 +1206,8 @@ public NextAction apply(Packet packet) {
Object callResult = callContext.execute();
CallResponse<Object> callResponse = createResponse(callResult);
packet.getComponents().put(RESPONSE_COMPONENT_NAME, Component.createFor(callResponse));
// clear out earlier results. Replicating the behavior as in AsyncRequestStep.apply()
packet.remove(CONTINUE);
} catch (NotFoundException e) {
packet.getComponents().put(RESPONSE_COMPONENT_NAME, Component.createFor(createResponse(e)));
} catch (HttpErrorException e) {
Expand Down