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

feat: Add k8s networkpolicy support #1208

Merged
merged 5 commits into from Dec 4, 2022

Conversation

baquintanag
Copy link
Contributor

Description

Fixes #1205.

  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes

Added / Removed / Updated [X].

Added func to get k8s Network Policies.

  • GetNetworkPolicy
  • GetNetworkPolicyE
  • WaitUntilNetworkPolicyAvailable

@denis256
Copy link
Member

denis256 commented Dec 1, 2022

TestGetNetworkPolicyEReturnsCorrectNetworkPolicyInCorrectNamespace 2022-12-01T14:21:41Z logger.go:66: error: error parsing /tmp/TestGetNetworkPolicyEReturnsCorrectNetworkPolicyInCorrectNamespace46766109: error converting YAML to JSON: yaml: line 5: found character that cannot start any token
TestGetServiceAccountEReturnsCorrectServiceAccountInCorrectNamespace 2022-12-01T14:21:41Z logger.go:66: namespace/bg5gj2 created
TestGetServiceAccountEReturnsCorrectServiceAccountInCorrectNamespace 2022-12-01T14:21:41Z logger.go:66: serviceaccount/terratest created
TestGetServiceAccountEReturnsCorrectServiceAccountInCorrectNamespace 2022-12-01T14:21:41Z client.go:42: Configuring Kubernetes client using config file /home/circleci/.kube/config with context 
TestGetServiceAccountEReturnsCorrectServiceAccountInCorrectNamespace 2022-12-01T14:21:41Z logger.go:66: Running command kubectl with args [--namespace bg5gj2 delete -f /tmp/TestGetServiceAccountEReturnsCorrectServiceAccountInCorrectNamespace2926325761]
=== CONT  TestGetNetworkPolicyEReturnsCorrectNetworkPolicyInCorrectNamespace
    kubectl.go:111: 
        	Error Trace:	kubectl.go:111
        	            				networkpolicy_test.go:38
        	Error:      	Received unexpected error:
        	            	error while running command: exit status 1; error: error parsing /tmp/TestGetNetworkPolicyEReturnsCorrectNetworkPolicyInCorrectNamespace46766109: error converting YAML to JSON: yaml: line 5: found character that cannot start any token
        	Test:       	TestGetNetworkPolicyEReturnsCorrectNetworkPolicyInCorrectNamespace

image

Looks like YAML template contains tabs instead of spaces

@denis256
Copy link
Member

denis256 commented Dec 1, 2022

I was also wondering if will be helpful to have functions for listing/filtering network policies

@denis256 denis256 merged commit c585621 into gruntwork-io:master Dec 4, 2022
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.

Add support for Kubernetes NetworkPolicy
3 participants