GoogleCloudPlatform / pubsec-declarative-toolkit

The GCP PubSec Declarative Toolkit is a collection of declarative solutions to help you on your Journey to Google Cloud. Solutions are designed using Config Connector and deployed using Config Controller.
Apache License 2.0
30 stars 27 forks source link

RootSync GitOps solution does not allow keeping the kpt resource group resource under the same folder. #769

Open jacyang2010 opened 6 months ago

jacyang2010 commented 6 months ago

Describe the bug RootSync GitOps solution does not allow keeping the kpt resource group resource under the same folder. This kind of conflict stops us from utilizing both RootSync and kpt at same time under the package folder.

To Reproduce

Step1: Follow the guide to bootstrap kcc cluster. https://github.com/GoogleCloudPlatform/pubsec-declarative-toolkit/blob/main/docs/landing-zone-v2/README.md Step2: Utilize the kpt command to deploy core landing zone or any other solution. (Be noted that a resource group will be created)

kpt live init core-landing-zone --namespace config-control
kpt fn render core-landing-zone
kpt live apply core-landing-zone --reconcile-timeout=2m --output=table
...

Step3: Create a git repo as Source of Truth and checkout it to local for pushing solutions. Step4: Following the section about Deploy the infrastructure using GitOps fom the guide given in step1. https://github.com/GoogleCloudPlatform/pubsec-declarative-toolkit/blob/main/docs/landing-zone-v2/README.md#3-deploy-the-infrastructure-using-gitops Step5. Check if the resourcegroup.yaml exits under the remote repo folder. Step6: Validate deployment by the below command.

nomos status --contexts gke_${PROJECT_ID}_northamerica-northeast1_krmapihost-${CLUSTER}

You will see the error about multiple inventory objects. (Screenshot TBC)

Step7: Validate deployment from GKE Config GUI. You will see the below error about duplicated resource groups as shown below. The below error shows that RootSync complains that there are multiple inventory objects. image

Expected behavior We should be able to use either kpt or gitops anytime to manage the deployments.

cartyc commented 6 months ago

We'll need to add a section on migrating from a kpt apply to using gitops directly. To solve for this users would need to delete the resourcegroup.yaml file that was generated from the kpt live init command.