Skip to content

Commit 1165445

Browse files
Calvinaudnamkyu1999Saranya-jena
authored
Seperate call to retrieve namespace list and retrieve KubeObject for only a single namespace (#4680)
* Create a seperate function to get Namespace in subscriber Signed-off-by: Calvin Audier <[email protected]> * Update graphql server to include KubeNamespace call (model not generated) Signed-off-by: Calvin Audier <[email protected]> * Update graphqls to include KubeNamespace model Update objectmodel and subscriber to incldue KubeNamespace Signed-off-by: Calvin Audier <[email protected]> * Fix issue in graphqls and adding KubeNamespace type. Regenerating model with gqlgen. Signed-off-by: Calvin Audier <[email protected]> * Update model to includude missing field in KubeNamespaceData Rename getKubeNamespace function that didn't match graphqls operation in Subscription Add missing function for the graphql server to retrieve list of namespace Signed-off-by: Calvin Audier <[email protected]> * Add remaining function in k8s pkg and requests to return list of namespace Signed-off-by: Calvin Audier <[email protected]> * Update graphql/subscriber to transform KubeObject to not be a array since subscriber will only return one element. Signed-off-by: Calvin Audier <[email protected]> * Update web server to seperate call for KubeObject and KubeNamespace. Signed-off-by: Calvin Audier <[email protected]> * Fix import with goimports Signed-off-by: Calvin Audier <[email protected]> * Reverting upgrade of webpack-dev-server so it's compatible with github workflow Signed-off-by: Calvin Audier <[email protected]> * Run gofmt with correct version. Signed-off-by: Calvin Audier <[email protected]> * Bumping ubi-minimal:8.8 to 8.10 to fix some HIGH CVE severity detected by trivy. Signed-off-by: Calvin Audier <[email protected]> * Updating chaos_infrastructure mock to include KubeNamespace. Fix a comment Signed-off-by: Calvin Audier <[email protected]> * Fix issue from Codacy Removing some unused code Signed-off-by: Calvin Audier <[email protected]> * Fix codacy issue: - Add some trailing comma - Trying transform subscription function to resolve "non-arrow functions are forbidden" - Add null check Signed-off-by: Calvin Audier <[email protected]> * Continue fix Codacy issue - Adding trailing comma - Re-ordering by alphabetic order some parameters Signed-off-by: Calvin Audier <[email protected]> --------- Signed-off-by: Calvin Audier <[email protected]> Signed-off-by: Calvinaud <[email protected]> Co-authored-by: Namkyu Park <[email protected]> Co-authored-by: Saranya Jena <[email protected]>
1 parent 2bdec7e commit 1165445

File tree

19 files changed

+1098
-154
lines changed

19 files changed

+1098
-154
lines changed

chaoscenter/graphql/definitions/shared/chaos_infrastructure.graphqls

+72-2
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,11 @@ type KubeObjectResponse {
358358
"""
359359
Type of the Kubernetes object
360360
"""
361-
kubeObj: [KubeObject]!
361+
kubeObj: KubeObject!
362362
}
363363

364364
"""
365-
KubeObject consists of the namespace and the available resources in the same
365+
KubeObject consists of the available resources in a namespace
366366
"""
367367
type KubeObject {
368368
"""
@@ -404,16 +404,75 @@ input KubeObjectRequest {
404404
GVR Request
405405
"""
406406
kubeObjRequest: KubeGVRRequest
407+
"""
408+
Namespace in which the Kubernetes object is present
409+
"""
410+
namespace: String!
407411
objectType: String!
408412
workloads: [Workload]
409413
}
410414

415+
"""
416+
Defines details for fetching Kubernetes namespace data
417+
"""
418+
input KubeNamespaceRequest {
419+
"""
420+
ID of the infra
421+
"""
422+
infraID: ID!
423+
}
424+
425+
"""
426+
Define name in the infra (not really useful at the moment but maybe we will need other field later)
427+
"""
428+
type KubeNamespace{
429+
"""
430+
Name of the namespace
431+
"""
432+
name: String!
433+
}
434+
435+
436+
411437
input KubeGVRRequest {
412438
group: String!
413439
version: String!
414440
resource: String!
415441
}
416442

443+
"""
444+
Response received for querying Kubernetes Namespaces
445+
"""
446+
type KubeNamespaceResponse {
447+
"""
448+
ID of the infra in which the Kubernetes namespace is present
449+
"""
450+
infraID: ID!
451+
"""
452+
List of the Kubernetes namespace
453+
"""
454+
kubeNamespace: [KubeNamespace]!
455+
}
456+
457+
"""
458+
Defines the details of Kubernetes namespace
459+
"""
460+
input KubeNamespaceData {
461+
"""
462+
Unique request ID for fetching Kubernetes namespace details
463+
"""
464+
requestID: ID!
465+
"""
466+
ID of the infra in which the Kubernetes namespace is present
467+
"""
468+
infraID: InfraIdentity!
469+
"""
470+
List of KubeNamespace return by subscriber
471+
"""
472+
kubeNamespace: String!
473+
}
474+
475+
417476
"""
418477
Defines the details of Kubernetes object
419478
"""
@@ -638,6 +697,12 @@ extend type Mutation {
638697
"""
639698
# authorized directive not required
640699
kubeObj(request: KubeObjectData!): String!
700+
701+
"""
702+
Receives kubernetes namespace data from subscriber
703+
"""
704+
# authorized directive not required
705+
kubeNamespace(request: KubeNamespaceData!): String!
641706
}
642707

643708
extend type Subscription {
@@ -663,4 +728,9 @@ extend type Subscription {
663728
Returns a kubernetes object given an input
664729
"""
665730
getKubeObject(request: KubeObjectRequest!): KubeObjectResponse!
731+
732+
"""
733+
Returns a kubernetes namespaces given an input
734+
"""
735+
getKubeNamespace(request: KubeNamespaceRequest!): KubeNamespaceResponse!
666736
}

chaoscenter/graphql/server/graph/chaos_infrastructure.resolvers.go

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)