Skip to content

Commit

Permalink
fix: Move kustomize (#145)
Browse files Browse the repository at this point in the history
* Move kustomize manifests

* Remove sample files

* Add note when running run-helmify

* Update go tests with new kustomize path
  • Loading branch information
dbudziwojskiNR authored Nov 7, 2024
1 parent e716f6d commit daa96ee
Show file tree
Hide file tree
Showing 44 changed files with 12 additions and 13 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
bin/
tmp/

config

# Downloaded chart dependencies
**/charts/*.tgz
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,14 @@ generate: controller-gen ## Generate stuff
.PHONY: manifests
manifests: generate controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) webhook paths="./..." \
rbac:roleName=manager-role output:rbac:artifacts:config=tests/kustomize/rbac \
output:webhook:artifacts:config=tests/kustomize/webhook \
output:crd:artifacts:config=tests/kustomize/crd/bases \
rbac:roleName=manager-role output:rbac:artifacts:config=config/rbac \
output:webhook:artifacts:config=config/webhook \
output:crd:artifacts:config=config/crd/bases \
output:stdout

.PHONY: run-helmify
run-helmify: manifests helmify kustomize ## Generate the CRD with kustomize and helmify from the manifests
@# could we do more here?
$(KUSTOMIZE) build tests/kustomize/default | $(HELMIFY) tmp/k8s-agents-operator
$(KUSTOMIZE) build config/default | $(HELMIFY) tmp/k8s-agents-operator
cp ./tmp/k8s-agents-operator/templates/instrumentation-crd.yaml ./charts/k8s-agents-operator/templates/instrumentation-crd.yaml
printf "\nIMPORTANT: The generated chart needs to be transformed!\n- deployment.yaml is split into deployment.yaml and service-account.yaml\n- mutating-webhook-configuration.yaml and validating-webhook-configuration.yaml are merged into service-account.yaml\n- Documents generated are missing several config options (i.e. labels)\n"
2 changes: 1 addition & 1 deletion tests/kustomize/README.md → config/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Structure

The `kustomize` folder contains the Kustomize resources that are used to assemble the operator's deployment units for testing
The `config` folder contains the Kustomize resources that are used to assemble the operator's deployment units for testing

```
.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/api/v1alpha2/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ var _ = BeforeSuite(func() {

By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "tests", "kustomize", "crd", "bases")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")},
ErrorIfCRDPathMissing: false,
WebhookInstallOptions: envtest.WebhookInstallOptions{
Paths: []string{filepath.Join("..", "..", "..", "tests", "kustomize", "webhook")},
Paths: []string{filepath.Join("..", "..", "..", "config", "webhook")},
},
}

Expand Down
2 changes: 1 addition & 1 deletion src/instrumentation/instrumentation_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var k8sClient client.Client

func TestMain(m *testing.M) {
testEnv := &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "tests", "kustomize", "crd", "bases")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
}

cfg, err := testEnv.Start()
Expand Down
2 changes: 1 addition & 1 deletion src/instrumentation/upgrade/upgrade_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var cfg *rest.Config
func TestMain(m *testing.M) {
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{
filepath.Join("..", "..", "..", "tests", "kustomize", "crd", "bases"),
filepath.Join("..", "..", "..", "config", "crd", "bases"),
},
}

Expand Down
4 changes: 2 additions & 2 deletions src/internal/webhookhandler/webhookhandler_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestMain(m *testing.M) {
logger := zap.New(zap.UseDevMode(true), zap.WriteTo(&fakeWriter{}))

testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "tests", "kustomize", "crd", "bases")},
CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")},

ErrorIfCRDPathMissing: false,

Expand All @@ -96,7 +96,7 @@ func TestMain(m *testing.M) {
fmt.Sprintf("1.29.0-%s-%s", stdruntime.GOOS, stdruntime.GOARCH)),

WebhookInstallOptions: envtest.WebhookInstallOptions{
Paths: []string{filepath.Join("..", "..", "..", "tests", "kustomize", "webhook")},
Paths: []string{filepath.Join("..", "..", "..", "config", "webhook")},
},
}
cfg, err = testEnv.Start()
Expand Down

0 comments on commit daa96ee

Please sign in to comment.