You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/operator/build-customization.mdx
+60-3Lines changed: 60 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,15 +41,42 @@ You can customize the build process by setting the following MSBuild properties
41
41
</PropertyGroup>
42
42
```
43
43
44
-
### Disabling Automatic Generation
44
+
### Disabling or Forcing Automatic Generation
45
45
46
-
To disable automatic resource generation during build:
46
+
The `GenerateOperatorResources` property controls when Kubernetes resources are generated during the build:
47
+
48
+
-**`<GenerateOperatorResources>false</GenerateOperatorResources>`**: Disables automatic resource generation for all build configurations.
49
+
-**`<GenerateOperatorResources>true</GenerateOperatorResources>`**: Forces resource generation for all build configurations (including Debug and Release).
50
+
-**Unset or empty**: Resources are generated **only** for `Release` builds (default behavior).
51
+
52
+
You can use this property in your project file as follows:
## Using with the CRD Installer for Local Development
200
+
201
+
For local development, you may want to not automatically generate resources in Debug mode and have them installed in your cluster. You can combine `GenerateOperatorResources` with the [CRD Installer utility](./utilities) for this purpose.
202
+
203
+
For example, in your `Program.cs`:
204
+
205
+
```csharp
206
+
builder.Services
207
+
.AddKubernetesOperator()
208
+
#ifDEBUG
209
+
.AddCrdInstaller(c=>
210
+
{
211
+
c.OverwriteExisting=true;
212
+
c.DeleteOnShutdown=true;
213
+
})
214
+
#endif
215
+
.RegisterComponents();
216
+
```
217
+
218
+
And in your project file:
219
+
220
+
```xml
221
+
<PropertyGroup>
222
+
<!-- Use the default behavior which does not generate resources in Debug mode -->
This setup ensures that resources are always generated and installed automatically during development, but you can disable or restrict this behavior for production builds as needed.
Text="KubeOps CLI is not installed as tool, cannot generate stuff for projects. Please install it with 'dotnet tool install KubeOps.Cli' to use automatic build generation." />
0 commit comments