Skip to content

Commit

Permalink
Add docs for testing argo rollouts, add example manifests for argo ro…
Browse files Browse the repository at this point in the history
…llouts
  • Loading branch information
gamingrobot committed Oct 17, 2023
1 parent df873ff commit 0583b2f
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docs/testing-argo-rollouts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Testing Argo Rollouts

Follow [argo rollouts installation](https://argo-rollouts.readthedocs.io/en/stable/installation/) instructions to install the controller and kubectl plugin

## Actually Testing

Deploy `install-prod.yaml` from [releases](https://github.com/Contrast-Security-OSS/agent-operator/releases).

```bash
# Install the production manifests.
kubectl apply -f install-prod.yaml

# Wait for the cluster to converge.
watch kubectl -n contrast-agent-operator get pods

# Check the logs for any problems.
kubectl -n contrast-agent-operator logs deployment/contrast-agent-operator -f
```

Then we can deploy argo rollout examples

```bash
# Install the Argo Rollout only examples (e.g. Rollout).
kubectl apply -k ./manifests/examples/argo-rollouts

# Promote the rollout to finish the agent injection
kubectl argo rollouts promote dotnet-core-app

# Inspect rollout in another terminal
kubectl argo rollouts get rollout dotnet-core-app --watch
```

We can also force a change on the container to trigger a rollout

```bash
# Optional: Force a change to the container to trigger a rollout
kubectl argo rollouts set image dotnet-core-app dotnet-core-app=contrast/sample-app-aspnetcore:main

# Promote the rollout to finish
kubectl argo rollouts promote dotnet-core-app
```
33 changes: 33 additions & 0 deletions manifests/examples/argo-rollouts/base/dotnet-core.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: dotnet-core-app
namespace: default
labels:
app: dotnet-core-app
spec:
replicas: 2
strategy:
canary:
steps:
- setWeight: 20
- pause: {}
- setWeight: 40
- pause: {duration: 10}
revisionHistoryLimit: 1
selector:
matchLabels:
app: dotnet-core-app
template:
metadata:
labels:
app: dotnet-core-app
annotations:
test: test
spec:
containers:
- image: contrast/sample-app-aspnetcore:latest
name: dotnet-core-app
ports:
- containerPort: 80
name: http
52 changes: 52 additions & 0 deletions manifests/examples/argo-rollouts/base/minimal-setup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: agents.contrastsecurity.com/v1beta1
kind: AgentInjector
metadata:
name: example-injector-dotnet-core
spec:
enabled: true
version: latest
type: dotnet-core
selector:
images:
- "*"
labels:
- name: app
value: dotnet-core-app
connection:
name: example-agent-connection
configuration:
name: example-agent-configuration
---
apiVersion: agents.contrastsecurity.com/v1beta1
kind: AgentConnection
metadata:
name: example-agent-connection
spec:
url: http://localhost
apiKey:
secretName: example-agent-connection-secret
secretKey: apiKey
serviceKey:
secretName: example-agent-connection-secret
secretKey: serviceKey
userName:
secretName: example-agent-connection-secret
secretKey: userName
---
apiVersion: v1
kind: Secret
metadata:
name: example-agent-connection-secret
type: Opaque
stringData:
apiKey: apiKey
serviceKey: serviceKey
userName: userName
---
apiVersion: agents.contrastsecurity.com/v1beta1
kind: AgentConfiguration
metadata:
name: example-agent-configuration
spec:
yaml: |
enabled: true
4 changes: 4 additions & 0 deletions manifests/examples/argo-rollouts/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace: default
resources:
- base/dotnet-core.yaml
- base/minimal-setup.yaml

0 comments on commit 0583b2f

Please sign in to comment.