Skip to content

Commit

Permalink
add crd changes to helm in gradle build
Browse files Browse the repository at this point in the history
  • Loading branch information
AmaliMatharaarachchi committed Oct 30, 2023
1 parent 2025bd8 commit e0e4997
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 211 deletions.
4 changes: 1 addition & 3 deletions adapter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,13 @@ Following are some tasks with the steps that a developer might do in operator de
14. Generating CRD and other resource yamls:
```bash
make manifests
gradle build
```
This will generate artefacts inside `{OPERATOR_HOME}/config` directory.
15. To make the CRD and other resource changes affect, you need to move the k8s resources to the helm chart in `PROJECT_HOME/helm-charts` directory:
- Copy the newly created CRD (in this example `dp.wso2.com_apipolicies.yaml`) from `adapter/internal/operator/config/crd/bases` to `helm-charts/crds`.
- Append new rules to the `ClusterRole` in `helm-charts/templates/serviceAccount/apk-cluster-role.yaml`.
```yaml
Expand Down
7 changes: 7 additions & 0 deletions adapter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ tasks.register('go_test', Exec) {
tasks.named('go_revive_run').configure {
finalizedBy go_tidy
finalizedBy go_test
finalizedBy add_crds_helm
dependsOn operator_make
dependsOn operator_make_manifests
}
Expand All @@ -85,6 +86,12 @@ tasks.register('operator_make_manifests', Exec) {
finalizedBy go_build
}

tasks.register('add_crds_helm', Exec) {
group 'go'
description 'copy new CRD changes to helm chart'
commandLine 'cp','-r', "$rootDir/../adapter/internal/operator/config/crd/bases/", "$rootDir/../helm-charts/crds"
}

tasks.named('go_build').configure {
dependsOn operator_make_manifests
dependsOn go_revive_run
Expand Down
3 changes: 2 additions & 1 deletion adapter/internal/operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ help: ## Display this help.

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./apis/dp/..." output:crd:artifacts:config=config/crd/bases


.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions helm-charts/crds/dp.wso2.com_apipolicies.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# --------------------------------------------------------------------
# Copyright (c) 2023, WSO2 LLC. (http://wso2.com) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------


---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
15 changes: 0 additions & 15 deletions helm-charts/crds/dp.wso2.com_backends.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
# --------------------------------------------------------------------
# Copyright (c) 2023, WSO2 LLC. (http://wso2.com) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
16 changes: 0 additions & 16 deletions helm-charts/crds/dp.wso2.com_interceptorservices.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
# --------------------------------------------------------------------
# Copyright (c) 2023, WSO2 LLC. (http://wso2.com) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
16 changes: 0 additions & 16 deletions helm-charts/crds/dp.wso2.com_scopes.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
# --------------------------------------------------------------------
# Copyright (c) 2023, WSO2 LLC. (http://wso2.com) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down

0 comments on commit e0e4997

Please sign in to comment.