Skip to content

Commit 6c32c16

Browse files
reverting changes in the main.go
1 parent 271adb0 commit 6c32c16

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

cmd/nginx-ingress/main.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ func updateSelfWithVersionInfo(ctx context.Context, eventLog record.EventRecorde
10551055

10561056
// Copy pod and update the labels.
10571057
newPod := pod.DeepCopy()
1058-
labels := newPod.Labels
1058+
labels := newPod.ObjectMeta.Labels
10591059
if labels == nil {
10601060
labels = make(map[string]string)
10611061
}
@@ -1068,8 +1068,7 @@ func updateSelfWithVersionInfo(ctx context.Context, eventLog record.EventRecorde
10681068
if agentVersion != "" {
10691069
labels[agentVersionLabel] = agentVersion
10701070
}
1071-
newPod.Labels = labels
1072-
1071+
newPod.ObjectMeta.Labels = labels
10731072
_, err = kubeClient.CoreV1().Pods(newPod.ObjectMeta.Namespace).Update(context.TODO(), newPod, meta_v1.UpdateOptions{})
10741073
if err != nil {
10751074
nl.Errorf(l, "Error updating pod with labels on attempt %d of %d: %v", i+1, maxRetries, err)
@@ -1081,7 +1080,7 @@ func updateSelfWithVersionInfo(ctx context.Context, eventLog record.EventRecorde
10811080
fmt.Fprintf(labelsString, "%s=\"%s\", ", key, value)
10821081
}
10831082
eventLog.Eventf(newPod, api_v1.EventTypeNormal, nl.EventReasonUpdatePodLabel, "Successfully added version labels, %s", strings.TrimRight(labelsString.String(), ", "))
1084-
nl.Infof(l, "Pod label updated: %s", pod.Name)
1083+
nl.Infof(l, "Pod label updated: %s", pod.ObjectMeta.Name)
10851084
podUpdated = true
10861085
}
10871086

@@ -1092,7 +1091,7 @@ func updateSelfWithVersionInfo(ctx context.Context, eventLog record.EventRecorde
10921091

10931092
func createAndValidateHeadlessService(ctx context.Context, kubeClient kubernetes.Interface, cfgParams *configs.ConfigParams, controllerNamespace string, pod *api_v1.Pod) error {
10941093
l := nl.LoggerFromContext(ctx)
1095-
owner := pod.OwnerReferences[0]
1094+
owner := pod.ObjectMeta.OwnerReferences[0]
10961095
name := owner.Name
10971096
if strings.ToLower(owner.Kind) == "replicaset" {
10981097
if dash := strings.LastIndex(name, "-"); dash != -1 {
@@ -1201,12 +1200,12 @@ func initLogger(logFormat string, level slog.Level, out io.Writer) context.Conte
12011200
},
12021201
}
12031202

1204-
switch logFormat {
1205-
case "glog":
1203+
switch {
1204+
case logFormat == "glog":
12061205
h = nic_glog.New(out, &nic_glog.Options{Level: programLevel})
1207-
case "json":
1206+
case logFormat == "json":
12081207
h = slog.NewJSONHandler(out, opts)
1209-
case "text":
1208+
case logFormat == "text":
12101209
h = slog.NewTextHandler(out, opts)
12111210
default:
12121211
h = nic_glog.New(out, &nic_glog.Options{Level: programLevel})

pkg/apis/configuration/v1/types.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ type ProviderSpecificProperty struct {
108108

109109
// PolicyReference references a policy by name and an optional namespace.
110110
type PolicyReference struct {
111-
// The name of a policy. If the policy doesn’t exist or invalid, NGINX will respond with an error response with the 500 status code.
111+
// The name of a policy. If the policy doesn’t exist or invalid, NGINX will respond with an error response with the 500 status code.
112112
Name string `json:"name"`
113113
// The namespace of a policy. If not specified, the namespace of the VirtualServer resource is used.
114114
Namespace string `json:"namespace"`
@@ -118,7 +118,7 @@ type PolicyReference struct {
118118
type Upstream struct {
119119
// The name of the upstream. Must be a valid DNS label as defined in RFC 1035. For example, hello and upstream-123 are valid. The name must be unique among all upstreams of the resource.
120120
Name string `json:"name"`
121-
// The name of a service. The service must belong to the same namespace as the resource. If the service doesn’t exist, NGINX will assume the service has zero endpoints and return a 502 response for requests for this upstream. For NGINX Plus only, services of type ExternalName are also supported (check the prerequisites ).
121+
// The name of a service. The service must belong to the same namespace as the resource. If the service doesn’t exist, NGINX will assume the service has zero endpoints and return a 502 response for requests for this upstream. For NGINX Plus only, services of type ExternalName are also supported (check the prerequisites).
122122
Service string `json:"service"`
123123
// Selects the pods within the service using label keys and values. By default, all pods of the service are selected. Note: the specified labels are expected to be present in the pods when they are created. If the pod labels are updated, NGINX Ingress Controller will not see that change until the number of the pods is changed.
124124
Subselector map[string]string `json:"subselector"`
@@ -246,7 +246,7 @@ type SessionCookie struct {
246246
Name string `json:"name"`
247247
// The path for which the cookie is set.
248248
Path string `json:"path"`
249-
// The time for which a browser should keep the cookie. Can be set to the special value max , which will cause the cookie to expire on 31 Dec 2037 23:55:55 GMT.
249+
// The time for which a browser should keep the cookie. Can be set to the special value max, which will cause the cookie to expire on 31 Dec 2037 23:55:55 GMT.
250250
Expires string `json:"expires"`
251251
// The domain for which the cookie is set.
252252
Domain string `json:"domain"`
@@ -564,7 +564,7 @@ type Listener struct {
564564
Port int `json:"port"`
565565
// Specifies the IPv4 address to listen on.
566566
IPv4 string `json:"ipv4"`
567-
// ipv6 addresses that NGINX will listen on.
567+
// ipv6 addresse that NGINX will listen on.
568568
IPv6 string `json:"ipv6"`
569569
// Whether the listener will be listening for SSL connections
570570
Ssl bool `json:"ssl"`
@@ -655,7 +655,7 @@ type TransportServerUpstream struct {
655655
HealthCheck *TransportServerHealthCheck `json:"healthCheck"`
656656
// The method used to load balance the upstream servers. By default, connections are distributed between the servers using a weighted round-robin balancing method.
657657
LoadBalancingMethod string `json:"loadBalancingMethod"`
658-
// The name of the backup service of type ExternalName. This will be used when the primary servers are unavailable. Note: The parameter cannot be used along with the random , hash or ip_hash load balancing methods.
658+
// The name of the backup service of type ExternalName. This will be used when the primary servers are unavailable. Note: The parameter cannot be used along with the random, hash or ip_hash load balancing methods.
659659
Backup string `json:"backup"`
660660
// The port of the backup service. The backup port is required if the backup service name is provided. The port must fall into the range 1..65535.
661661
BackupPort *uint16 `json:"backupPort"`
@@ -733,8 +733,7 @@ type TransportServerStatus struct {
733733
type TransportServerList struct {
734734
metav1.TypeMeta `json:",inline"`
735735
metav1.ListMeta `json:"metadata"`
736-
// Items field of the TransportServerList resource
737-
Items []TransportServer `json:"items"`
736+
Items []TransportServer `json:"items"`
738737
}
739738

740739
// +genclient
@@ -814,7 +813,7 @@ type RateLimit struct {
814813
Rate string `json:"rate"`
815814
// The key to which the rate limit is applied. Can contain text, variables, or a combination of them.
816815
// Variables must be surrounded by ${}. For example: ${binary_remote_addr}. Accepted variables are
817-
// $binary_remote_addr , $request_uri , $request_method , $url , $http_ , $args , $arg_, $cookie_ ,$jwt_claim_ .
816+
// $binary_remote_addr, $request_uri, $request_method, $url, $http_, $args, $arg_, $cookie_,$jwt_claim_ .
818817
Key string `json:"key"`
819818
// The delay parameter specifies a limit at which excessive requests become delayed. If not set all excessive requests are delayed.
820819
Delay *int `json:"delay"`

0 commit comments

Comments
 (0)