@@ -77,22 +77,28 @@ var (
7777 // which is containing "hard-coded" tilt-provider.yaml files for the providers managed in the Cluster API repository.
7878 providers = map [string ]tiltProviderConfig {
7979 "core" : {
80- Context : ptr .To ("." ),
80+ Context : ptr .To ("." ),
81+ hardCodedProvider : true ,
8182 },
8283 "kubeadm-bootstrap" : {
83- Context : ptr .To ("bootstrap/kubeadm" ),
84+ Context : ptr .To ("bootstrap/kubeadm" ),
85+ hardCodedProvider : true ,
8486 },
8587 "kubeadm-control-plane" : {
86- Context : ptr .To ("controlplane/kubeadm" ),
88+ Context : ptr .To ("controlplane/kubeadm" ),
89+ hardCodedProvider : true ,
8790 },
8891 "docker" : {
89- Context : ptr .To ("test/infrastructure/docker" ),
92+ Context : ptr .To ("test/infrastructure/docker" ),
93+ hardCodedProvider : true ,
9094 },
9195 "in-memory" : {
92- Context : ptr .To ("test/infrastructure/inmemory" ),
96+ Context : ptr .To ("test/infrastructure/inmemory" ),
97+ hardCodedProvider : true ,
9398 },
9499 "test-extension" : {
95- Context : ptr .To ("test/extension" ),
100+ Context : ptr .To ("test/extension" ),
101+ hardCodedProvider : true ,
96102 },
97103 }
98104
@@ -137,6 +143,9 @@ type tiltProviderConfig struct {
137143 ApplyProviderYaml * bool `json:"apply_provider_yaml,omitempty"`
138144 KustomizeFolder * string `json:"kustomize_folder,omitempty"`
139145 KustomizeOptions []string `json:"kustomize_options,omitempty"`
146+
147+ // hardCodedProvider is used for providers hardcoded in the Tiltfile to always set cmd for them to start.sh to allow restarts.
148+ hardCodedProvider bool
140149}
141150
142151func init () {
@@ -354,7 +363,7 @@ func tiltResources(ctx context.Context, ts *tiltSettings) error {
354363 debugConfig = & d
355364 }
356365 extraArgs := ts .ExtraArgs [providerName ]
357- tasks [providerName ] = workloadTask (providerName , "provider" , "manager" , "manager" , liveReloadDeps , debugConfig , extraArgs , kustomizeFolder , kustomizeOptions , getProviderObj (config .Version ))
366+ tasks [providerName ] = workloadTask (providerName , "provider" , "manager" , "manager" , liveReloadDeps , debugConfig , extraArgs , config . hardCodedProvider , kustomizeFolder , kustomizeOptions , getProviderObj (config .Version ))
358367 }
359368 }
360369
@@ -693,7 +702,7 @@ func kustomizeTask(path, out string) taskFunction {
693702// workloadTask generates a task for creating the component yaml for a workload and saving the output on a file.
694703// NOTE: This task has several sub steps including running kustomize, envsubst, fixing components for debugging,
695704// and adding the workload resource mimicking what clusterctl init does.
696- func workloadTask (name , workloadType , binaryName , containerName string , liveReloadDeps []string , debugConfig * tiltSettingsDebugConfig , extraArgs tiltSettingsExtraArgs , path string , options []string , getAdditionalObject func (string , []unstructured.Unstructured ) (* unstructured.Unstructured , error )) taskFunction {
705+ func workloadTask (name , workloadType , binaryName , containerName string , liveReloadDeps []string , debugConfig * tiltSettingsDebugConfig , extraArgs tiltSettingsExtraArgs , hardCodedProvider bool , path string , options []string , getAdditionalObject func (string , []unstructured.Unstructured ) (* unstructured.Unstructured , error )) taskFunction {
697706 return func (ctx context.Context , prefix string , errCh chan error ) {
698707 args := []string {"build" }
699708 args = append (args , options ... )
@@ -725,7 +734,7 @@ func workloadTask(name, workloadType, binaryName, containerName string, liveRelo
725734 return
726735 }
727736
728- if err := prepareWorkload (prefix , binaryName , containerName , objs , liveReloadDeps , debugConfig , extraArgs ); err != nil {
737+ if err := prepareWorkload (prefix , binaryName , containerName , objs , liveReloadDeps , debugConfig , extraArgs , hardCodedProvider ); err != nil {
729738 errCh <- err
730739 return
731740 }
@@ -794,7 +803,7 @@ func writeIfChanged(prefix string, path string, yaml []byte) error {
794803// If there are extra_args given for the workload, we append those to the ones that already exist in the deployment.
795804// This has the affect that the appended ones will take precedence, as those are read last.
796805// Finally, we modify the deployment to enable prometheus metrics scraping.
797- func prepareWorkload (prefix , binaryName , containerName string , objs []unstructured.Unstructured , liveReloadDeps []string , debugConfig * tiltSettingsDebugConfig , extraArgs tiltSettingsExtraArgs ) error {
806+ func prepareWorkload (prefix , binaryName , containerName string , objs []unstructured.Unstructured , liveReloadDeps []string , debugConfig * tiltSettingsDebugConfig , extraArgs tiltSettingsExtraArgs , hardcodedProvider bool ) error {
798807 // Update provider namespaces to have the pod security standard enforce label set to privileged.
799808 // This is required because we remove the SecurityContext from provider deployments below to make tilt work.
800809 updateNamespacePodSecurityStandard (objs )
@@ -805,7 +814,7 @@ func prepareWorkload(prefix, binaryName, containerName string, objs []unstructur
805814 }
806815
807816 cmd := []string {"/" + binaryName }
808- if len (liveReloadDeps ) > 0 || debugConfig != nil {
817+ if len (liveReloadDeps ) > 0 || debugConfig != nil || hardcodedProvider {
809818 cmd = []string {"sh" , "/start.sh" , "/" + binaryName }
810819 }
811820 args := append (container .Args , []string (extraArgs )... )
0 commit comments