From 04751c5cecda43ea578e169166ee5699ebe14fcd Mon Sep 17 00:00:00 2001
From: James Sturtevant <jstur@microsoft.com>
Date: Wed, 7 Sep 2022 23:10:27 +0000
Subject: [PATCH] fix crds after #5065

Signed-off-by: James Sturtevant <jstur@microsoft.com>
---
 Tiltfile | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/Tiltfile b/Tiltfile
index 089afe04fd..d64878c370 100644
--- a/Tiltfile
+++ b/Tiltfile
@@ -28,7 +28,7 @@ def remove_securityContext(yaml_stream):
 
     return yaml_stream
 
-def dockerfile_gen(binary_name):
+def dockerfile_gen(binary_name, additionalCommands=[]):
     tilt_dockerfile_header = """
 FROM gcr.io/distroless/base:debug as tilt
 WORKDIR /
@@ -36,8 +36,8 @@ COPY ./{} /{}
 """.format(binary_name, binary_name)
 
     return "\n".join([
-        tilt_dockerfile_header,
-    ])
+        tilt_dockerfile_header
+    ] + additionalCommands)
 
 local("kubectl create ns osm-system || true", quiet = True)
 
@@ -74,8 +74,8 @@ local_resource(
 
 local_resource(
   'bootstrap-compile',
-  'CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/osm-bootstrap ./cmd/osm-bootstrap',
-  deps=['./cmd/osm-bootstrap/osm-bootstrap.go', 'pkg'],
+  'CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/osm-bootstrap ./cmd/osm-bootstrap && cp -r ./cmd/osm-bootstrap/crds ./build',
+  deps=['./cmd/osm-bootstrap/osm-bootstrap.go', 'pkg', './cmd/osm-bootstrap/crds'],
   labels=['compile']
 )
 
@@ -112,13 +112,6 @@ docker_build_with_restart(
       ]
 )
 
-docker_build(
-    'openservicemesh/osm-crds',
-    dockerfile='./dockerfiles/Dockerfile.osm-crds',
-    context='./cmd/osm-bootstrap/crds/',
-    platform = 'linux/amd64'
-)
-
 docker_build_with_restart(
     'openservicemesh/osm-injector',
     context='./build/',
@@ -137,9 +130,10 @@ docker_build_with_restart(
     'openservicemesh/osm-bootstrap',
     context='./build/',
     target='tilt',
-    dockerfile_contents = dockerfile_gen('osm-bootstrap'),
+    dockerfile_contents = dockerfile_gen('osm-bootstrap', ["COPY ./crds/* /osm-crds/"]),
     only=[
-        'osm-bootstrap'
+        'osm-bootstrap',
+        'crds/'
     ],
     entrypoint=['/osm-bootstrap'],
     live_update=[