Skip to content

Commit

Permalink
Seperate call to retrieve namespace list and retrieve KubeObject for …
Browse files Browse the repository at this point in the history
…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]>
Signed-off-by: andoriyaprashant <[email protected]>
  • Loading branch information
3 people authored and andoriyaprashant committed Sep 7, 2024
1 parent 0e44b72 commit 30cea9a
Show file tree
Hide file tree
Showing 19 changed files with 1,098 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ type KubeObjectResponse {
"""
Type of the Kubernetes object
"""
kubeObj: [KubeObject]!
kubeObj: KubeObject!
}

"""
KubeObject consists of the namespace and the available resources in the same
KubeObject consists of the available resources in a namespace
"""
type KubeObject {
"""
Expand Down Expand Up @@ -404,16 +404,75 @@ input KubeObjectRequest {
GVR Request
"""
kubeObjRequest: KubeGVRRequest
"""
Namespace in which the Kubernetes object is present
"""
namespace: String!
objectType: String!
workloads: [Workload]
}

"""
Defines details for fetching Kubernetes namespace data
"""
input KubeNamespaceRequest {
"""
ID of the infra
"""
infraID: ID!
}

"""
Define name in the infra (not really useful at the moment but maybe we will need other field later)
"""
type KubeNamespace{
"""
Name of the namespace
"""
name: String!
}



input KubeGVRRequest {
group: String!
version: String!
resource: String!
}

"""
Response received for querying Kubernetes Namespaces
"""
type KubeNamespaceResponse {
"""
ID of the infra in which the Kubernetes namespace is present
"""
infraID: ID!
"""
List of the Kubernetes namespace
"""
kubeNamespace: [KubeNamespace]!
}

"""
Defines the details of Kubernetes namespace
"""
input KubeNamespaceData {
"""
Unique request ID for fetching Kubernetes namespace details
"""
requestID: ID!
"""
ID of the infra in which the Kubernetes namespace is present
"""
infraID: InfraIdentity!
"""
List of KubeNamespace return by subscriber
"""
kubeNamespace: String!
}


"""
Defines the details of Kubernetes object
"""
Expand Down Expand Up @@ -638,6 +697,12 @@ extend type Mutation {
"""
# authorized directive not required
kubeObj(request: KubeObjectData!): String!

"""
Receives kubernetes namespace data from subscriber
"""
# authorized directive not required
kubeNamespace(request: KubeNamespaceData!): String!
}

extend type Subscription {
Expand All @@ -663,4 +728,9 @@ extend type Subscription {
Returns a kubernetes object given an input
"""
getKubeObject(request: KubeObjectRequest!): KubeObjectResponse!

"""
Returns a kubernetes namespaces given an input
"""
getKubeNamespace(request: KubeNamespaceRequest!): KubeNamespaceResponse!
}
23 changes: 23 additions & 0 deletions chaoscenter/graphql/server/graph/chaos_infrastructure.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 30cea9a

Please sign in to comment.