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

feature: Allow users to set quiet logging on proxy container #464

Merged
merged 2 commits into from
Oct 24, 2023
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
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