Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: add scale subresource for vpc-egress-gateway #4829

Merged
merged 1 commit into from
Dec 13, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ kubectl-ko-log.tar.gz
kube-apiserver-audit.log
kube-apiserver-audit.json
kube-ovn.yaml
!/charts/kube-ovn/templates/kube-ovn-crd.yaml
kube-ovn-crd.yaml
ovn.yaml
ovn-ic-controller.yaml
Expand Down
16 changes: 16 additions & 0 deletions charts/kube-ovn/templates/kube-ovn-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -876,12 +876,24 @@ spec:
storage: true
subresources:
status: {}
scale:
# specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.
specReplicasPath: .spec.replicas
# statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.
statusReplicasPath: .status.replicas
# labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.
labelSelectorPath: .status.labelSelector
schema:
openAPIV3Schema:
type: object
properties:
status:
properties:
replicas:
type: integer
format: int32
labelSelector:
type: string
conditions:
items:
properties:
Expand Down Expand Up @@ -978,6 +990,7 @@ spec:
properties:
replicas:
type: integer
format: int32
default: 1
minimum: 1
maximum: 10
Expand Down Expand Up @@ -1025,12 +1038,15 @@ spec:
default: false
minRX:
type: integer
format: int32
default: 1000
minTX:
type: integer
format: int32
default: 1000
multiplier:
type: integer
format: int32
default: 3
policies:
type: array
Expand Down
16 changes: 16 additions & 0 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1124,12 +1124,24 @@ spec:
storage: true
subresources:
status: {}
scale:
# specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.
specReplicasPath: .spec.replicas
# statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.
statusReplicasPath: .status.replicas
# labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.
labelSelectorPath: .status.labelSelector
schema:
openAPIV3Schema:
type: object
properties:
status:
properties:
replicas:
type: integer
format: int32
labelSelector:
type: string
conditions:
items:
properties:
Expand Down Expand Up @@ -1223,6 +1235,7 @@ spec:
properties:
replicas:
type: integer
format: int32
default: 1
minimum: 1
maximum: 10
Expand Down Expand Up @@ -1270,12 +1283,15 @@ spec:
default: false
minRX:
type: integer
format: int32
default: 1000
minTX:
type: integer
format: int32
default: 1000
multiplier:
type: integer
format: int32
default: 3
policies:
type: array
Expand Down
2 changes: 1 addition & 1 deletion hack/update-codegen-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GOPROXY=${GOPROXY:-"https://goproxy.cn"}
docker run -it --rm \
-v ${PWD}:/app \
-e GOPROXY=${GOPROXY} \
ghcr.io/zhangzujian/kube-code-generator:v0.3.3 \
ghcr.io/zhangzujian/kube-code-generator:v0.3.4 \
--boilerplate-path ./hack/boilerplate.go.txt \
--apis-in ./pkg/apis \
--go-gen-out ./pkg/client
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/kubeovn/v1/vpc-egress-gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ type VpcEgressGatewayList struct {
}

// +genclient
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +resourceName=vpc-egress-gateways
// vpc egress gateway is used to forward the egress traffic from the VPC to the external network
Expand Down Expand Up @@ -101,6 +103,10 @@ type VpcEgressGatewayNodeSelector struct {
}

type VpcEgressGatewayStatus struct {
// used by the scale subresource
Replicas int32 `json:"replicas,omitempty"`
LabelSelector string `json:"labelSelector,omitempty"`

// whether the egress gateway is ready
Ready bool `json:"ready"`
Phase Phase `json:"phase"`
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/clientset/versioned/clientset.go

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

116 changes: 19 additions & 97 deletions pkg/client/clientset/versioned/typed/kubeovn/v1/fake/fake_ip.go

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

Loading
Loading