Skip to content

Commit

Permalink
Change the logging in production
Browse files Browse the repository at this point in the history
  also update development invocation accordingly.
  • Loading branch information
babysnakes committed Dec 26, 2023
1 parent 912b052 commit 895b018
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions .run/Build & Run.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<configuration default="false" name="Build &amp; Run" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="dynamic-environment" />
<working_directory value="$PROJECT_DIR$" />
<parameters value="-zap-devel" />
<envs>
<env name="ENABLE_WEBHOOKS" value="false" />
</envs>
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ build: manifests generate fmt vet ## Build manager binary.

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
ENABLE_WEBHOOKS=false go run ./main.go
ENABLE_WEBHOOKS=false go run ./main.go -zap-devel

.PHONY: docker-build
docker-build: ## Build docker image with the manager.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Dynamic Environment Controller <img src="https://riskified.github.io/dynamic-environment-docs/img/de-logo.svg" alt="Dynamic Environment Logo" width="20">


A k8s operator which supports testing on a multi-test workflows environment in a
transparent way. This operator will listen to DynamicEnv, a new Riskified custom resource.
transparent way. This operator will listen to DynamicEnv, a new Riskified custom resource.
In this resource we will configure the services from which we want to create a subset with new version of our app
and apply all the requirements for routing the requests to the matching subsets.
Ready to get started? Check out the [docs](https://riskified.github.io/dynamic-environment-docs/).
Expand Down Expand Up @@ -161,6 +160,9 @@ To run our development operator:
make install run
```
> Note: if you run in development mode not using the `Makefile` add `-zap-devel` to your parameters
> for better development logging.
On another shell session you can deploy a sample _dynamic-environment_ resource to see the effect:
```shell
Expand Down
3 changes: 3 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ spec:
- version
- --default-version
- shared
# uncomment the next two lines to set log level to debug (also error is valid value, default is info)
# - --zap-log-level
# - debug
# uncomment below (and edit to your liking) to specify labels to be removed (comma separated list)
#- --remove-labels
#- argocd.argoproj.io/instance
Expand Down
4 changes: 4 additions & 0 deletions helm/dynamic-environment/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ spec:
- --remove-labels
- {{ $removeLabels }}
{{- end }}
{{- if .Values.command.debugLogger }}
- --zap-log-level
- debug
{{- end }}
command:
- /manager
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
Expand Down
2 changes: 2 additions & 0 deletions helm/dynamic-environment/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ command:
# Specify a default version other than the default 'shared'. This version will be used when searching default
# DestinationRule. Could be specified per subset in the CR.
defaultVersion: "shared"
# Set log level to debug
debugLogger: false

# Labels to be deleted form deployments when duplicating (e.g. labels that connect deployment to argocd app):
labelsToRemove: []
Expand Down
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ func main() {
flag.StringVar(&defaultVersion, "default-version", names.DefaultVersion,
"The global default version - this version is the one that gets the default route. Could be overridden per subset.")
flag.Var(&labelsToRemove, "remove-labels", "A comma separated list of labels to remove when duplicating deployment.")
opts := zap.Options{
Development: true,
}
opts := zap.Options{}
opts.BindFlags(flag.CommandLine)
flag.Parse()

Expand Down

0 comments on commit 895b018

Please sign in to comment.