Skip to content

Commit

Permalink
feat: Add flag quite to proxy. Fixes #402
Browse files Browse the repository at this point in the history
  • Loading branch information
hessjcg committed Oct 17, 2023
1 parent 4f9bd1f commit f00635d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,9 @@ spec:
format: int64
minimum: 0
type: integer
quiet:
description: Quiet configures the proxy's --quiet flag to limit the amount of logging generated by the proxy container.
type: boolean
resources:
description: Resources specifies the resources required for the proxy pod.
properties:
Expand Down
1 change: 1 addition & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ _Appears in:_
The operator ensures that all workloads configured with the default proxy image are upgraded automatically to use to the latest released proxy image.
When the customer upgrades the operator, the operator upgrades all workloads using the default proxy image to the latest proxy image. The change to the proxy container image is applied in accordance with the RolloutStrategy. |
| `rolloutStrategy` _string_ | RolloutStrategy indicates the strategy to use when rolling out changes to the workloads affected by the results. When this is set to `Workload`, changes to this resource will be automatically applied to a running Deployment, StatefulSet, DaemonSet, or ReplicaSet in accordance with the Strategy set on that workload. When this is set to `None`, the operator will take no action to roll out changes to affected workloads. `Workload` will be used by default if no value is set. See: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy |
| `quiet` _boolean_ | Quiet configures the proxy's --quiet flag to limit the amount of logging generated by the proxy container. |


#### AuthProxyWorkload
Expand Down
3 changes: 3 additions & 0 deletions installer/cloud-sql-proxy-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,9 @@ spec:
format: int64
minimum: 0
type: integer
quiet:
description: Quiet configures the proxy's --quiet flag to limit the amount of logging generated by the proxy container.
type: boolean
resources:
description: Resources specifies the resources required for the proxy pod.
properties:
Expand Down
4 changes: 4 additions & 0 deletions internal/api/v1/authproxyworkload_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ type AuthProxyContainerSpec struct {
//+kubebuilder:validation:Enum=Workload;None
//+kubebuilder:default=Workload
RolloutStrategy string `json:"rolloutStrategy,omitempty"`

// Quiet configures the proxy's --quiet flag to limit the amount of
// logging generated by the proxy container.
Quiet bool `json:"quiet,omitempty"`
}

// AdminServerSpec specifies how to start the proxy's admin server:
Expand Down
5 changes: 5 additions & 0 deletions internal/workload/podspec_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,11 @@ func (s *updateState) updateContainer(p *cloudsqlapi.AuthProxyWorkload, c *corev
// configure structured logs
s.addProxyContainerEnvVar(p, "CSQL_PROXY_STRUCTURED_LOGS", "true")

// configure quiet logs
if p.Spec.AuthProxyContainer != nil && p.Spec.AuthProxyContainer.Quiet {
s.addProxyContainerEnvVar(p, "CSQL_PROXY_QUIET", "true")
}

c.Name = ContainerName(p)
c.ImagePullPolicy = "IfNotPresent"

Expand Down
3 changes: 3 additions & 0 deletions internal/workload/podspec_updates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ func TestProxyCLIArgs(t *testing.T) {
},
MaxConnections: ptr(int64(10)),
MaxSigtermDelay: ptr(int64(20)),
Quiet: true,
},
Instances: []cloudsqlapi.InstanceSpec{{
ConnectionString: "hello:world:one",
Expand All @@ -692,6 +693,8 @@ func TestProxyCLIArgs(t *testing.T) {
"CSQL_PROXY_QUOTA_PROJECT": "qp",
"CSQL_PROXY_MAX_CONNECTIONS": "10",
"CSQL_PROXY_MAX_SIGTERM_DELAY": "20",
"CSQL_PROXY_QUIET": "true",
"CSQL_PROXY_STRUCTURED_LOGS": "true",
},
},
{
Expand Down

0 comments on commit f00635d

Please sign in to comment.