Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
921f99c
client credential flow
MahirAbbas Apr 21, 2026
3da7304
remove type coercien
MahirAbbas Apr 21, 2026
c871b5f
add tokenRes check
MahirAbbas Apr 21, 2026
b93e7bb
add logging
MahirAbbas Apr 21, 2026
ceb0493
abort on failed setup
MahirAbbas Apr 21, 2026
10eb255
remove headers
MahirAbbas Apr 21, 2026
02cf95e
empty jeader
MahirAbbas Apr 21, 2026
4fa1bf5
empty
MahirAbbas Apr 21, 2026
48e1387
token from dev
MahirAbbas Apr 21, 2026
fab452f
identity test
MahirAbbas Apr 21, 2026
5dd7ddc
errors
MahirAbbas Apr 21, 2026
43f4253
add identity-test as auth issuer
MahirAbbas Apr 21, 2026
5a91522
change keycloak request to identity-dev
MahirAbbas Apr 21, 2026
2f525ae
change query to non-visit specic
MahirAbbas Apr 21, 2026
e975ed7
try hardcoded token
MahirAbbas Apr 22, 2026
6f640de
list templates test
MahirAbbas Apr 22, 2026
4056469
remove hardcoded token
MahirAbbas Apr 22, 2026
7e2c452
common.ts
MahirAbbas Apr 28, 2026
ca9368e
export setup()
MahirAbbas Apr 29, 2026
a958a21
sonnet is crap
MahirAbbas Apr 29, 2026
1088192
crap cd
MahirAbbas Apr 30, 2026
4d7d57c
increase VU count for ping-graph
MahirAbbas Apr 30, 2026
7871738
add new visit for k6
MahirAbbas Apr 30, 2026
b3b691e
change sessionspace to dev
MahirAbbas Apr 30, 2026
8d80867
new sessionsspace?
MahirAbbas Apr 30, 2026
1133ed1
val
MahirAbbas Apr 30, 2026
9d8884d
octal
MahirAbbas Apr 30, 2026
a1f59e2
1
MahirAbbas Apr 30, 2026
cc39c99
delete configmap-type
MahirAbbas Apr 30, 2026
e503e27
add rolebinding
MahirAbbas May 1, 2026
f08276f
rbs
MahirAbbas May 1, 2026
23f4b3f
rb
MahirAbbas May 1, 2026
2cc9924
rmv rbc
MahirAbbas May 1, 2026
2a4e61c
add rbac, svc and subscription test
MahirAbbas May 1, 2026
a89ce3f
config for ws-test
MahirAbbas May 1, 2026
6dd0454
ws url
MahirAbbas May 1, 2026
ca29d3f
changes
MahirAbbas May 1, 2026
884939a
add logging
MahirAbbas May 1, 2026
ffa6924
running logging
MahirAbbas May 1, 2026
e98bd6d
change timeout to 30m
MahirAbbas May 1, 2026
d2d1207
list workflows for visit
MahirAbbas May 5, 2026
d03c8c1
fake?
MahirAbbas May 6, 2026
db7ba72
30 under 30
MahirAbbas May 6, 2026
6e06d7c
add user
MahirAbbas May 6, 2026
aa0acad
add me pls
MahirAbbas May 6, 2026
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
3 changes: 2 additions & 1 deletion charts/apps/staging-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ kueue:
k6Operator:
enabled: true
targetRevision: HEAD
extraValueFiles: []
extraValueFiles:
- staging-values.yaml
valuesObject: {}
13 changes: 13 additions & 0 deletions charts/k6-operator/staging-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,16 @@ k6-operator:
limits:
cpu: 1000m
memory: 1Gi
sessionspace:
enabled: true
name: ks10000-1
proposalCode: ks
proposalNumber: "10000"
visit: "1"
instrument: b01-1
gid: "36055"
startDate: "2026-04-30 9:00:00.0"
endDate: "2026-05-22 9:00:00.0"
members:
- https://identity-dev.diamond.ac.uk/realms/dls/k6Operator

1 change: 0 additions & 1 deletion charts/k6-operator/templates/k6-operator-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ metadata:
namespace: {{ .Release.Namespace}}
data:
{{(.Files.Glob "tests/*.ts").AsConfig| indent 2}}

Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
# k6-resource.yml

apiVersion: k6.io/v1alpha1
kind: TestRun
metadata:
name: k6-ping-graph
namespace: {{ .Release.Namespace}}
spec:
parallelism: 4
parallelism: 1
script:
configMap:
name: k6-configmap
file: ping-graph.ts
runner:
env:
- name: GRAPH_PROXY_BEARER_TOKEN
- name: KEYCLOAK_CLIENT_ID
valueFrom:
secretKeyRef:
name: graph-proxy-k6-auth
key: KEYCLOAK_CLIENT_ID
- name: KEYCLOAK_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: graph-proxy-k6-auth
key: GRAPH_PROXY_BEARER_TOKEN
key: KEYCLOAK_CLIENT_SECRET
- name: KEYCLOAK_TOKEN_URL
value: https://identity-dev.diamond.ac.uk/realms/dls/protocol/openid-connect/token
- name: GRAPH_URL
value: http://graph-proxy.graph-proxy.svc.cluster.local:80/graphql
resources:
Expand Down
117 changes: 117 additions & 0 deletions charts/k6-operator/templates/k6-probe-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: k6-ws-map
namespace: {{ .Release.Namespace}}
data:
k6-ws-subscription-testrun.yaml: |
apiVersion: k6.io/v1alpha1
kind: TestRun
metadata:
name: k6-ws-subscription-probe
namespace: {{ .Release.Namespace}}
spec:
parallelism: 1
script:
configMap:
name: k6-configmap
file: ws-subscription.ts
runner:
env:
- name: KEYCLOAK_CLIENT_ID
valueFrom:
secretKeyRef:
name: graph-proxy-k6-auth
key: KEYCLOAK_CLIENT_ID
- name: KEYCLOAK_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: graph-proxy-k6-auth
key: KEYCLOAK_CLIENT_SECRET
- name: KEYCLOAK_TOKEN_URL
value: https://identity-dev.diamond.ac.uk/realms/dls/protocol/openid-connect/token
- name: GRAPH_URL
value: http://graph-proxy.graph-proxy.svc.cluster.local:80/graphql
- name: GRAPH_WS_URL
value: ws://graph-proxy.graph-proxy.svc.cluster.local:80/graphql/ws
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 500m
memory: 500Mi
starter:
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 500m
memory: 500Mi
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: k6-probe-runner
rules:
- apiGroups:
- k6.io
resources:
- testruns
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: k6-probe-runner
roleRef:
kind: Role
name: k6-probe-runner
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: k6-probe-runner
namespace: {{ .Release.Namespace}}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: k6-probe-runner

---
apiVersion: batch/v1
kind: CronJob
metadata:
name: k6-ws-cron
spec:
schedule: "*/30 * * * *"
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
serviceAccount: k6-probe-runner
containers:
- name: kubectl
image: bitnami/kubectl
volumeMounts:
- name: k6-yaml
mountPath: /tmp/
command:
- /bin/bash
args:
- -c
- 'kubectl delete -f /tmp/k6-ws-subscription-testrun.yaml; kubectl apply -f /tmp/k6-ws-subscription-testrun.yaml'
restartPolicy: OnFailure
volumes:
- name: k6-yaml
configMap:
name: k6-ws-map
47 changes: 47 additions & 0 deletions charts/k6-operator/templates/k6-ws-subscription-testrun.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# k6-resource.yml

apiVersion: k6.io/v1alpha1
kind: TestRun
metadata:
name: k6-ws-subscription
namespace: {{ .Release.Namespace}}
spec:
parallelism: 1
script:
configMap:
name: k6-configmap
file: ws-subscription.ts
runner:
env:
- name: KEYCLOAK_CLIENT_ID
valueFrom:
secretKeyRef:
name: graph-proxy-k6-auth
key: KEYCLOAK_CLIENT_ID
- name: KEYCLOAK_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: graph-proxy-k6-auth
key: KEYCLOAK_CLIENT_SECRET
- name: KEYCLOAK_TOKEN_URL
value: https://identity-dev.diamond.ac.uk/realms/dls/protocol/openid-connect/token
- name: GRAPH_URL
value: http://graph-proxy.graph-proxy.svc.cluster.local:80/graphql
- name: GRAPH_WS_URL
value: ws://graph-proxy.graph-proxy.svc.cluster.local:80/graphql/ws
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 500m
memory: 500Mi
starter:
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 500m
memory: 500Mi

35 changes: 35 additions & 0 deletions charts/k6-operator/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: argo-workflow
namespace: ks10000-1
ownerReferences:
- apiVersion: v1
kind: ServiceAccount
name: argo-workflow
uid: ks12345
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: argo-workflow
subjects:
- kind: ServiceAccount
name: argo-workflow
namespace: ks10000-1
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: visit-member
namespace: ks10000-1
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: visit-member
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: User
name: oidc:https://identity-dev.diamond.ac.uk/realms/dls/k6Operator
- apiGroup: rbac.authorization.k8s.io
kind: User
name: oidc:umi13827
15 changes: 15 additions & 0 deletions charts/k6-operator/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/managed-by: kyverno
generate.kyverno.io/policy-name: workflows-sessionspace
generate.kyverno.io/policy-namespace: ""
generate.kyverno.io/rule-name: generate-argo-workflow-service-account
generate.kyverno.io/trigger-group: ""
generate.kyverno.io/trigger-kind: Namespace
generate.kyverno.io/trigger-namespace: ""
generate.kyverno.io/trigger-uid: 225e0bc5-1410-419d-880c-97fcc98d17bf
generate.kyverno.io/trigger-version: v1
name: argo-workflow
namespace: ks10000-1
27 changes: 27 additions & 0 deletions charts/k6-operator/templates/sessionspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
app.kubernetes.io/managed-by: sessionspaces
name: ks10000-1
---
apiVersion: v1
kind: ConfigMap
data:
end_date: "2026-05-22 9:00:00.0"
gid: "36055"
instrument: b01-1
members: '["https://identity-dev.diamond.ac.uk/realms/dls/k6Operator", "umi13827"]'
proposal_code: ks
proposal_number: "10000"
start_date: "2026-04-30 9:00:00.0"
visit: "1"
metadata:
labels:
app.kubernetes.io/managed-by: sessionspaces
#workflows.argoproj.io/configmap-type: Parameter
name: sessionspaces
namespace: ks10000-1

# rolebindings not created
# v kubectl get roles -n ks10000-1
38 changes: 38 additions & 0 deletions charts/k6-operator/tests/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import http from 'k6/http';
import { check, fail } from 'k6';
import exec from 'k6/execution';

const graphUrl = __ENV.GRAPH_URL;
const keycloakUrl = __ENV.KEYCLOAK_TOKEN_URL;
const clientID = __ENV.KEYCLOAK_CLIENT_ID;
const clientSecret = __ENV.KEYCLOAK_CLIENT_SECRET;

export function setup(): { token: string } {
if (!clientSecret) fail('KEYCLOAK_CLIENT_SECRET required');
if (!clientID) fail('KEYCLOAK_CLIENT_ID required');
if (!keycloakUrl) fail('KEYCLOAK_TOKEN_URL required');
if (!graphUrl) fail('GRAPH_URL required');

const tokenRes = http.post(
keycloakUrl, {
grant_type: 'client_credentials',
client_id: clientID,
client_secret: clientSecret,
});

check(tokenRes, {
'keycloak token request succeeded': (r) => r.status === 200,
});

if (tokenRes.status !== 200) {
fail(`Token request failed: ${tokenRes.status} ${tokenRes.body}`);
}

const tokenBody = JSON.parse(tokenRes.body as string);
const token = tokenBody.access_token;
if (!token) {
exec.test.abort('No access_token in Keycloak response');
}

return { token };
}
Loading
Loading