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

Added Ingress Module #46

Merged
merged 10 commits into from
Feb 23, 2024
Merged

Added Ingress Module #46

merged 10 commits into from
Feb 23, 2024

Conversation

sanjoyment
Copy link
Collaborator

Description:
ENG-946: Added Ingresses modules

Link to tracking Issue:
https://linear.app/middleware/issue/ENG-946/need-to-add-k8s-ingresses-data

Testing:
Tested on Stage, working fine there.
image

sanjoyment and others added 9 commits February 14, 2024 16:21
…ClusterRoleBinding and ServiceAccount modules
…ates

# Conflicts:
#	receiver/k8sclusterreceiver/internal/collection/collector.go
#	receiver/k8sclusterreceiver/internal/metadata/generated_config.go
#	receiver/k8sclusterreceiver/internal/metadata/generated_config_test.go
#	receiver/k8sclusterreceiver/internal/metadata/generated_resource_test.go
#	receiver/k8sclusterreceiver/metadata.yaml
#	receiver/k8sclusterreceiver/watcher.go
…ClusterRoleBinding and ServiceAccount modules
…ates

# Conflicts:
#	receiver/k8sclusterreceiver/internal/collection/collector.go
#	receiver/k8sclusterreceiver/internal/gvk/gvk.go
#	receiver/k8sclusterreceiver/internal/metadata/generated_config.go
#	receiver/k8sclusterreceiver/internal/metadata/generated_config_test.go
#	receiver/k8sclusterreceiver/internal/metadata/generated_resource_test.go
#	receiver/k8sclusterreceiver/metadata.yaml
#	receiver/k8sclusterreceiver/watcher.go
rb := mb.NewResourceBuilder()
rb.SetK8sIngressUID(string(i.GetUID()))
rb.SetK8sIngressName(i.GetName())
rb.SetK8sClusterName("unknown")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this hardcoded to "unknown" ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we are just adding the "k8s.cluster.name" key, the "unknown" is fallback value,
when user will run the installation script the value will be filled

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Acc. to our code, "unknown" will be auto-replaced later.

return strings.Join(res, seperator)
}

func convertIngressRulesToString(rules []netv1.IngressRule) string {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this function ? Can we just use https://pkg.go.dev/k8s.io/api/networking/v1#Ingress.String ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried rule.String() functionality, but it converts complex structs into a string format. This would make it hard for our developers to understand when displaying rules in a detailed view on the side-panel.

Right now:
host=www.example.com&http=(paths=(path=/foo&pathType=Prefix&backend=(service=(name=service1&port=(number=80))));host=api.example.com&http=(paths=(path=/&pathType=Prefix&backend=(service=(name=api-service&port=(number=8080))))

With rule.String() functionality:
&IngressRule{Host:www.example.com,IngressRuleValue:IngressRuleValue{HTTP:&HTTPIngressRuleValue{Paths:[]HTTPIngressPath{HTTPIngressPath{Path:/foo,Backend:IngressBackend{Resource:nil,Service:&IngressServiceBackend{Name:service1,Port:ServiceBackendPort{Name:,Number:80,},},},PathType:*Prefix,},},},},}&IngressRule{Host:api.example.com,IngressRuleValue:IngressRuleValue{HTTP:&HTTPIngressRuleValue{Paths:[]HTTPIngressPath{HTTPIngressPath{Path:/,Backend:IngressBackend{Resource:nil,Service:&IngressServiceBackend{Name:api-service,Port:ServiceBackendPort{Name:,Number:8080,},},},PathType:*Prefix,},},},},}

@tejaskokje-mw @bhogayatakb Which approach do you think is better?

@@ -258,6 +258,46 @@ resource_attributes:
type: string
enabled: true

k8s.ingress.uid:
description: The UID of the Role.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be The UID of the Ingress. Same for other metadata below.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, Updated the metadata

@bhogayatakb bhogayatakb force-pushed the sanjoyment/k8s-pv-updates branch from 3532e3c to 9d45e18 Compare February 22, 2024 08:52
@bhogayatakb bhogayatakb merged commit 4c2d727 into main Feb 23, 2024
55 of 81 checks passed
bhogayatakb pushed a commit that referenced this pull request Jun 17, 2024
* ENG-947 & ENG-1241: Removed Persistent-Volume from transformObject flow

* ENG-947: Added Persistent-Volume-Claim flow

* ENG-1948, ENG-1949 & ENG-1955: Added Role, RoleBinding, ClusterRole, ClusterRoleBinding and ServiceAccount modules

* ENG-1948, ENG-1949 & ENG-1955: Added Role, RoleBinding, ClusterRole, ClusterRoleBinding and ServiceAccount modules

* ENG-946: Added Ingresses modules

* ENG-946: Changes in Ingresses modules

* ENG-946: Changes in Ingresses modules
@sanjoyment sanjoyment deleted the sanjoyment/k8s-pv-updates branch July 2, 2024 13:08
bhogayatakb pushed a commit that referenced this pull request Dec 5, 2024
* ENG-947 & ENG-1241: Removed Persistent-Volume from transformObject flow

* ENG-947: Added Persistent-Volume-Claim flow

* ENG-1948, ENG-1949 & ENG-1955: Added Role, RoleBinding, ClusterRole, ClusterRoleBinding and ServiceAccount modules

* ENG-1948, ENG-1949 & ENG-1955: Added Role, RoleBinding, ClusterRole, ClusterRoleBinding and ServiceAccount modules

* ENG-946: Added Ingresses modules

* ENG-946: Changes in Ingresses modules

* ENG-946: Changes in Ingresses modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants