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

Update project to match expected operator-sdk v4 layout #3586

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ GO_BUILD_VER?=v0.94
CALICO_BUILD?=calico/go-build:$(GO_BUILD_VER)-$(BUILDARCH)
SRC_FILES=$(shell find ./pkg -name '*.go')
SRC_FILES+=$(shell find ./api -name '*.go')
SRC_FILES+=$(shell find ./controllers -name '*.go')
SRC_FILES+=$(shell find ./internal/ -name '*.go')
SRC_FILES+=$(shell find ./test -name '*.go')
SRC_FILES+=main.go
SRC_FILES+=cmd/main.go

EXTRA_DOCKER_ARGS += -e GOPRIVATE=github.com/tigera/*
ifeq ($(GIT_USE_SSH),true)
Expand Down Expand Up @@ -225,7 +225,7 @@ $(BINDIR)/operator-$(ARCH): $(SRC_FILES)
mkdir -p $(BINDIR)
$(CONTAINERIZED) -e CGO_ENABLED=$(CGO_ENABLED) -e GOEXPERIMENT=$(GOEXPERIMENT) $(CALICO_BUILD) \
sh -c '$(GIT_CONFIG_SSH) \
go build -buildvcs=false -v -o $(BINDIR)/operator-$(ARCH) -tags "$(TAGS)" -ldflags "-X $(PACKAGE_NAME)/version.VERSION=$(GIT_VERSION) -s -w" ./main.go'
go build -buildvcs=false -v -o $(BINDIR)/operator-$(ARCH) -tags "$(TAGS)" -ldflags "-X $(PACKAGE_NAME)/version.VERSION=$(GIT_VERSION) -s -w" ./cmd/main.go'
ifeq ($(ARCH), $(filter $(ARCH),amd64))
$(CONTAINERIZED) $(CALICO_BUILD) sh -c 'strings $(BINDIR)/operator-$(ARCH) | grep '_Cfunc__goboringcrypto_' 1> /dev/null'
endif
Expand Down Expand Up @@ -427,7 +427,7 @@ fix:
format-check:
@$(CONTAINERIZED) $(CALICO_BUILD) \
sh -c '$(GIT_CONFIG_SSH) \
files=$$(gofmt -l ./pkg ./controllers ./api ./test); \
files=$$(gofmt -l ./pkg ./internal/controller ./api ./test); \
[ "$$files" = "" ] && exit 0; \
echo The following files need a format update:; \
echo $$files; \
Expand Down Expand Up @@ -734,7 +734,7 @@ CONTROLLER_GEN_VERSION ?= v0.14.0

# Run against the configured Kubernetes cluster in ~/.kube/config
run: generate fmt vet manifests
go run ./main.go
go run ./cmd/main.go

# Install CRDs into a cluster
install: manifests kustomize
Expand Down Expand Up @@ -777,7 +777,7 @@ generate:
$(DOCKER_RUN) sh -c 'go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION) && \
controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./api/..." && \
controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./pkg/..." && \
controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./controllers/..."'
controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./internal/controller/..."'
-# Run fix because generate was removing `//go:build !ignore_autogenerated` from the generated files
-# but then fix adds it back.
$(MAKE) fix
Expand Down
180 changes: 175 additions & 5 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,11 +1,181 @@
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: tigera.io
layout: go.kubebuilder.io/v2
layout:
- go.kubebuilder.io/v4
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
projectName: operator
repo: github.com/tigera/operator
resources:
- group: operator
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: Installation
path: github.com/tigera/operator/api/v1
version: v1
version: 3-alpha
plugins:
go.sdk.operatorframework.io/v2-alpha: {}
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: APIServer
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: Monitor
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: LogCollector
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: TigeraStatus
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: tigera.io
group: operator
kind: EgressGateway
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: ImageSet
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: IntrusionDetection
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: PacketCaptureAPI
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: LogStorage
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: Authentication
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: ManagementCluster
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: ApplicationLayer
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: Manager
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
namespaced: true
domain: tigera.io
group: operator
kind: Tenant
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: ManagementClusterConnection
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: NonClusterHost
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: PolicyRecommendation
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
controller: true
domain: tigera.io
group: operator
kind: Compliance
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
domain: tigera.io
group: operator
kind: TLSTerminatedRoute
path: github.com/tigera/operator/api/v1
version: v1
- api:
crdVersion: v1
domain: tigera.io
group: operator
kind: TLSPassthroughRoute
path: github.com/tigera/operator/api/v1
version: v1
version: "3"
5 changes: 3 additions & 2 deletions main.go → cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ import (
"github.com/cloudflare/cfssl/log"

v3 "github.com/tigera/api/pkg/apis/projectcalico/v3"

operatorv1 "github.com/tigera/operator/api/v1"
v1 "github.com/tigera/operator/api/v1"
"github.com/tigera/operator/controllers"
"github.com/tigera/operator/internal/controller"
"github.com/tigera/operator/pkg/active"
"github.com/tigera/operator/pkg/apis"
"github.com/tigera/operator/pkg/awssgsetup"
Expand Down Expand Up @@ -426,7 +427,7 @@ func main() {
os.Exit(1)
}

err = controllers.AddToManager(mgr, options)
err = controller.AddToManager(mgr, options)
if err != nil {
setupLog.Error(err, "unable to create controllers")
os.Exit(1)
Expand Down
43 changes: 43 additions & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This kustomization.yaml is not intended to be run by itself,
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/operator.tigera.io_apiservers.yaml
- bases/operator.tigera.io_applicationlayers.yaml
- bases/operator.tigera.io_authentications.yaml
- bases/operator.tigera.io_compliances.yaml
- bases/operator.tigera.io_egressgateways.yaml
- bases/operator.tigera.io_imagesets.yaml
- bases/operator.tigera.io_installations.yaml
- bases/operator.tigera.io_intrusiondetections.yaml
- bases/operator.tigera.io_logcollectors.yaml
- bases/operator.tigera.io_logstorages.yaml
- bases/operator.tigera.io_managementclusterconnections.yaml
- bases/operator.tigera.io_managementclusters.yaml
- bases/operator.tigera.io_managers.yaml
- bases/operator.tigera.io_monitors.yaml
- bases/operator.tigera.io_nonclusterhosts.yaml
- bases/operator.tigera.io_packetcaptureapis.yaml
- bases/operator.tigera.io_policyrecommendations.yaml
- bases/operator.tigera.io_tenants.yaml
- bases/operator.tigera.io_tigerastatuses.yaml
- bases/operator.tigera.io_tlspassthroughroutes.yaml
- bases/operator.tigera.io_tlsterminatedroutes.yaml

#+kubebuilder:scaffold:crdkustomizeresource

patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- path: patches/cainjection_in_foos.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# [WEBHOOK] To enable webhook, uncomment the following section
# the following config is for teaching kustomize how to do kustomization for CRDs.

#configurations:
#- kustomizeconfig.yaml
19 changes: 19 additions & 0 deletions config/crd/kustomizeconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file is for teaching kustomize how to substitute name and namespace reference in CRD
nameReference:
- kind: Service
version: v1
fieldSpecs:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/name

namespace:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/namespace
create: false

varReference:
- path: metadata/annotations
22 changes: 22 additions & 0 deletions config/samples/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
## Append samples you want in your CSV to this file as resources ##
resources:
- operator_v1_installation.yaml
- operator_v1_foo.yaml
- operator_v1_apiserver.yaml
- operator_v1_applicationlayer.yaml
- operator_v1_authentication.yaml
- operator_v1_compliance.yaml
- operator_v1_egressgateway.yaml
- operator_v1_imageset.yaml
- operator_v1_installation.yaml
- operator_v1_intrusiondetection.yaml
- operator_v1_logcollector.yaml
- operator_v1_logstorage.yaml
- operator_v1_managementclusterconnection.yaml
- operator_v1_managementcluster.yaml
- operator_v1_manager.yaml
- operator_v1_monitor.yaml
- operator_v1_nonclusterhost.yaml
- operator_v1_packetcaptureapi.yaml
- operator_v1_policyrecommendation.yaml
- operator_v1_tenant.yaml
- operator_v1_tigerastatus.yaml
- operator_v1_tlspassthroughroute.yaml
- operator_v1_tlsterminatedroute.yaml
# +kubebuilder:scaffold:manifestskustomizesamples
6 changes: 5 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require (
github.com/hashicorp/go-version v1.7.0
github.com/olivere/elastic/v7 v7.0.32
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.20.1
github.com/onsi/gomega v1.34.2
github.com/openshift/api v0.0.0-20240924220842-3c700b6cb32b
github.com/openshift/library-go v0.0.0-20240930172803-190f286b06b1
Expand Down Expand Up @@ -59,11 +60,13 @@ require (
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect
github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand Down Expand Up @@ -95,12 +98,13 @@ require (
go.elastic.co/apm/v2 v2.6.0 // indirect
go.elastic.co/fastjson v1.3.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.24.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.34.2 // indirect
Expand Down
Loading
Loading