Skip to content

Commit

Permalink
feat: patch python sdk target
Browse files Browse the repository at this point in the history
  • Loading branch information
a9p committed Jun 11, 2023
1 parent 8da4db2 commit 2fa50ad
Show file tree
Hide file tree
Showing 18 changed files with 19,569 additions and 5 deletions.
4 changes: 4 additions & 0 deletions hack/gen-python-sdk/post_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def update_python_sdk(src, dest, versions=('v1beta1')):
'[**V1Container**](https://github.com/kubernetes-client/'
'python/blob/master/kubernetes/docs/V1Container.md)'),

lambda l: l.replace('[**V1DeploymentSpec**](V1DeploymentSpec.md)',
'[**V1DeploymentSpec**](https://github.com/kubernetes-client/'
'python/blob/master/kubernetes/docs/V1DeploymentSpec.md)'),

lambda l: l.replace('[**V1ObjectMeta**](V1ObjectMeta.md)',
'[**V1ObjectMeta**](https://github.com/kubernetes-client/'
'python/blob/master/kubernetes/docs/V1ObjectMeta.md)'),
Expand Down
1 change: 1 addition & 0 deletions hack/gen-python-sdk/swagger_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"packageVersion": "0.1",
"importMappings": {
"V1Container": "from kubernetes.client import V1Container",
"V1DeploymentSpec": "from kubernetes.client import V1DeploymentSpec",
"V1ListMeta": "from kubernetes.client import V1ListMeta",
"V1ObjectMeta": "from kubernetes.client import V1ObjectMeta",
"V1HTTPGetAction": "from kubernetes.client import V1HTTPGetAction",
Expand Down
1 change: 1 addition & 0 deletions hack/swagger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func swaggify(name string) string {
name = strings.Replace(name, "github.com/kubeflow/katib/pkg/apis/controller/suggestions", "", -1)
name = strings.Replace(name, "github.com/kubeflow/katib/pkg/apis/controller/trials", "", -1)
name = strings.Replace(name, "k8s.io/api/core/", "", -1)
name = strings.Replace(name, "k8s.io/api/apps/", "", -1)
name = strings.Replace(name, "k8s.io/apimachinery/pkg/apis/meta/", "", -1)
name = strings.Replace(name, "/", ".", -1)
return name
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions pkg/apis/manager/v1beta1/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ proto="api.proto"
GO_MOD_K8S_API=$(go list -m -f '{{.Dir}}' k8s.io/api)
GO_MOD_K8S_APIMACHINERY=$(go list -m -f '{{.Dir}}' k8s.io/apimachinery)

# Generate python k8s api files
docker run -i --rm \
-v "$PWD:$PWD" \
-v "$GO_MOD_K8S_APIMACHINERY:$GOPATH/pkg/mod/k8s.io/apimachinery" \
-v "$GO_MOD_K8S_API:$GOPATH/pkg/mod/k8s.io/api" \
-w "$PWD" \
znly/protoc \
-I "${GOPATH}/pkg/mod" --python_out=python \
"${GOPATH}/pkg/mod/k8s.io/api/apps/v1/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/api/core/v1/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/apimachinery/pkg/runtime/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/apimachinery/pkg/api/resource/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/apimachinery/pkg/runtime/schema/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/apimachinery/pkg/util/intstr/generated.proto" \
"${GOPATH}/pkg/mod/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"

# Generate $proto files
docker run -i --rm \
-v "$PWD:$PWD" \
-v "$GO_MOD_K8S_API:$GOPATH/pkg/mod/k8s.io/api" \
Expand Down
1,867 changes: 1,867 additions & 0 deletions pkg/apis/manager/v1beta1/python/k8s/io/api/apps/v1/generated_pb2.py

Large diffs are not rendered by default.

14,602 changes: 14,602 additions & 0 deletions pkg/apis/manager/v1beta1/python/k8s/io/api/core/v1/generated_pb2.py

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2fa50ad

Please sign in to comment.