@@ -19,7 +19,7 @@ func newGenerateDeployCommand(appConfig *config.AppConfig) *cobra.Command {
1919 cmd := & cobra.Command {
2020 Use : "deploy-structure" ,
2121 Short : "Generate complete deploy directory structure" ,
22- Long : `Generate the complete deploy directory structure including Cloud Build, Cloud Deploy, and Skaffold configurations.
22+ Long : `Generate the complete deploy directory structure including Cloud Build, Cloud Deploy, Skaffold configurations, and Kubernetes components .
2323
2424Creates the following structure:
2525 deploy/
@@ -34,6 +34,16 @@ Creates the following structure:
3434 │ ├── qa-prod.yml
3535 │ └── preview.yml
3636 └── skaffold.yaml
37+
38+ k8s/components/
39+ ├── database/
40+ │ └── alloydb-omni/
41+ ├── networking/
42+ │ └── gke-network-policy/
43+ ├── observability/
44+ │ └── autoscaling/
45+ └── security/
46+ └── workload-identity/
3747
3848Examples:
3949 # Generate deploy structure in current directory
@@ -58,6 +68,10 @@ Examples:
5868 dirs := []string {
5969 filepath .Join (outputDir , "cloudbuild" ),
6070 filepath .Join (outputDir , "clouddeploy" ),
71+ filepath .Join ("k8s" , "components" , "database" , "alloydb-omni" ),
72+ filepath .Join ("k8s" , "components" , "networking" , "gke-network-policy" ),
73+ filepath .Join ("k8s" , "components" , "observability" , "autoscaling" ),
74+ filepath .Join ("k8s" , "components" , "security" , "workload-identity" ),
6175 }
6276
6377 for _ , dir := range dirs {
@@ -133,12 +147,61 @@ Examples:
133147
134148 fmt .Fprintln (os .Stderr )
135149
150+ // Generate Kubernetes components
151+ components := []struct {
152+ name string
153+ path string
154+ }{
155+ {"database/alloydb-omni" , filepath .Join ("k8s" , "components" , "database" , "alloydb-omni" )},
156+ {"networking/gke-network-policy" , filepath .Join ("k8s" , "components" , "networking" , "gke-network-policy" )},
157+ {"observability/autoscaling" , filepath .Join ("k8s" , "components" , "observability" , "autoscaling" )},
158+ {"security/workload-identity" , filepath .Join ("k8s" , "components" , "security" , "workload-identity" )},
159+ }
160+
161+ for _ , comp := range components {
162+ content , err := generate .GenerateComponent (appConfig , comp .name )
163+ if err != nil {
164+ // If template doesn't exist, skip it
165+ fmt .Fprintf (os .Stderr , "⚠️ Skipping component %s (no template available)\n " , comp .name )
166+ continue
167+ }
168+
169+ // Generate kustomization.yml for the component
170+ kustomizePath := filepath .Join (comp .path , "kustomization.yml" )
171+ if dryRun {
172+ fmt .Fprintf (os .Stderr , "Would create: %s\n " , kustomizePath )
173+ } else {
174+ if err := os .WriteFile (kustomizePath , []byte (content ), 0644 ); err != nil {
175+ return fmt .Errorf ("failed to write %s: %w" , kustomizePath , err )
176+ }
177+ fmt .Fprintf (os .Stderr , "✅ Generated: %s\n " , kustomizePath )
178+ }
179+
180+ // Generate any additional component files (like deployment patches, configmaps, etc.)
181+ additionalFiles , err := generate .GetComponentAdditionalFiles (appConfig , comp .name )
182+ if err == nil && additionalFiles != nil {
183+ for filename , fileContent := range additionalFiles {
184+ filePath := filepath .Join (comp .path , filename )
185+ if dryRun {
186+ fmt .Fprintf (os .Stderr , "Would create: %s\n " , filePath )
187+ } else {
188+ if err := os .WriteFile (filePath , []byte (fileContent ), 0644 ); err != nil {
189+ return fmt .Errorf ("failed to write %s: %w" , filePath , err )
190+ }
191+ fmt .Fprintf (os .Stderr , "✅ Generated: %s\n " , filePath )
192+ }
193+ }
194+ }
195+ }
196+
197+ fmt .Fprintln (os .Stderr )
198+
136199 if dryRun {
137200 fmt .Fprintf (os .Stderr , "✨ Dry run complete! Use without --dry-run to create files.\n " )
138201 } else {
139202 fmt .Fprintf (os .Stderr , "✨ Deploy structure generated successfully!\n " )
140203 fmt .Fprintf (os .Stderr , "\n Next steps:\n " )
141- fmt .Fprintf (os .Stderr , "1. Review the generated files in %s/\n " , outputDir )
204+ fmt .Fprintf (os .Stderr , "1. Review the generated files in %s/ and k8s/components/ \n " , outputDir )
142205 fmt .Fprintf (os .Stderr , "2. Customize as needed for your specific requirements\n " )
143206 fmt .Fprintf (os .Stderr , "3. Commit the changes to your repository\n " )
144207 }
0 commit comments