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

Add status to VirtualServer and VirtualServerRoute #973

Merged
merged 1 commit into from
Jun 4, 2020
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
6 changes: 3 additions & 3 deletions cmd/nginx-ingress/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ var (
(default for NGINX "nginx.transportserver.tmpl"; default for NGINX Plus "nginx-plus.transportserver.tmpl")`)

externalService = flag.String("external-service", "",
`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. Requires -report-ingress-status.`)
`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. For Ingress resources only: Requires -report-ingress-status.`)

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

leaderElectionEnabled = flag.Bool("enable-leader-election", false,
"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.")
"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.")

leaderElectionLockName = flag.String("leader-election-lock-name", "nginx-ingress-leader-election",
`Specifies the name of the ConfigMap, within the same namespace as the controller, used as the lock for leader election. Requires -enable-leader-election.`)
Expand Down
42 changes: 42 additions & 0 deletions deployments/common/vs-definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,33 @@ spec:
served: true
storage: true
scope: Namespaced
subresources:
status: {}
names:
kind: VirtualServer
plural: virtualservers
singular: virtualserver
shortNames:
- vs
preserveUnknownFields: false
additionalPrinterColumns:
- name: State
type: string
description: Current state of the VirtualServer. If the resource has a valid status,
it means it has been validated and accepted by the Ingress Controller.
JSONPath: .status.state
- name: Host
type: string
JSONPath: .spec.host
- name: IP
type: string
JSONPath: .status.externalEndpoints[*].ip
- name: Ports
type: string
JSONPath: .status.externalEndpoints[*].ports
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
validation:
openAPIV3Schema:
description: VirtualServer defines the VirtualServer resource.
Expand Down Expand Up @@ -375,3 +395,25 @@ spec:
properties:
enable:
type: boolean
status:
description: VirtualServerStatus defines the status for the VirtualServer
resource.
type: object
properties:
externalEndpoints:
type: array
items:
description: ExternalEndpoint defines the IP and ports used to connect
to this resource.
type: object
properties:
ip:
type: string
ports:
type: string
message:
type: string
reason:
type: string
state:
type: string
44 changes: 44 additions & 0 deletions deployments/common/vsr-definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,33 @@ spec:
served: true
storage: true
scope: Namespaced
subresources:
status: {}
names:
kind: VirtualServerRoute
plural: virtualserverroutes
singular: virtualserverroute
shortNames:
- vsr
preserveUnknownFields: false
additionalPrinterColumns:
- name: State
type: string
description: Current state of the VirtualServerRoute. If the resource has a valid
status, it means it has been validated and accepted by the Ingress Controller.
JSONPath: .status.state
- name: Host
type: string
JSONPath: .spec.host
- name: IP
type: string
JSONPath: .status.externalEndpoints[*].ip
- name: Ports
type: string
JSONPath: .status.externalEndpoints[*].ports
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
validation:
openAPIV3Schema:
type: object
Expand Down Expand Up @@ -357,3 +377,27 @@ spec:
properties:
enable:
type: boolean
status:
description: VirtualServerRouteStatus defines the status for the VirtualServerRoute
resource.
type: object
properties:
externalEndpoints:
type: array
items:
description: ExternalEndpoint defines the IP and ports used to connect
to this resource.
type: object
properties:
ip:
type: string
ports:
type: string
message:
type: string
reason:
type: string
referencedBy:
type: string
state:
type: string
42 changes: 42 additions & 0 deletions deployments/helm-chart/templates/controller-vs-definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,33 @@ spec:
served: true
storage: true
scope: Namespaced
subresources:
status: {}
names:
kind: VirtualServer
plural: virtualservers
singular: virtualserver
shortNames:
- vs
preserveUnknownFields: false
additionalPrinterColumns:
- name: State
type: string
description: Current state of the VirtualServer. If the resource has a valid status,
it means it has been validated and accepted by the Ingress Controller.
JSONPath: .status.state
- name: Host
type: string
JSONPath: .spec.host
- name: IP
type: string
JSONPath: .status.externalEndpoints[*].ip
- name: Ports
type: string
JSONPath: .status.externalEndpoints[*].ports
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
validation:
openAPIV3Schema:
description: VirtualServer defines the VirtualServer resource.
Expand Down Expand Up @@ -378,4 +398,26 @@ spec:
properties:
enable:
type: boolean
status:
description: VirtualServerStatus defines the status for the VirtualServer
resource.
type: object
properties:
externalEndpoints:
type: array
items:
description: ExternalEndpoint defines the IP and ports used to connect
to this resource.
type: object
properties:
ip:
type: string
ports:
type: string
message:
type: string
reason:
type: string
state:
type: string
{{- end }}
44 changes: 44 additions & 0 deletions deployments/helm-chart/templates/controller-vsr-definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,33 @@ spec:
served: true
storage: true
scope: Namespaced
subresources:
status: {}
names:
kind: VirtualServerRoute
plural: virtualserverroutes
singular: virtualserverroute
shortNames:
- vsr
preserveUnknownFields: false
additionalPrinterColumns:
- name: State
type: string
description: Current state of the VirtualServerRoute. If the resource has a valid
status, it means it has been validated and accepted by the Ingress Controller.
JSONPath: .status.state
- name: Host
type: string
JSONPath: .spec.host
- name: IP
type: string
JSONPath: .status.externalEndpoints[*].ip
- name: Ports
type: string
JSONPath: .status.externalEndpoints[*].ports
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
validation:
openAPIV3Schema:
type: object
Expand Down Expand Up @@ -360,4 +380,28 @@ spec:
properties:
enable:
type: boolean
status:
description: VirtualServerRouteStatus defines the status for the VirtualServerRoute
resource.
type: object
properties:
externalEndpoints:
type: array
items:
description: ExternalEndpoint defines the IP and ports used to connect
to this resource.
type: object
properties:
ip:
type: string
ports:
type: string
message:
type: string
reason:
type: string
referencedBy:
type: string
state:
type: string
{{- end }}
7 changes: 7 additions & 0 deletions deployments/helm-chart/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ rules:
- list
- watch
- get
- apiGroups:
- k8s.nginx.org
resources:
- virtualservers/status
- virtualserverroutes/status
verbs:
- update
{{- end }}
---
kind: ClusterRoleBinding
Expand Down
7 changes: 7 additions & 0 deletions deployments/rbac/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ rules:
- list
- watch
- get
- apiGroups:
- k8s.nginx.org
resources:
- virtualservers/status
- virtualserverroutes/status
verbs:
- update
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Below we describe the available command-line arguments:

.. option:: -enable-leader-election

Enables Leader election to avoid multiple replicas of the controller reporting the status of Ingress resources -- only one replica will report status.
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.

See :option:`-report-ingress-status` flag.

Expand All @@ -43,9 +43,9 @@ Below we describe the available command-line arguments:

.. option:: -external-service <string>

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.
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.

Requires :option:`-report-ingress-status`.
For Ingress resources only: Requires :option:`-report-ingress-status`.

.. option:: -global-configuration <string>

Expand Down
Loading