Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,22 @@ jobs:

USE_SINGLE_PARAMETER=true bash java.sh ../../kubernetes/ settings
popd
rm -rf gen
git config user.email "k8s-publishing-bot@users.noreply.github.com"
git config user.name "Kubernetes Publisher"
git checkout -b "$BRANCH"
git add .
git commit -s -m 'Automated openapi generation from ${{ github.event.inputs.kubernetesBranch }}'
- name: Generate Proto
run: |
pushd gen/proto
# Download proto dependencies for the specified Kubernetes branch
bash dependencies.sh "${{ github.event.inputs.kubernetesBranch }}"
# Generate Java proto classes
bash generate.sh java ../../proto/src/main/java/
popd
rm -rf gen
git add proto/
git commit -s -m 'Automated proto generation from ${{ github.event.inputs.kubernetesBranch }}'
- name: Apply Manual Diffs
if: ${{ github.event.inputs.skip_patches != 'true' }}
run: |
Expand Down
38 changes: 37 additions & 1 deletion proto/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,43 @@
# Generating proto files

## Automated Generation

Protocol buffer files are automatically generated as part of the regular code generation workflow when a new Kubernetes release is published. This happens through the GitHub Actions workflow defined in `.github/workflows/generate.yml`.

To trigger proto generation manually along with OpenAPI generation:

1. Go to the [Generate workflow](https://github.com/kubernetes-client/java/actions/workflows/generate.yml) in GitHub Actions
2. Click "Run workflow"
3. Specify the Kubernetes branch (e.g., "release-1.30" or "master")
4. The workflow will automatically:
- Generate OpenAPI client code
- Generate protocol buffer classes
- Apply any necessary patches
- Generate fluent API
- Create a pull request with all changes

## Manual Generation

For local development or testing, you can generate proto files manually using the provided script:

```sh
cd /path/to/kubernetes-client-java
KUBERNETES_BRANCH=master bash scripts/update-proto.sh
```

You can specify a different Kubernetes branch/tag:

```sh
KUBERNETES_BRANCH=release-1.30 bash scripts/update-proto.sh
```

## Using the kubernetes-client/gen Repository Directly

Alternatively, you can use the kubernetes-client/gen repository directly:

```sh
git clone https://github.com/kubernetes-client/gen
cd gen/proto
./generate.sh java ${PATH_TO_JAVA_CLIENT_ROOT}/java/proto/src/main/java/
bash dependencies.sh master # or specify a different branch
bash generate.sh java ${PATH_TO_JAVA_CLIENT_ROOT}/proto/src/main/java/
`````````````````````````````````
Loading
Loading