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

Setup Authorino logger #158

Merged
merged 1 commit into from
Nov 17, 2023
Merged

Conversation

grzpiotrowski
Copy link
Contributor

@grzpiotrowski grzpiotrowski commented Nov 8, 2023

This change ensures that the authorino-operator uses almost the same logger as in Authorino repo.

Only a small change made to the logger compared to the logger package in authorino, that is: in SetLogger function, getting rid of the Options parameter passed into it which was only used to log the level/mode inside that function.

Closes #5

Verification:

kind create cluster --name authorino-sandbox

Create the namespace for the Operator:

kubectl create namespace authorino-operator

Build the local image:

docker build --build-arg DEFAULT_AUTHORINO_IMAGE=quay.io/kuadrant/authorino:latest -t authorino-operator:local .

Load the image into kind cluster:

kind -n authorino-sandbox load docker-image authorino-operator:local

Install operator manifests:

make install

Deploy authorino operator:

make deploy OPERATOR_IMAGE=authorino-operator:local

Deploy Authorino to have something to log:

echo "
apiVersion: operator.authorino.kuadrant.io/v1beta1
kind: Authorino
metadata:
  name: authorino
spec:
  listener:
    tls:
      enabled: false
  oidcServer:
    tls:
      enabled: false
" | kubectl apply -f -

Check the logs in the default level and mode:

kubectl logs -n authorino-operator authorino-operator-XXXX

Change the LOG_LEVEL and LOG_MODE env variables:

kubectl patch deployment authorino-operator -n authorino-operator --type='json' -p='[
  {
    "op": "replace",
    "path": "/spec/template/spec/containers/0/args",
    "value": [
      "--leader-elect",
      "--log-level=debug",
      "--log-mode=development"
    ]
  }
]'

Check the logs of the new pod to see that different log level works:

kubectl logs -n authorino-operator authorino-operator-YYYY

Clean up:

kind delete cluster -n authorino-sandbox
docker image rm authorino-operator:local

main.go Outdated Show resolved Hide resolved
@grzpiotrowski grzpiotrowski force-pushed the authorino-logger branch 2 times, most recently from 4765aee to afc7aad Compare November 14, 2023 15:30
Copy link
Collaborator

@guicassolato guicassolato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job!

@guicassolato guicassolato merged commit ff5f358 into Kuadrant:main Nov 17, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to use the same logging system as Authorino
2 participants