@@ -77,22 +77,28 @@ var (
77
77
// which is containing "hard-coded" tilt-provider.yaml files for the providers managed in the Cluster API repository.
78
78
providers = map [string ]tiltProviderConfig {
79
79
"core" : {
80
- Context : ptr .To ("." ),
80
+ Context : ptr .To ("." ),
81
+ hardCodedProvider : true ,
81
82
},
82
83
"kubeadm-bootstrap" : {
83
- Context : ptr .To ("bootstrap/kubeadm" ),
84
+ Context : ptr .To ("bootstrap/kubeadm" ),
85
+ hardCodedProvider : true ,
84
86
},
85
87
"kubeadm-control-plane" : {
86
- Context : ptr .To ("controlplane/kubeadm" ),
88
+ Context : ptr .To ("controlplane/kubeadm" ),
89
+ hardCodedProvider : true ,
87
90
},
88
91
"docker" : {
89
- Context : ptr .To ("test/infrastructure/docker" ),
92
+ Context : ptr .To ("test/infrastructure/docker" ),
93
+ hardCodedProvider : true ,
90
94
},
91
95
"in-memory" : {
92
- Context : ptr .To ("test/infrastructure/inmemory" ),
96
+ Context : ptr .To ("test/infrastructure/inmemory" ),
97
+ hardCodedProvider : true ,
93
98
},
94
99
"test-extension" : {
95
- Context : ptr .To ("test/extension" ),
100
+ Context : ptr .To ("test/extension" ),
101
+ hardCodedProvider : true ,
96
102
},
97
103
}
98
104
@@ -137,6 +143,9 @@ type tiltProviderConfig struct {
137
143
ApplyProviderYaml * bool `json:"apply_provider_yaml,omitempty"`
138
144
KustomizeFolder * string `json:"kustomize_folder,omitempty"`
139
145
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
140
149
}
141
150
142
151
func init () {
@@ -354,7 +363,7 @@ func tiltResources(ctx context.Context, ts *tiltSettings) error {
354
363
debugConfig = & d
355
364
}
356
365
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 ))
358
367
}
359
368
}
360
369
@@ -693,7 +702,7 @@ func kustomizeTask(path, out string) taskFunction {
693
702
// workloadTask generates a task for creating the component yaml for a workload and saving the output on a file.
694
703
// NOTE: This task has several sub steps including running kustomize, envsubst, fixing components for debugging,
695
704
// 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 {
697
706
return func (ctx context.Context , prefix string , errCh chan error ) {
698
707
args := []string {"build" }
699
708
args = append (args , options ... )
@@ -725,7 +734,7 @@ func workloadTask(name, workloadType, binaryName, containerName string, liveRelo
725
734
return
726
735
}
727
736
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 {
729
738
errCh <- err
730
739
return
731
740
}
@@ -794,7 +803,7 @@ func writeIfChanged(prefix string, path string, yaml []byte) error {
794
803
// If there are extra_args given for the workload, we append those to the ones that already exist in the deployment.
795
804
// This has the affect that the appended ones will take precedence, as those are read last.
796
805
// 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 {
798
807
// Update provider namespaces to have the pod security standard enforce label set to privileged.
799
808
// This is required because we remove the SecurityContext from provider deployments below to make tilt work.
800
809
updateNamespacePodSecurityStandard (objs )
@@ -805,7 +814,7 @@ func prepareWorkload(prefix, binaryName, containerName string, objs []unstructur
805
814
}
806
815
807
816
cmd := []string {"/" + binaryName }
808
- if len (liveReloadDeps ) > 0 || debugConfig != nil {
817
+ if len (liveReloadDeps ) > 0 || debugConfig != nil || hardcodedProvider {
809
818
cmd = []string {"sh" , "/start.sh" , "/" + binaryName }
810
819
}
811
820
args := append (container .Args , []string (extraArgs )... )
0 commit comments