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

feat: add HTTPSProxy to env var #678

Merged
merged 4 commits into from
Feb 22, 2022
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
5 changes: 3 additions & 2 deletions api/integreatly/v1alpha1/grafana_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ type GrafanaDeployment struct {
// GrafanaHttpProxy provides a means to configure the Grafana deployment
// to use an HTTP(S) proxy when making requests and resolving plugins.
type GrafanaHttpProxy struct {
Enabled bool `json:"enabled"`
URL string `json:"url,omitempty"`
Enabled bool `json:"enabled"`
URL string `json:"url,omitempty"`
SecureURL string `json:"secureUrl,omitempty"`
}

// GrafanaIngress provides a means to configure the ingress created
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/integreatly.org_grafanas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4404,6 +4404,8 @@ spec:
properties:
enabled:
type: boolean
secureUrl:
type: string
url:
type: string
required:
Expand Down
12 changes: 12 additions & 0 deletions controllers/model/grafanaDeployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,12 @@ func getContainers(cr *v1alpha1.Grafana, configHash, dsHash string) []v13.Contai
Name: "HTTP_PROXY",
Value: cr.Spec.Deployment.HttpProxy.URL,
})
if cr.Spec.Deployment.HttpProxy.SecureURL != "" {
envVars = append(envVars, v13.EnvVar{
Name: "HTTPS_PROXY",
Value: cr.Spec.Deployment.HttpProxy.SecureURL,
})
}
}

if cr.Spec.Deployment != nil && cr.Spec.Deployment.Env != nil {
Expand Down Expand Up @@ -642,6 +648,12 @@ func getInitContainers(cr *v1alpha1.Grafana, plugins string) []v13.Container {
Name: "HTTP_PROXY",
Value: cr.Spec.Deployment.HttpProxy.URL,
})
if cr.Spec.Deployment.HttpProxy.SecureURL != "" {
envVars = append(envVars, v13.EnvVar{
Name: "HTTPS_PROXY",
Value: cr.Spec.Deployment.HttpProxy.SecureURL,
})
}
}

var volumeName = constants.GrafanaPluginsVolumeName
Expand Down
2 changes: 2 additions & 0 deletions deploy/manifests/latest/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4981,6 +4981,8 @@ spec:
properties:
enabled:
type: boolean
secureUrl:
type: string
url:
type: string
required:
Expand Down
7 changes: 7 additions & 0 deletions documentation/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11700,6 +11700,13 @@ GrafanaHttpProxy provides a means to configure the Grafana deployment to use an
<br/>
</td>
<td>true</td>
</tr><tr>
<td><b>secureUrl</b></td>
<td>string</td>
<td>
<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>url</b></td>
<td>string</td>
Expand Down
16 changes: 16 additions & 0 deletions documentation/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,19 @@ stringData:
```

If the plugin doesn't install, try restarting the grafana deployment.

## Install plugins through a HTTP(S) Proxy

To install plugins through a HTTP(S) Proxy, you will have to define the `spec.deployment.HttpProxy` section of the Grafana CR. EG:

If you need to use HTTPS, please add your HTTPS proxy URL to the `secureURL` section.

```yaml
spec:
...
deployment:
HttpProxy:
enabled: true
url: <your proxy URL here>
secureURL: <your HTTPS proxy URL here>
```