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

add support for custom environment variables to the server deployment #291

Merged
merged 2 commits into from
Oct 16, 2024

Conversation

andrewrothstein
Copy link
Contributor

@andrewrothstein andrewrothstein commented Oct 11, 2024

a corporate L7 proxy sits between my kiali deployment and my prometheus server. I need to specify the (HTTP|HTTPS|NO)_PROXY environment variables in my helm chart deployment.

part of: kiali/kiali#7569

@jmazzitelli
Copy link
Contributor

Please review the community contribution document for the process that is in place before submitting any PRs. We ask that a github issue be created first which describes the details of the bug or enhancement request being asked for. The issue provides a chance for the Kiali maintainers to have a dialogue with you before you submit any PRs.

For example, this is not complete without an accompanying operator PR.

In addition, I believe this request has been asked for before - though I can't remember the resolution (if there was one). Did you search in the github issues/discussions for a request for proxy settings?

Copy link
Contributor

@jmazzitelli jmazzitelli left a comment

Choose a reason for hiding this comment

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

@jmazzitelli
Copy link
Contributor

jmazzitelli commented Oct 12, 2024

@jmazzitelli
Copy link
Contributor

This PR looks correct as-is. Since we need feature parity with the operator, here's other places to touch for the new operator PR we need:

@jmazzitelli
Copy link
Contributor

I'm going to work on the operator implementation. Should be done today. This is going to be done as part of kiali/kiali#7569

@jmazzitelli
Copy link
Contributor

jmazzitelli commented Oct 16, 2024

Test procedures for this PR:

  1. Build the helm charts: make build-helm-charts
  2. Run "helm template" and set some custom envs - confirm the envs are being set in the deployment, ensuring things like booleans and numbers are properly quoted:
helm template \
  --set deployment.custom_envs[0].name="FOO1" \
  --set deployment.custom_envs[0].value="http://aa.example.com:123" \
  --set deployment.custom_envs[1].name="FOO2" \
  --set deployment.custom_envs[1].value=123 \
  --set deployment.custom_envs[2].name="FOO3" \
  --set deployment.custom_envs[2].value=true \
  -n istio-system kiali-server _output/charts/kiali-server-*.tgz

should result in the following within the Deployment:

        - name: "FOO1"
          value: "http://aa.example.com:123"
        - name: "FOO2"
          value: "123"
        - name: "FOO3"
          value: "true"

And to see it actually deploy, use "helm install" and look at the pod yaml:

helm install \
  --set deployment.custom_envs[0].name="FOO1"  \
  --set deployment.custom_envs[0].value="http://aa.example.com:123" \
  --set deployment.custom_envs[1].name="FOO2" \
  --set deployment.custom_envs[1].value=123 \
  --set deployment.custom_envs[2].name="FOO3" \
  --set deployment.custom_envs[2].value=true  \
  -n istio-system kiali-server _output/charts/kiali-server-*.tgz

After the pod deploys, look at the envs and confirm the three custom ones are there:

kubectl get pods -n istio-system -l app.kubernetes.io/name=kiali -ojsonpath='{..spec.containers[0].env}' | jq

results in

[
  {
    "name": "ACTIVE_NAMESPACE",
    "valueFrom": {
      "fieldRef": {
        "apiVersion": "v1",
        "fieldPath": "metadata.namespace"
      }
    }
  },
  {
    "name": "LOG_LEVEL",
    "value": "info"
  },
  {
    "name": "LOG_FORMAT",
    "value": "text"
  },
  {
    "name": "LOG_TIME_FIELD_FORMAT",
    "value": "2006-01-02T15:04:05Z07:00"
  },
  {
    "name": "LOG_SAMPLER_RATE",
    "value": "1"
  },
  {
    "name": "FOO1",
    "value": "http://aa.example.com:123"
  },
  {
    "name": "FOO2",
    "value": "123"
  },
  {
    "name": "FOO3",
    "value": "true"
  }
]

@jmazzitelli jmazzitelli dismissed their stale review October 16, 2024 11:14

I created the operator PR for this functionality.

@jmazzitelli
Copy link
Contributor

operator PR that introduces this functionality: kiali/kiali-operator#829

kiali-server/values.yaml Outdated Show resolved Hide resolved
jshaughn
jshaughn previously approved these changes Oct 16, 2024
Copy link

@jshaughn jshaughn left a comment

Choose a reason for hiding this comment

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

Ran through the test steps and it worked. I'll approve and merge (assuming the operator part works as well). We can remove the bad comment iin a trivial follow-up, not sure the original author will get to it.

@jmazzitelli
Copy link
Contributor

We can remove the bad comment in a trivial follow-up

I was able to commit it - github allows maintainers to commit suggestions so I had permission from the github UI to do it.

Copy link

@jshaughn jshaughn left a comment

Choose a reason for hiding this comment

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

re-approving after trivial change

@jmazzitelli jmazzitelli merged commit 947b55a into kiali:master Oct 16, 2024
1 check passed
@andrewrothstein andrewrothstein deleted the feature/add-custom-envs branch October 21, 2024 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires operator PR Requires changes to the operator
Projects
Development

Successfully merging this pull request may close these issues.

3 participants