Skip to content

Commit

Permalink
Merge pull request #18 from rajaSahil/fix-nimbus
Browse files Browse the repository at this point in the history
fix(nimbus): fix api and directory structure
  • Loading branch information
nyrahul authored Dec 18, 2023
2 parents c9d97d2 + 1df45d4 commit f0e7d4a
Show file tree
Hide file tree
Showing 24 changed files with 34 additions and 32 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ COPY go.sum go.sum
RUN go mod download

# Copy the go source
COPY Nimbus/cmd/main.go Nimbus/cmd/main.go
COPY Nimbus/api/ Nimbus/api/
COPY Nimbus/ontrollers/ Nimbus/controllers/
COPY cmd/main.go cmd/main.go
COPY pkg/api/ pkg/api/
COPY pkg/controllers/ pkg/controllers/

# Build
# the GOARCH has not a default value to allow the binary be built according to the host where the command
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="Nimbus/hack/boilerplate.go.txt" paths="./Nimbus/..."
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./pkg/..."

.PHONY: fmt
fmt: ## Run go fmt against code.
Expand All @@ -68,7 +68,7 @@ vet: ## Run go vet against code.
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out

GOLANGCI_LINT = $(shell pwd)/Nimbus/bin/golangci-lint
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
GOLANGCI_LINT_VERSION ?= v1.54.2
golangci-lint:
@[ -f $(GOLANGCI_LINT) ] || { \
Expand All @@ -88,11 +88,11 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes

.PHONY: build
build: manifests generate fmt vet ## Build manager binary.
go build -o Nimbus/bin/manager Nimbus/cmd/main.go
go build -o bin/manager cmd/main.go

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
go run Nimbus/cmd/main.go
go run cmd/main.go

# If you wish to build the manager image targeting other platforms you can use the --platform flag.
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
Expand Down Expand Up @@ -149,7 +149,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
##@ Build Dependencies

## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/Nimbus/bin
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)

Expand Down
Binary file removed Nimbus/bin/controller-gen
Binary file not shown.
Binary file removed Nimbus/bin/kustomize
Binary file not shown.
10 changes: 5 additions & 5 deletions Nimbus/cmd/main.go → cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

// Importing custom API types and controllers
intentv1 "github.com/5GSEC/nimbus/Nimbus/api/v1"
"github.com/5GSEC/nimbus/Nimbus/controllers"
cleanup "github.com/5GSEC/nimbus/Nimbus/controllers/cleanup"
general "github.com/5GSEC/nimbus/Nimbus/controllers/general"
policy "github.com/5GSEC/nimbus/Nimbus/controllers/policy"
intentv1 "github.com/5GSEC/nimbus/pkg/api/v1"
"github.com/5GSEC/nimbus/pkg/controllers"
cleanup "github.com/5GSEC/nimbus/pkg/controllers/cleanup"
general "github.com/5GSEC/nimbus/pkg/controllers/general"
policy "github.com/5GSEC/nimbus/pkg/controllers/policy"

// Importing third-party Kubernetes resource types
ciliumv2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
require (
github.com/cilium/cilium v1.14.3
github.com/go-logr/logr v1.3.0
github.com/kubearmor/KubeArmor/pkg/KubeArmorController v0.0.0-20231215052929-bc6c2f17fe38
github.com/kubearmor/KubeArmor/pkg/KubeArmorController v0.0.0-20231218054902-8b18cac961c0
github.com/onsi/ginkgo/v2 v2.11.0
github.com/onsi/gomega v1.27.10
k8s.io/apimachinery v0.28.3
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubearmor/KubeArmor/pkg/KubeArmorController v0.0.0-20231215052929-bc6c2f17fe38 h1:nlgCW1NsV9AGk0ghzanS92b91wv18QHOEnEx8PI8MSQ=
github.com/kubearmor/KubeArmor/pkg/KubeArmorController v0.0.0-20231215052929-bc6c2f17fe38/go.mod h1:LtrnsoV9isTrXx0ClJgKxSJ/gbYmDj9m3pXIjG1yxBg=
github.com/kubearmor/KubeArmor/pkg/KubeArmorController v0.0.0-20231218054902-8b18cac961c0 h1:Mme8Mfj+g9eQudASTXdz9d/zG2mLIpptvisC9u2RCRQ=
github.com/kubearmor/KubeArmor/pkg/KubeArmorController v0.0.0-20231218054902-8b18cac961c0/go.mod h1:LtrnsoV9isTrXx0ClJgKxSJ/gbYmDj9m3pXIjG1yxBg=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/go-logr/logr"
"sigs.k8s.io/controller-runtime/pkg/client"

intentv1 "github.com/5GSEC/nimbus/Nimbus/api/v1"
general "github.com/5GSEC/nimbus/Nimbus/controllers/general"
policy "github.com/5GSEC/nimbus/Nimbus/controllers/policy"
intentv1 "github.com/5GSEC/nimbus/pkg/api/v1"
general "github.com/5GSEC/nimbus/pkg/controllers/general"
policy "github.com/5GSEC/nimbus/pkg/controllers/policy"
)

// Cleanup is a function to clean up SecurityIntent resources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"sigs.k8s.io/controller-runtime/pkg/log"

intentv1 "github.com/5GSEC/nimbus/Nimbus/api/v1"
intentv1 "github.com/5GSEC/nimbus/pkg/api/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"

intentv1 "github.com/5GSEC/nimbus/Nimbus/api/v1"
intentv1 "github.com/5GSEC/nimbus/pkg/api/v1"
"k8s.io/apimachinery/pkg/api/errors"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"

intentv1 "github.com/5GSEC/nimbus/Nimbus/api/v1"
intentv1 "github.com/5GSEC/nimbus/pkg/api/v1"
"k8s.io/apimachinery/pkg/api/errors"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

ciliumv2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2"

general "github.com/5GSEC/nimbus/Nimbus/controllers/general"
utils "github.com/5GSEC/nimbus/Nimbus/controllers/utils"
general "github.com/5GSEC/nimbus/pkg/controllers/general"
utils "github.com/5GSEC/nimbus/pkg/controllers/utils"
)

// NetworkPolicyController struct to handle network policies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"

general "github.com/5GSEC/nimbus/Nimbus/controllers/general"
general "github.com/5GSEC/nimbus/pkg/controllers/general"
)

// Constant for the finalizer name used in the SecurityIntent resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"

general "github.com/5GSEC/nimbus/Nimbus/controllers/general"
utils "github.com/5GSEC/nimbus/Nimbus/controllers/utils"
general "github.com/5GSEC/nimbus/pkg/controllers/general"
utils "github.com/5GSEC/nimbus/pkg/controllers/utils"
)

// SystemPolicyController is a struct to handle system policies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"

"github.com/5GSEC/nimbus/Nimbus/api/v1"
general "github.com/5GSEC/nimbus/Nimbus/controllers/general"
"github.com/5GSEC/nimbus/pkg/api/v1"
general "github.com/5GSEC/nimbus/pkg/controllers/general"
)

type SecurityIntentReconciler struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"

intentv1 "github.com/5GSEC/nimbus/Nimbus/api/v1"
general "github.com/5GSEC/nimbus/Nimbus/controllers/general"
policy "github.com/5GSEC/nimbus/Nimbus/controllers/policy"
intentv1 "github.com/5GSEC/nimbus/pkg/api/v1"
general "github.com/5GSEC/nimbus/pkg/controllers/general"
policy "github.com/5GSEC/nimbus/pkg/controllers/policy"
)

// SecurityIntentBindingReconciler reconciles a SecurityIntentBinding object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

intentv1 "github.com/5GSEC/nimbus/Nimbus/api/v1"
intentv1 "github.com/5GSEC/nimbus/pkg/api/v1"
//+kubebuilder:scaffold:imports
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"reflect"
"strings"

general "github.com/5GSEC/nimbus/Nimbus/controllers/general"
general "github.com/5GSEC/nimbus/pkg/controllers/general"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
client "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
Expand Down

0 comments on commit f0e7d4a

Please sign in to comment.