Skip to content

resolve: replicas issue and add network testing section #1388

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

Merged
merged 3 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions examples/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,63 @@ Let’s look at an example of creating a multi-instance WordPress Service using
helm delete kubeplus -n $KUBEPLUS_NS
python3 provider-kubeconfig.py delete $KUBEPLUS_NS
```

## Network Isolation Testing

This section verifies that the network policies are correctly isolating HelloWorldService instances.
Copy link
Contributor

Choose a reason for hiding this comment

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

correctly isolating application instances.

Copy link
Contributor

Choose a reason for hiding this comment

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

We will use HelloWorldService as an example.


### Steps

#### Install a Network Driver

On Minikube, install a network driver capable of recognizing `NetworkPolicy` objects (e.g., Cilium):

```bash
$ minikube start --cni=cilium
$ eval $(minikube docker-env)
```

#### Refer for main readme for installing the kubeplus operator and plugings
Copy link
Contributor

Choose a reason for hiding this comment

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

Refer main README ...


#### Create HelloWorldService Instances

```bash
$ kubectl create -f hello-world-service-composition.yaml --kubeconfig=provider.conf
$ kubectl create -f hs1.yaml --kubeconfig=provider.conf
$ kubectl create -f hs2.yaml --kubeconfig=provider.conf
```

#### Test Network Isolation

- **Ping/HTTP Test from `hs1` to `hs2`:**

```bash
$ HELLOWORLD_POD_HS1=$(kubectl get pods -n hs1 --kubeconfig=provider.conf -o jsonpath='{.items[0].metadata.name}')
$ kubectl exec -it $HELLOWORLD_POD_HS1 -n hs1 --kubeconfig=provider.conf -- curl <hs2-app-endpoint>
```

The connection should be denied.

- **Ping/HTTP Test from `hs2` to `hs1`:**

```bash
$ HELLOWORLD_POD_HS2=$(kubectl get pods -n hs2 --kubeconfig=provider.conf -o jsonpath='{.items[0].metadata.name}')
$ kubectl exec -it $HELLOWORLD_POD_HS2 -n hs2 --kubeconfig=provider.conf -- curl <hs1-app-endpoint>
```

The connection should be denied.

---

## Clean Up

### As Consumer

```bash
$ kubectl delete -f hs1-no-replicas.yaml --kubeconfig=provider.conf
$ kubectl delete -f hs2-no-replicas.yaml --kubeconfig=provider.conf
$ kubectl delete -f hello-world-service-composition.yaml --kubeconfig=provider.conf
```


Ensure the `helloworldservices.platformapi.kubeplus` CRD is removed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
version: v1alpha1
plural: helloworldservices
# URL of the Helm chart that contains Kubernetes resources that represent a workflow.
chartURL: https://github.com/cloud-ark/operatorcharts/blob/master/hello-world-chart-0.0.2.tgz?raw=true
chartURL: https://github.com/cloud-ark/kubeplus/blob/master/examples/multitenancy/hello-world/hello-world-chart-0.0.3.tgz?raw=true
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

chartName: hello-world-chart
# respolicy defines the resource policy to be applied to instances of the specified custom resource.
respolicy:
Expand Down