Skip to content

Adding network capabilities#53

Open
IbrahimGaberOfficial wants to merge 7 commits intokubewarden:mainfrom
IbrahimGaberOfficial:add/net-host-capabilities
Open

Adding network capabilities#53
IbrahimGaberOfficial wants to merge 7 commits intokubewarden:mainfrom
IbrahimGaberOfficial:add/net-host-capabilities

Conversation

@IbrahimGaberOfficial
Copy link
Copy Markdown
Contributor

@IbrahimGaberOfficial IbrahimGaberOfficial commented Apr 24, 2025

Description

Adding host capabilities -> Network capabilities -> Network DNS host lookup

Potential improvement

  • Checking if throwing exception is an acceptable or create a new complex type (that have both result and "message") that is more acceptable to use.
  • make a mock testing to this feature.

Signed-off-by: IbrahimGaberOfficial <ibrahim.gaber.official@gmail.com>
Signed-off-by: IbrahimGaberOfficial ibrahim.gaber.official@gmail.com
Signed-off-by: IbrahimGaberOfficial <ibrahim.gaber.official@gmail.com>
Signed-off-by: IbrahimGaberOfficial ibrahim.gaber.official@gmail.com
Signed-off-by: IbrahimGaberOfficial <ibrahim.gaber.official@gmail.com>
Signed-off-by: IbrahimGaberOfficial ibrahim.gaber.official@gmail.com
Signed-off-by: IbrahimGaberOfficial <ibrahim.gaber.official@gmail.com>
Signed-off-by: IbrahimGaberOfficial ibrahim.gaber.official@gmail.com
Signed-off-by: IbrahimGaberOfficial <ibrahim.gaber.official@gmail.com>
…lity

Signed-off-by: IbrahimGaberOfficial <ibrahim.gaber.official@gmail.com>
…d interface to it, because mock testing rely on interfaces and instance classes

Signed-off-by: IbrahimGaberOfficial <ibrahim.gaber.official@gmail.com>
@jvanz
Copy link
Copy Markdown
Member

jvanz commented Apr 30, 2025

@IbrahimGaberOfficial First of all, sorry for the long delay with no feedback to you.

Can you add an policy example using this new host capability in the example folder? 😁

@IbrahimGaberOfficial
Copy link
Copy Markdown
Contributor Author

Hi @jvanz I hope you are doing well , it is OK I know you are busy, i have some questions before

  1. what is the behavior of policy with errors, as I use throwing exceptions when error happens As in the following example
if (host == null || host.Client == 
{
    throw new ArgumentNullException(nameof(host), "Host or Host.Client cannot be null");
}

and in other SDKs as in Go-SDK, in case of error, it return empty array of string and error type here

  1. can you give me link for source code of simple policy that use net capabilities, so I can follow the same logic ?

thank you.

@jvanz
Copy link
Copy Markdown
Member

jvanz commented May 5, 2025

1. what is the behavior of policy with   errors, as I use  throwing exceptions when error happens As in the following example

You example policy can log the error and move on. I do not expect any complex policy validation logic. I just want to see that the code of the new host capability is being called and returning something.

2.     can you give me link for source code of simple policy that use net capabilities, so I can follow the same logic ?

As far as I can see there is no public policy using this network capability. Therefore, I do not have an example out of the box. However, there is a test in the Go SDK that you can use as an example of what you can replicate here. To make a story short, you can just create a policy that will do a dns lookup for the localhost address and check if it returns 127.0.0.1.

@flavio flavio moved this from Pending review to In Progress in Kubewarden Admission Controller May 5, 2025
@IbrahimGaberOfficial
Copy link
Copy Markdown
Contributor Author

Hi @jvanz, that is great, I will work on that.
thank you.

@viccuad
Copy link
Copy Markdown
Member

viccuad commented Jun 30, 2025

@IbrahimGaberOfficial are you still interested in working on this? If not, we can close the PR.

@flavio
Copy link
Copy Markdown
Member

flavio commented Jul 9, 2025

@viccuad I would not close the PR, but leave that open for others to pick it up if @IbrahimGaberOfficial doesn't have the bandwidth to deal with that. I just don't want to risk losing this good foundation

@IbrahimGaberOfficial
Copy link
Copy Markdown
Contributor Author

Hi @viccuad @flavio , Sorry for my late response, I had a final exams last month , and these weeks I am working on my graduation project, I will work on this PR in the next couple of weeks.
Thank you.

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.

4 participants