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

Make version of oauth2 proxy configurable via operator param #245

Merged
merged 3 commits into from
Oct 26, 2023
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 @@ -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 = {
"--oAuth2ProxyVersion" }, description = "The version to use of the quay.io/oauth2-proxy/oauth2-proxy image.", required = false, defaultValue = "latest")
private String oAuth2ProxyVersion;

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

public String getOAuth2ProxyVersion() {
return oAuth2ProxyVersion;
}

@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 + ((oAuth2ProxyVersion == null) ? 0 : oAuth2ProxyVersion.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 (oAuth2ProxyVersion == null) {
if (other.oAuth2ProxyVersion != null)
return false;
} else if (!oAuth2ProxyVersion.equals(other.oAuth2ProxyVersion))
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
+ ", oAuth2ProxyVersion=" + oAuth2ProxyVersion + "]";
}

}
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_VERSION = "placeholder-oauth2-proxy-version";

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_VERSION, arguments.getOAuth2ProxyVersion());
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_VERSION, arguments.getOAuth2ProxyVersion());
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-version
imagePullPolicy: Always
args:
- --config=/etc/oauth2-proxy.cfg
Expand Down