Skip to content

Commit

Permalink
Make version of oauth2 proxy configurable via operator param
Browse files Browse the repository at this point in the history
This avoids always using the latest image.
For example if there are breaking changes.
Defaults to latest.
  • Loading branch information
sgraband committed Oct 19, 2023
1 parent 685e1ec commit fe973bb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ public enum BandwidthLimiter {
"--continueOnException" }, description = "Whether the operator will continue to run in case of unexpected exceptions.", required = false)
private boolean continueOnException;

@Option(names = {
"--oAuth2ProxyImage" }, description = "The version to use of the quay.io/oauth2-proxy/oauth2-proxy image.", required = false, defaultValue = "latest")
private String oAuth2ProxyImage;

public boolean isUseKeycloak() {
return useKeycloak;
}
Expand Down Expand Up @@ -214,6 +218,10 @@ public boolean isContinueOnException() {
return continueOnException;
}

public String getoAuth2ProxyImage() {
return oAuth2ProxyImage;
}

@Override
public int hashCode() {
final int prime = 31;
Expand Down Expand Up @@ -242,6 +250,7 @@ public int hashCode() {
result = prime * result + (useKeycloak ? 1231 : 1237);
result = prime * result + (usePaths ? 1231 : 1237);
result = prime * result + ((wondershaperImage == null) ? 0 : wondershaperImage.hashCode());
result = prime * result + ((oAuth2ProxyImage == null) ? 0 : oAuth2ProxyImage.hashCode());
return result;
}

Expand Down Expand Up @@ -338,6 +347,11 @@ public boolean equals(Object obj) {
return false;
} else if (!wondershaperImage.equals(other.wondershaperImage))
return false;
if (oAuth2ProxyImage == null) {
if (other.oAuth2ProxyImage != null)
return false;
} else if (!oAuth2ProxyImage.equals(other.oAuth2ProxyImage))
return false;
return true;
}

Expand All @@ -352,7 +366,8 @@ public String toString() {
+ requestedStorage + ", keycloakURL=" + keycloakURL + ", keycloakRealm=" + keycloakRealm
+ ", keycloakClientId=" + keycloakClientId + ", leaderLeaseDuration=" + leaderLeaseDuration
+ ", leaderRenewDeadline=" + leaderRenewDeadline + ", leaderRetryPeriod=" + leaderRetryPeriod
+ ", maxWatchIdleTime=" + maxWatchIdleTime + ", continueOnException=" + continueOnException + "]";
+ ", maxWatchIdleTime=" + maxWatchIdleTime + ", continueOnException=" + continueOnException
+ ", oAuth2ProxyImage=" + oAuth2ProxyImage + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class DefaultDeploymentTemplateReplacements implements DeploymentTemplate
public static final String PLACEHOLDER_MONITOR_PORT = "placeholder-monitor-port";
public static final String PLACEHOLDER_MONITOR_PORT_ENV = "placeholder-monitor-env-port";
public static final String PLACEHOLDER_ENABLE_ACTIVITY_TRACKER = "placeholder-enable-activity-tracker";
public static final String PLACEHOLDER_OAUTH2_PROXY_IMAGE = "placeholder-oauth2-proxy-image";

protected static final String DEFAULT_UID = "1000";

Expand All @@ -80,6 +81,7 @@ public Map<String, String> getReplacements(String namespace, AppDefinition appDe
replacements.putAll(getAppDefinitionData(appDefinition));
replacements.putAll(getEnvironmentVariables(appDefinition, instance));
replacements.putAll(getInstanceData(appDefinition, instance));
replacements.put(PLACEHOLDER_OAUTH2_PROXY_IMAGE, arguments.getoAuth2ProxyImage());
return replacements;
}

Expand All @@ -90,6 +92,7 @@ public Map<String, String> getReplacements(String namespace, AppDefinition appDe
replacements.putAll(getAppDefinitionData(appDefinition));
replacements.putAll(getEnvironmentVariables(appDefinition, session));
replacements.putAll(getSessionData(session));
replacements.put(PLACEHOLDER_OAUTH2_PROXY_IMAGE, arguments.getoAuth2ProxyImage());
return replacements;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
automountServiceAccountToken: false
containers:
- name: oauth2-proxy
image: quay.io/oauth2-proxy/oauth2-proxy:v7.4.0
image: quay.io/oauth2-proxy/oauth2-proxy:placeholder-oauth2-proxy-image
imagePullPolicy: Always
args:
- --config=/etc/oauth2-proxy.cfg
Expand Down

0 comments on commit fe973bb

Please sign in to comment.