-
Notifications
You must be signed in to change notification settings - Fork 219
Implement logging API #374
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
Implement logging API #374
Conversation
116d38e to
830d2c7
Compare
830d2c7 to
46c688e
Compare
* pkg/operator/controller/ingress/deployment_test.go (checkDeploymentHasEnvVar, checkDeploymentHasContainer): New helpers. (TestDesiredRouterDeployment): Use the new helpers.
|
Rebased. |
46c688e to
6ab76aa
Compare
6ab76aa to
c13edae
Compare
|
/retest |
3 similar comments
|
/retest |
|
/retest |
|
/retest |
|
/test e2e-aws |
|
/retest |
Bump to github.com/openshift/api@8cfd79130f9c03777ae5db16e2c55e1039f977aa to get the logging API. * go.mod: Bump. * hack/update-generated-crd.sh: * hack/verify-generated-crd.sh: Update path to the vendored ingresscontroller CRD file. * go.sum: * manifests/00-custom-resource-definition.yaml: * pkg/manifests/bindata.go: * vendor/github.com/openshift/api/*: * vendor/modules.txt: Regenerate.
c13edae to
9edc970
Compare
9edc970 to
c7c60a7
Compare
| } | ||
| } | ||
|
|
||
| func checkRollingUpdateParams(t *testing.T, deployment *appsv1.Deployment, maxUnavailable intstr.IntOrString, maxSurge intstr.IntOrString) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice little refactor here, thanks — one more thing it made me think of (not required, just a sidebar discussion) is you can now express your expectations with a struct and make a table test out of the env assertions, like
{
env{name: WildcardRouteAdmissionPolicy, equals: "false"},
env{name: "ROUTER_USE_PROXY_PROTOCOL", equals: nil},
}
And feed them into your assertion function. Likewise with container checks. And then keep adding sugar until we reinvent Ginkgo 😁
ironcladlou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First quick pass
e365ca3 to
6704902
Compare
This commit resolves NE-285. https://issues.redhat.com/browse/NE-285 * pkg/operator/controller/ingress/deployment.go (RouterLogLevelEnvName) (RouterSyslogAddressEnvName, RouterSyslogFormatEnvName) (RouterSyslogFacilityEnvName): New constants. (desiredRouterDeployment): Delete logic for the unsupported-logging annotation. Using the new accessLoggingForIngressController function, check whether spec.logging.access is specified on the ingresscontroller, and configure logging accordingly. (accessLoggingForIngressController): New function. Return the access logging parameters for the given ingresscontroller if it enables access logging. * pkg/operator/controller/ingress/deployment_test.go (TestDesiredRouterDeployment): Verify that the unsupported-logging annotation overrides spec.logging.access. Verify that spec.logging.access has the desired effect. (TestInferTLSProfileSpecFromDeployment): Use "logs" as the name of the syslog sidecar container in order to be consistent with the logging API. * pkg/operator/controller/ingress/rsyslog_configmap.go (EnableLoggingAnnotation, haproxyLogLevels): Delete definitions. (ExtraLoggingEnabled): Delete function. (desiredRsyslogConfigMap): Use accessLoggingForIngressController to determine whether a configmap is needed. * test/e2e/operator_test.go (TestSyslogLogging): New test. Create a pod that runs an rsyslog instance and an ingresscontroller that logs to that rsyslog instance and verify that the rsyslog instance logs an HTTP request. * test/e2e/operator_test.go (TestContainerLogging): New test. Create an ingresscontroller that logs to a sidecar container and verify that it becomes available.
6704902 to
1da14ee
Compare
|
lgtm, will let @danehans do the honors after he gets a chance to look through it |
| return deployment, nil | ||
| } | ||
|
|
||
| // accessLoggingForIngressController returns an AccessLogging value for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Miciah accessLoggingForIngressController returns a pointer not a value, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, it's a pointer. We can fix the comment in a follow-up.
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danehans, Miciah The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Add helpers for deployment unit tests
pkg/operator/controller/ingress/deployment_test.go(checkDeploymentHasEnvVar,checkDeploymentHasContainer): New helpers.(
TestDesiredRouterDeployment): Use the new helpers.Bump openshift/api for logging API
Bump to github.com/openshift/api@8cfd79130f9c03777ae5db16e2c55e1039f977aa to get the logging API.
go.mod: Bump.hack/update-generated-crd.sh:hack/verify-generated-crd.sh: Update path to the vendored ingresscontroller CRD file.go.sum:manifests/00-custom-resource-definition.yaml:pkg/manifests/bindata.go:vendor/github.com/openshift/api/*:vendor/modules.txt: Regenerate.Implement logging API
This commit resolves NE-285.
pkg/operator/controller/ingress/deployment.go(RouterLogLevelEnvName,RouterSyslogAddressEnvName,RouterSyslogFormatEnvName,RouterSyslogFacilityEnvName): New constants.(
desiredRouterDeployment): Check whetherspec.logging.accessis specified on the ingresscontroller, and configure logging accordingly.pkg/operator/controller/ingress/deployment_test.go(TestDesiredRouterDeployment): Verify that theunsupported-loggingannotation overridesspec.logging.access. Verify thatspec.logging.accesshas the desired effect.(
TestInferTLSProfileSpecFromDeployment): Use "logs" as the name of the syslog sidecar container in order to be consistent with the logging API.test/e2e/operator_test.go(TestSyslog): New test. Create a pod that runs an rsyslog instance and an ingresscontroller that logs to that rsyslog instance and verify that the rsyslog instance logs an HTTP request.