Skip to content

Commit 1f7774c

Browse files
author
Raul Marrero
committed
Add status to VirtualServer and VirtualServerRoute
1 parent 50e908a commit 1f7774c

21 files changed

+1084
-28
lines changed

cmd/nginx-ingress/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ var (
9595
(default for NGINX "nginx.transportserver.tmpl"; default for NGINX Plus "nginx-plus.transportserver.tmpl")`)
9696

9797
externalService = flag.String("external-service", "",
98-
`Specifies the name of the service with the type LoadBalancer through which the Ingress controller pods are exposed externally.
99-
The external address of the service is used when reporting the status of Ingress resources. Requires -report-ingress-status.`)
98+
`Specifies the name of the service with the type LoadBalancer through which the Ingress controller pods are exposed externally.
99+
The external address of the service is used when reporting the status of Ingress, VirtualServer and VirtualServerRoute resources. For Ingress resources only: Requires -report-ingress-status.`)
100100

101101
reportIngressStatus = flag.Bool("report-ingress-status", false,
102102
"Update the address field in the status of Ingresses resources. Requires the -external-service flag, or the 'external-status-address' key in the ConfigMap.")
103103

104104
leaderElectionEnabled = flag.Bool("enable-leader-election", false,
105-
"Enable Leader election to avoid multiple replicas of the controller reporting the status of Ingress resources -- only one replica will report status. See -report-ingress-status flag.")
105+
"Enable Leader election to avoid multiple replicas of the controller reporting the status of Ingress, VirtualServer and VirtualServerRoute resources -- only one replica will report status. See -report-ingress-status flag.")
106106

107107
leaderElectionLockName = flag.String("leader-election-lock-name", "nginx-ingress-leader-election",
108108
`Specifies the name of the ConfigMap, within the same namespace as the controller, used as the lock for leader election. Requires -enable-leader-election.`)

deployments/common/vs-definition.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,33 @@ spec:
99
served: true
1010
storage: true
1111
scope: Namespaced
12+
subresources:
13+
status: {}
1214
names:
1315
kind: VirtualServer
1416
plural: virtualservers
1517
singular: virtualserver
1618
shortNames:
1719
- vs
1820
preserveUnknownFields: false
21+
additionalPrinterColumns:
22+
- name: State
23+
type: string
24+
description: Current state of the VirtualServer. If the resource has a valid status,
25+
it means it has been validated and accepted by the Ingress Controller.
26+
JSONPath: .status.state
27+
- name: Host
28+
type: string
29+
JSONPath: .spec.host
30+
- name: IP
31+
type: string
32+
JSONPath: .status.externalEndpoints[*].ip
33+
- name: Ports
34+
type: string
35+
JSONPath: .status.externalEndpoints[*].ports
36+
- name: Age
37+
type: date
38+
JSONPath: .metadata.creationTimestamp
1939
validation:
2040
openAPIV3Schema:
2141
description: VirtualServer defines the VirtualServer resource.
@@ -375,3 +395,25 @@ spec:
375395
properties:
376396
enable:
377397
type: boolean
398+
status:
399+
description: VirtualServerStatus defines the status for the VirtualServer
400+
resource.
401+
type: object
402+
properties:
403+
externalEndpoints:
404+
type: array
405+
items:
406+
description: ExternalEndpoint defines the IP and ports used to connect
407+
to this resource.
408+
type: object
409+
properties:
410+
ip:
411+
type: string
412+
ports:
413+
type: string
414+
message:
415+
type: string
416+
reason:
417+
type: string
418+
state:
419+
type: string

deployments/common/vsr-definition.yaml

+44
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,33 @@ spec:
99
served: true
1010
storage: true
1111
scope: Namespaced
12+
subresources:
13+
status: {}
1214
names:
1315
kind: VirtualServerRoute
1416
plural: virtualserverroutes
1517
singular: virtualserverroute
1618
shortNames:
1719
- vsr
1820
preserveUnknownFields: false
21+
additionalPrinterColumns:
22+
- name: State
23+
type: string
24+
description: Current state of the VirtualServerRoute. If the resource has a valid
25+
status, it means it has been validated and accepted by the Ingress Controller.
26+
JSONPath: .status.state
27+
- name: Host
28+
type: string
29+
JSONPath: .spec.host
30+
- name: IP
31+
type: string
32+
JSONPath: .status.externalEndpoints[*].ip
33+
- name: Ports
34+
type: string
35+
JSONPath: .status.externalEndpoints[*].ports
36+
- name: Age
37+
type: date
38+
JSONPath: .metadata.creationTimestamp
1939
validation:
2040
openAPIV3Schema:
2141
type: object
@@ -357,3 +377,27 @@ spec:
357377
properties:
358378
enable:
359379
type: boolean
380+
status:
381+
description: VirtualServerRouteStatus defines the status for the VirtualServerRoute
382+
resource.
383+
type: object
384+
properties:
385+
externalEndpoints:
386+
type: array
387+
items:
388+
description: ExternalEndpoint defines the IP and ports used to connect
389+
to this resource.
390+
type: object
391+
properties:
392+
ip:
393+
type: string
394+
ports:
395+
type: string
396+
message:
397+
type: string
398+
reason:
399+
type: string
400+
referencedBy:
401+
type: string
402+
state:
403+
type: string

deployments/helm-chart/templates/controller-vs-definition.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,33 @@ spec:
1212
served: true
1313
storage: true
1414
scope: Namespaced
15+
subresources:
16+
status: {}
1517
names:
1618
kind: VirtualServer
1719
plural: virtualservers
1820
singular: virtualserver
1921
shortNames:
2022
- vs
2123
preserveUnknownFields: false
24+
additionalPrinterColumns:
25+
- name: State
26+
type: string
27+
description: Current state of the VirtualServer. If the resource has a valid status,
28+
it means it has been validated and accepted by the Ingress Controller.
29+
JSONPath: .status.state
30+
- name: Host
31+
type: string
32+
JSONPath: .spec.host
33+
- name: IP
34+
type: string
35+
JSONPath: .status.externalEndpoints[*].ip
36+
- name: Ports
37+
type: string
38+
JSONPath: .status.externalEndpoints[*].ports
39+
- name: Age
40+
type: date
41+
JSONPath: .metadata.creationTimestamp
2242
validation:
2343
openAPIV3Schema:
2444
description: VirtualServer defines the VirtualServer resource.
@@ -378,4 +398,26 @@ spec:
378398
properties:
379399
enable:
380400
type: boolean
401+
status:
402+
description: VirtualServerStatus defines the status for the VirtualServer
403+
resource.
404+
type: object
405+
properties:
406+
externalEndpoints:
407+
type: array
408+
items:
409+
description: ExternalEndpoint defines the IP and ports used to connect
410+
to this resource.
411+
type: object
412+
properties:
413+
ip:
414+
type: string
415+
ports:
416+
type: string
417+
message:
418+
type: string
419+
reason:
420+
type: string
421+
state:
422+
type: string
381423
{{- end }}

deployments/helm-chart/templates/controller-vsr-definition.yaml

+44
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,33 @@ spec:
1212
served: true
1313
storage: true
1414
scope: Namespaced
15+
subresources:
16+
status: {}
1517
names:
1618
kind: VirtualServerRoute
1719
plural: virtualserverroutes
1820
singular: virtualserverroute
1921
shortNames:
2022
- vsr
2123
preserveUnknownFields: false
24+
additionalPrinterColumns:
25+
- name: State
26+
type: string
27+
description: Current state of the VirtualServerRoute. If the resource has a valid
28+
status, it means it has been validated and accepted by the Ingress Controller.
29+
JSONPath: .status.state
30+
- name: Host
31+
type: string
32+
JSONPath: .spec.host
33+
- name: IP
34+
type: string
35+
JSONPath: .status.externalEndpoints[*].ip
36+
- name: Ports
37+
type: string
38+
JSONPath: .status.externalEndpoints[*].ports
39+
- name: Age
40+
type: date
41+
JSONPath: .metadata.creationTimestamp
2242
validation:
2343
openAPIV3Schema:
2444
type: object
@@ -360,4 +380,28 @@ spec:
360380
properties:
361381
enable:
362382
type: boolean
383+
status:
384+
description: VirtualServerRouteStatus defines the status for the VirtualServerRoute
385+
resource.
386+
type: object
387+
properties:
388+
externalEndpoints:
389+
type: array
390+
items:
391+
description: ExternalEndpoint defines the IP and ports used to connect
392+
to this resource.
393+
type: object
394+
properties:
395+
ip:
396+
type: string
397+
ports:
398+
type: string
399+
message:
400+
type: string
401+
reason:
402+
type: string
403+
referencedBy:
404+
type: string
405+
state:
406+
type: string
363407
{{- end }}

deployments/helm-chart/templates/rbac.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ rules:
7676
- list
7777
- watch
7878
- get
79+
- apiGroups:
80+
- k8s.nginx.org
81+
resources:
82+
- virtualservers/status
83+
- virtualserverroutes/status
84+
verbs:
85+
- update
7986
{{- end }}
8087
---
8188
kind: ClusterRoleBinding

deployments/rbac/rbac.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ rules:
6969
- list
7070
- watch
7171
- get
72+
- apiGroups:
73+
- k8s.nginx.org
74+
resources:
75+
- virtualservers/status
76+
- virtualserverroutes/status
77+
verbs:
78+
- update
7279
---
7380
kind: ClusterRoleBinding
7481
apiVersion: rbac.authorization.k8s.io/v1beta1

docs-web/configuration/global-configuration/command-line-arguments.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Below we describe the available command-line arguments:
3131
3232
.. option:: -enable-leader-election
3333
34-
Enables Leader election to avoid multiple replicas of the controller reporting the status of Ingress resources -- only one replica will report status.
34+
Enables Leader election to avoid multiple replicas of the controller reporting the status of Ingress, VirtualServer and VirtualServerRoute resources -- only one replica will report status.
3535
3636
See :option:`-report-ingress-status` flag.
3737
@@ -43,9 +43,9 @@ Below we describe the available command-line arguments:
4343
4444
.. option:: -external-service <string>
4545
46-
Specifies the name of the service with the type LoadBalancer through which the Ingress controller pods are exposed externally. The external address of the service is used when reporting the status of Ingress resources.
46+
Specifies the name of the service with the type LoadBalancer through which the Ingress controller pods are exposed externally. The external address of the service is used when reporting the status of Ingress, VirtualServer and VirtualServerRoute resources.
4747
48-
Requires :option:`-report-ingress-status`.
48+
For Ingress resources only: Requires :option:`-report-ingress-status`.
4949
5050
.. option:: -global-configuration <string>
5151

0 commit comments

Comments
 (0)