From 7d5573b80a26692b228a9448fdc99e71c822f6a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=81oskot?= Date: Tue, 18 Nov 2025 12:00:26 +0100 Subject: [PATCH 1/2] docs: Correct kubeops CLI usage examples Ref https://github.com/dotnet/dotnet-operator-sdk/issues/988#issuecomment-3546725772 --- README.md | 2 +- docs/docs/operator/cli.mdx | 20 ++++++++++---------- docs/docs/operator/getting-started.mdx | 6 +++--- src/KubeOps.Cli/README.md | 10 +++++----- src/KubeOps.Transpiler/README.md | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 680d8d03..5474e0a8 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The documentation is also provided within the code itself (description of method - **Controller Logic:** Implement reconciliation logic using the `IEntityController` interface. - **Finalizers:** Easily add cleanup logic before resource deletion with `IEntityFinalizer`. - **Webhooks:** Create [Admission](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/) (validating/mutating) and [Conversion](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/#webhook-conversion) webhooks integrated with ASP.NET Core. -- **Code Generation:** Includes Roslyn source generators and a CLI tool (`dotnet kubeops`) to automate boilerplate code for CRDs, controllers, and RBAC rules. +- **Code Generation:** Includes Roslyn source generators and a CLI tool (`kubeops`) to automate boilerplate code for CRDs, controllers, and RBAC rules. - **Enhanced Kubernetes Client:** Provides convenience methods built on top of the official client library. - **Leader Election:** Automatic handling for high-availability operator deployments. diff --git a/docs/docs/operator/cli.mdx b/docs/docs/operator/cli.mdx index c2bea40b..c73a1d2d 100644 --- a/docs/docs/operator/cli.mdx +++ b/docs/docs/operator/cli.mdx @@ -32,7 +32,7 @@ During local development, you'll primarily use the `install` and `uninstall` com To install your operator's CRDs into your development cluster: ```bash -dotnet kubeops install ./MyOperator.csproj +kubeops install ./MyOperator.csproj ``` This command: @@ -50,7 +50,7 @@ The `install` and `uninstall` commands are primarily intended for development pu To remove your operator's CRDs from the development cluster: ```bash -dotnet kubeops uninstall ./MyOperator.csproj +kubeops uninstall ./MyOperator.csproj ``` This is useful when: @@ -64,7 +64,7 @@ This is useful when: The `generate` command creates all necessary Kubernetes resources for your operator: ```bash -dotnet kubeops generate operator MyOperator ./MyOperator.csproj +kubeops generate operator MyOperator ./MyOperator.csproj ``` This generates: @@ -85,7 +85,7 @@ The resource generation is automatically included in the build process. You don' The generate command supports several options: ```bash -dotnet kubeops generate operator MyOperator ./MyOperator.csproj --out ./k8s --format yaml +kubeops generate operator MyOperator ./MyOperator.csproj --out ./k8s --format yaml ``` Common options: @@ -101,7 +101,7 @@ Common options: The `version` command shows information about your current Kubernetes cluster: ```bash -dotnet kubeops api-version +kubeops api-version ``` This displays: @@ -133,24 +133,24 @@ All commands support these options: ```bash # Install CRDs for development - dotnet kubeops install ./MyOperator.csproj + kubeops install ./MyOperator.csproj # Generate resources for deployment - dotnet kubeops generate operator MyOperator ./MyOperator.csproj + kubeops generate operator MyOperator ./MyOperator.csproj ``` 2. **Testing Different Versions**: ```bash # Uninstall current version - dotnet kubeops uninstall ./MyOperator.csproj + kubeops uninstall ./MyOperator.csproj # Install new version - dotnet kubeops install ./MyOperator.csproj + kubeops install ./MyOperator.csproj ``` 3. **Custom Resource Generation**: ```bash # Generate resources with custom output - dotnet kubeops generate operator MyOperator ./MyOperator.csproj --out ./k8s --format yaml + kubeops generate operator MyOperator ./MyOperator.csproj --out ./k8s --format yaml ``` diff --git a/docs/docs/operator/getting-started.mdx b/docs/docs/operator/getting-started.mdx index 1221c77e..a8e37118 100644 --- a/docs/docs/operator/getting-started.mdx +++ b/docs/docs/operator/getting-started.mdx @@ -75,7 +75,7 @@ The CLI provides several useful commands: Generate all necessary Kubernetes resources for your operator: ```bash -dotnet kubeops generate operator MyOperator ./MyFirstOperator.csproj +kubeops generate operator MyOperator ./MyFirstOperator.csproj ``` :::note Automatic Generation @@ -107,7 +107,7 @@ Make sure to handle these certificates securely in production environments. Install your operator's CRDs into your Kubernetes cluster: ```bash -dotnet kubeops install ./MyFirstOperator.csproj +kubeops install ./MyFirstOperator.csproj ``` ### Uninstall CRDs @@ -115,7 +115,7 @@ dotnet kubeops install ./MyFirstOperator.csproj Remove your operator's CRDs from the cluster: ```bash -dotnet kubeops uninstall ./MyFirstOperator.csproj +kubeops uninstall ./MyFirstOperator.csproj ``` ## Building Blocks of an Operator diff --git a/src/KubeOps.Cli/README.md b/src/KubeOps.Cli/README.md index 960fe12c..c6c860ae 100644 --- a/src/KubeOps.Cli/README.md +++ b/src/KubeOps.Cli/README.md @@ -34,7 +34,7 @@ dotnet tool install --local KubeOps.Cli Generates Custom Resource Definitions (CRDs) and other Kubernetes-related resources for your operator. ```bash -dotnet kubeops generate +kubeops generate ``` The `generate operator` command creates all necessary resources for deploying your operator to Kubernetes: @@ -58,7 +58,7 @@ If your operator includes webhooks (mutations or validations), additional resour Installs the operator and its CRDs into a Kubernetes cluster. ```bash -dotnet kubeops install +kubeops install ``` ### Uninstall @@ -66,7 +66,7 @@ dotnet kubeops install Removes the operator and its CRDs from a Kubernetes cluster. ```bash -dotnet kubeops uninstall +kubeops uninstall ``` ### Version @@ -74,7 +74,7 @@ dotnet kubeops uninstall Displays the current version of the KubeOps CLI. ```bash -dotnet kubeops version +kubeops version ``` ## Usage @@ -84,5 +84,5 @@ The KubeOps CLI is designed to be used within .NET projects that implement Kuber For more detailed information about each command, use the `--help` flag: ```bash -dotnet kubeops [command] --help +kubeops [command] --help ``` diff --git a/src/KubeOps.Transpiler/README.md b/src/KubeOps.Transpiler/README.md index ca47d27d..ddfb0711 100644 --- a/src/KubeOps.Transpiler/README.md +++ b/src/KubeOps.Transpiler/README.md @@ -93,10 +93,10 @@ foreach (var crd in crds) ### Use Cases -- **KubeOps CLI:** This package is the engine behind the `dotnet kubeops generate crd` command. +- **KubeOps CLI:** This package is the engine behind the `kubeops generate crd` command. - **Custom Build Tasks:** Integrate CRD generation directly into your MSBuild process. - **Schema Validation Tools:** Use the generated CRD schema for validating custom resource YAML files. -The assembly inspection and attribute processing logic within this package is also leveraged by the KubeOps CLI (`dotnet kubeops generate operator`) command. The CLI uses this package's capabilities to find types decorated with `[EntityRbac]` attributes when generating the RBAC manifests (`Role`/`ClusterRole`) for your operator. +The assembly inspection and attribute processing logic within this package is also leveraged by the KubeOps CLI (`kubeops generate operator`) command. The CLI uses this package's capabilities to find types decorated with `[EntityRbac]` attributes when generating the RBAC manifests (`Role`/`ClusterRole`) for your operator. For more details on defining the C# classes themselves, see the main KubeOps documentation. From 6031bb01dbcd143b83c2500f66cfb90e0e19c659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=81oskot?= Date: Tue, 18 Nov 2025 12:01:19 +0100 Subject: [PATCH 2/2] fix: Remove dotnet from KubeOpsCli command in KubeOps.Operator.targets --- src/KubeOps.Operator/Build/KubeOps.Operator.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KubeOps.Operator/Build/KubeOps.Operator.targets b/src/KubeOps.Operator/Build/KubeOps.Operator.targets index 460004fd..cc63c995 100644 --- a/src/KubeOps.Operator/Build/KubeOps.Operator.targets +++ b/src/KubeOps.Operator/Build/KubeOps.Operator.targets @@ -2,7 +2,7 @@ $(AssemblyName.ToLowerInvariant()) - dotnet kubeops + kubeops $(MSBuildProjectDirectory)\config true