Skip to content

Commit

Permalink
improved validation and cleanup of obsolete files
Browse files Browse the repository at this point in the history
Signed-off-by: Fotis Nikolaidis <[email protected]>
  • Loading branch information
fnikolai committed Jun 30, 2023
1 parent add645d commit 1b9af17
Show file tree
Hide file tree
Showing 28 changed files with 144 additions and 790 deletions.
24 changes: 20 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,36 @@

## Changes Since Last Release

### Changed defaults / behaviours
- ...

### New Features & Functionality
- Add autocompletion for uninstall command.
- Add validation for missing callable.
- ...

## Bug Fixes
- Remove VirtualObjects and Templates from the list of CRDs whose finalizers can be forcibly deleted (they have no finalizers).
- ...


## 1.0.42 \[2023-06-27\]

### Changed defaults / behaviours
- Moved charts from `charts/{category}` to `examples/apps`. This allows to have the apps and the test-cases on the same directory. Additionally, that
means that chart releasing is no longer part of the frisbee release -- which shouldn't have been the case in the first place.
- Renamed template to be in the format 'frisbee.system...' and 'frisbee.apps'. This, however, warrants a new release because
the renamed systems templates affect the controller.
means that chart releasing is no longer part of the frisbee release -- which shouldn't have been the case in the first place.
- Renamed template to be in the format 'frisbee.system...' and 'frisbee.apps'. This, however, warrants a new release because
the renamed systems templates affect the controller.
- ...

### New Features & Functionality
- ...

## Bug Fixes
- Stalled cached files were used in reporting. Update the cached files every time we run the report command.
- Stalled cached files were used in reporting. Update the cached files every time we run the report command.
- ...


## 1.0.41 \[2023-06-22\]

### Changed defaults / behaviours
Expand Down
14 changes: 12 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
# Build the Frisbee operator binary
FROM golang:1.19 as builder


ENV GOOS=linux
ENV GOARCH=amd64
ENV CGO_ENABLED=0
ENV GOPROXY=direct
ENV GOSUMDB=off

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
RUN go mod download

# go env -w GOPROXY=direct
#go env -w GOSUMDB=off

# Copy the go source
COPY ./cmd/manager/main.go main.go
Expand All @@ -16,7 +26,7 @@ COPY controllers/ controllers/
COPY pkg/ pkg/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o /manager main.go
RUN go build -a -o /manager main.go

# Use alpine as minimal base image to package the Frisbee operator binary
# We use a non-root user setup.
Expand Down
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ To learn more about Frisbee, check the **[QuickStart](https://frisbee.dev/docs/q
our **[Website](https://frisbee.dev)**.


## Use-Cases and Testing Patterns

In declarative testing, a test scenario focuses on what to accomplish rather than on the imperative details of how to manipulate the state of an application under test and verify the final application state against an expected state.

This approach not make tests more *readable, maintainable, and reproducible*, but it also help devops in identifying testing patterns.

Here, you can see some testing patterns we have identified across different application domains.

👉 [Databases](./examples/patterns/databases)

👉 [Federated Learning](./examples/patterns/federated-learning)

👉 [HPC](./examples/patterns/hpc)

👉 [CI](./examples/patterns/ci)


## Getting Started


Expand Down Expand Up @@ -227,24 +244,9 @@ Finally, Frisbee provides an advanced functionality for auto-generating reports
kubectl-frisbee report test demo-326 ~/frisbee-reports --pdf --force
```

This will create report on `~/frisbee/reports` directory including the pdf from Grafana.


## Use-Cases and Testing Patterns

In declarative testing, a test scenario focuses on what to accomplish rather than on the imperative details of how to manipulate the state of an application under test and verify the final application state against an expected state.

This approach not make tests more *readable, maintainable, and reproducible*, but it also help devops in identifying testing patterns.

Here, you can see some testing patterns we have identified across different application domains.

👉 [Databases](./examples/patterns/databases)

👉 [Federated Learning](./examples/patterns/federated-learning)
This will create report on `~/frisbee-reports` directory including the pdf from Grafana.

👉 [HPC](./examples/patterns/hpc)

👉 [CI](./examples/patterns/ci)


## Features
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/crd_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type MatchOutputs struct {
type CallSpec struct {
// Callable is the name of the endpoint that will be called
// +kubebuilder:validation:minlength=1
Callable string `json:"callable,omitempty"`
Callable string `json:"callable"`

// Services is a list of services that will be stopped.
// +kubebuilder:validation:minimum=1
Expand Down
4 changes: 3 additions & 1 deletion charts/platform/crds/frisbee.dev_calls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: calls.frisbee.dev
spec:
group: frisbee.dev
Expand Down Expand Up @@ -177,6 +178,7 @@ spec:
type: integer
type: object
required:
- callable
- services
type: object
status:
Expand Down
3 changes: 2 additions & 1 deletion charts/platform/crds/frisbee.dev_cascades.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: cascades.frisbee.dev
spec:
group: frisbee.dev
Expand Down
3 changes: 2 additions & 1 deletion charts/platform/crds/frisbee.dev_chaos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: chaos.frisbee.dev
spec:
group: frisbee.dev
Expand Down
3 changes: 2 additions & 1 deletion charts/platform/crds/frisbee.dev_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: clusters.frisbee.dev
spec:
group: frisbee.dev
Expand Down
4 changes: 3 additions & 1 deletion charts/platform/crds/frisbee.dev_scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: scenarios.frisbee.dev
spec:
group: frisbee.dev
Expand Down Expand Up @@ -226,6 +227,7 @@ spec:
type: integer
type: object
required:
- callable
- services
type: object
cascade:
Expand Down
3 changes: 2 additions & 1 deletion charts/platform/crds/frisbee.dev_services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: services.frisbee.dev
spec:
group: frisbee.dev
Expand Down
3 changes: 2 additions & 1 deletion charts/platform/crds/frisbee.dev_templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: templates.frisbee.dev
spec:
group: frisbee.dev
Expand Down
3 changes: 2 additions & 1 deletion charts/platform/crds/frisbee.dev_virtualobjects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
name: virtualobjects.frisbee.dev
spec:
group: frisbee.dev
Expand Down
6 changes: 3 additions & 3 deletions charts/system/templates/chaos/network-partition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
apiVersion: frisbee.dev/v1alpha1
kind: Template
metadata:
name: system.chaos.network.partition.scenario
name: frisbee.system.chaos.network.partition.scenario
spec:
inputs:
scenario: "default"
Expand Down Expand Up @@ -66,13 +66,13 @@ spec:
{{.Release.Namespace}}: [{{"{{.inputs.parameters.source}}"}}]
---
# system.chaos.network.partition.namespace will separate the target service from every other service in the namespace,
# frisbee.system.chaos.network.partition.namespace will separate the target service from every other service in the namespace,
# including the monitoring stack and other services irrelevant to frisbee. If the namespace is not specified, the
# installation namespace will be used.
apiVersion: frisbee.dev/v1alpha1
kind: Template
metadata:
name: system.chaos.network.partition.namespace
name: frisbee.system.chaos.network.partition.namespace
spec:
inputs:
parameters:
Expand Down
8 changes: 6 additions & 2 deletions cmd/kubectl-frisbee/commands/common/kubectl-wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,13 @@ const (

// ForceDelete iterates the Frisbee CRDs and remove its finalizers.
func ForceDelete(testName string) error {
crds := []string{Services, Clusters, Chaos, Cascades, VirtualObjects, Calls, Templates, Scenarios}
// CRDS without finalizers:
// VirtualObjects
// Templates

for _, crd := range crds {
crdsWithFinalizers := []string{Services, Clusters, Chaos, Cascades, Calls, Scenarios}

for _, crd := range crdsWithFinalizers {
resourceQuery := []string{"get", crd, "-o", "jsonpath='{.items[*].metadata.name}'"}

// get all resources of the given Kind
Expand Down
19 changes: 12 additions & 7 deletions cmd/kubectl-frisbee/commands/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ import (
"github.com/spf13/cobra"
)

type PlatformUninstallOptions struct {
func UninstallCmdCompletion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return common.CompleteFlags(cmd, args, toComplete)
}

type UninstallOptions struct {
RepositoryCache string
DeleteTests, DeleteOperator, DeleteCRDS, DeleteCache, All bool
}

func PopulatePlatformUninstallFlags(cmd *cobra.Command, options *PlatformUninstallOptions) {
func UninstallFlags(cmd *cobra.Command, options *UninstallOptions) {
cmd.Flags().BoolVar(&options.DeleteTests, "tests", false, "delete frisbee tests")
cmd.Flags().BoolVar(&options.DeleteOperator, "operator", false, "delete frisbee operator")
cmd.Flags().BoolVar(&options.DeleteCRDS, "crds", false, "delete frisbee crds")
Expand All @@ -43,12 +47,13 @@ func PopulatePlatformUninstallFlags(cmd *cobra.Command, options *PlatformUninsta
}

func NewUninstallCmd() *cobra.Command {
var options PlatformUninstallOptions
var options UninstallOptions

cmd := &cobra.Command{
Use: "uninstall",
Short: "Uninstall Frisbee from current kubectl context",
Aliases: []string{"un", "purge"},
Use: "uninstall",
Short: "Uninstall Frisbee from current kubectl context",
Aliases: []string{"un", "purge"},
ValidArgsFunction: UninstallCmdCompletion,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
env.Logo()
ui.SetVerbose(env.Default.Debug)
Expand Down Expand Up @@ -119,7 +124,7 @@ func NewUninstallCmd() *cobra.Command {
}
},
}
PopulatePlatformUninstallFlags(cmd, &options)
UninstallFlags(cmd, &options)

return cmd
}
Loading

0 comments on commit 1b9af17

Please sign in to comment.