Skip to content

Commit

Permalink
Merge pull request #12282 from openshift-cherrypick-robot/cherry-pick…
Browse files Browse the repository at this point in the history
…-12250-to-release-4.12

[release-4.12] OCPBUGS-3892: Add cluster to query params of websocket requests
  • Loading branch information
openshift-merge-robot committed Feb 25, 2023
2 parents 10843b1 + 80dd002 commit 5993192
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -43,7 +43,7 @@ export const getK8sResourcePath = (model: K8sModel, options: Options): string =>
u += `/${options.path}`;
}
if (!_.isEmpty(options.queryParams)) {
const q = _.map(options.queryParams, function(v, k) {
const q = _.map(options.queryParams, (v, k) => {
return `${k}=${v}`;
});
u += `?${q.join('&')}`;
Expand Down Expand Up @@ -109,11 +109,11 @@ export const toRequirements = (selector: Selector = {}): MatchExpression[] => {

Object.keys(matchLabels || {})
.sort()
.forEach(function(k) {
.forEach((k) => {
requirements.push(createEquals(k, matchLabels[k]));
});

(matchExpressions || []).forEach(function(me) {
(matchExpressions || []).forEach((me) => {
requirements.push(me);
});

Expand All @@ -132,6 +132,7 @@ export const k8sWatch = (
resourceVersion?: string;
ns?: string;
fieldSelector?: string;
cluster?: string;
} = {},
wsOptions: {
[key: string]: any;
Expand Down Expand Up @@ -169,6 +170,10 @@ export const k8sWatch = (
opts.ns = query.ns;
}

if (query.cluster) {
queryParams.cluster = encodeURIComponent(query.cluster);
}

if (query.resourceVersion) {
queryParams.resourceVersion = encodeURIComponent(query.resourceVersion);
}
Expand Down

0 comments on commit 5993192

Please sign in to comment.