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

Fix Issue #28 #29

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a53f1d0
feat: Add a cleanup script that can delete all resources (running the…
b0m313 Jan 5, 2024
4407548
fix:: Resolve an issue with deleting SIBs
b0m313 Jan 5, 2024
76b7bc4
style(cleanup): Add license
b0m313 Jan 5, 2024
36ef54d
Move script file
seungsoo-lee Jan 6, 2024
61e72cc
Deleted files
seungsoo-lee Jan 6, 2024
e4fc074
feat(api): Add syscalls-related field
b0m313 Jan 9, 2024
08e52bd
feat(config): Add syscalls-related fields
b0m313 Jan 9, 2024
0f699de
feat: Add go.work to use two mods
b0m313 Jan 9, 2024
bb10d04
feat(config): Add the adapter's config
b0m313 Jan 9, 2024
e4e5d07
feat(receiver): Add a receiver for the adapter
b0m313 Jan 9, 2024
2f38ca1
feat(core): Add a transformer and Applier for the adapter
b0m313 Jan 9, 2024
665ec93
feat(adapter): Add adapter-specific main.go and other files
b0m313 Jan 9, 2024
169e905
feat(adapter): Add core(converter, enforcer)
b0m313 Jan 9, 2024
7a73ed2
feat(adapter): Add applier and modify package name
b0m313 Jan 9, 2024
5cab7e0
featgo.mod): go version to use go.work (requires go >= 1.21)
b0m313 Jan 9, 2024
7027dd1
feat(applier): Add license
b0m313 Jan 9, 2024
c692c1e
feat(receiver): Add karmor policy delete
b0m313 Jan 9, 2024
af70371
test(v2): Modify ID
b0m313 Jan 9, 2024
67a4fa2
Docs: Update Tutorials
b0m313 Jan 9, 2024
a241d69
fix(go.mod): Resolve lint
b0m313 Jan 9, 2024
f7ea821
fix(gomod): resolve golangci-lint
b0m313 Jan 9, 2024
8a5432a
Update Quick-tutorials.md
seungsoo-lee Jan 9, 2024
2805557
Update nimbus-adapter
b0m313 Jan 9, 2024
8d34372
Delete core directory
b0m313 Jan 9, 2024
a3633ee
fix(adapter): Modify path (main.go)
b0m313 Jan 9, 2024
6a603cf
Update nimbus adapter
seungsoo-lee Jan 9, 2024
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
12 changes: 12 additions & 0 deletions pkg/cleanup/cleanup.sh
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the specific purpose of this script in explicitly removing the CRs? Under what circumstances should a user execute it?

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Delete all SecurityIntent resources
kubectl delete securityintents --all --all-namespaces

# Delete all SecurityIntentBinding resources
kubectl delete securityintentbindings --all --all-namespaces

# Delete all NimbusPolicy resources
kubectl delete nimbuspolicies --all --all-namespaces

echo "All resources have been successfully deleted."
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import (
"context"
"fmt"

"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
Expand Down Expand Up @@ -76,6 +78,23 @@ func (r *SecurityIntentBindingReconciler) Reconcile(ctx context.Context, req ctr
log.Info("SecurityIntentBinding resource found", "Name", req.Name, "Namespace", req.Namespace)
} else {
log.Info("SecurityIntentBinding resource not found", "Name", req.Name, "Namespace", req.Namespace)

// Delete associated NimbusPolicy if exists
nimbusPolicy := &v1.NimbusPolicy{}
err := r.Get(ctx, types.NamespacedName{Name: req.Name, Namespace: req.Namespace}, nimbusPolicy)
if err != nil && !errors.IsNotFound(err) {
log.Error(err, "Failed to get NimbusPolicy for deletion")
return ctrl.Result{}, err
}
if err == nil {
// NimbusPolicy exists, delete it
if err := r.Delete(ctx, nimbusPolicy); err != nil {
log.Error(err, "Failed to delete NimbusPolicy")
return ctrl.Result{}, err
}
log.Info("Deleted NimbusPolicy due to SecurityIntentBinding deletion", "NimbusPolicy", req.NamespacedName)
}
return ctrl.Result{}, nil
}

// Call the MatchAndBindIntents function to generate the binding information.
Expand Down
Loading