Skip to content

Commit

Permalink
[artifactory] Fix Ingress routing and add an example for routing Xray…
Browse files Browse the repository at this point in the history
… traffic from … (jfrog#443)

* Fix Ingress routing and add an example for routing Xray traffic from the same ingress

* Add travis_timeout to avoid timing out the builds

* Fix jdbc url in the external db example

* Fix jdbc url in the external db example

* Remove databaseName format from the url example

* Add missing formats to the code snippets
  • Loading branch information
danielezer authored Aug 12, 2019
1 parent 67ded3e commit 526d877
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 30 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ jobs:
travis_terminate 0
fi
- echo "Run charts-testing install test!"
# ping stdout every 9 minutes or Travis kills the build
# https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
- while sleep 20m; do echo "=====[ $SECONDS seconds still running ]====="; done &
- ./test/e2e-github.sh
# https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received
- travis_wait 30 ./test/e2e-github.sh

stages:
- lint-scripts
Expand Down
3 changes: 3 additions & 0 deletions stable/artifactory/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# JFrog Artifactory Chart Changelog
All changes to this chart will be documented in this file.

## [7.16.10] - Aug 11, 2019
* Fix Ingress routing and add an example

## [7.16.9] - Aug 5, 2019
* Do not mount `access/etc/bootstrap.creds` unless user specifies a custom password or secret (Access already generates a random password if not provided one)
* If custom `bootstrap.creds` is provided (using keys or custom secret), prepare it with an init container so the temp file does not persist
Expand Down
2 changes: 1 addition & 1 deletion stable/artifactory/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: artifactory
home: https://www.jfrog.com/artifactory/
version: 7.16.9
version: 7.16.10
appVersion: 6.11.3
description: Universal Repository Manager supporting all major packaging formats,
build tools and CI servers.
Expand Down
59 changes: 38 additions & 21 deletions stable/artifactory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ In the `networkpolicy` section of values.yaml you can specify a list of NetworkP
For podSelector, ingress and egress, if nothing is provided then a default `- {}` is applied which is to allow everything.

A full (but very wide open) example that results in 2 NetworkPolicy objects being created:
```
```yaml
networkpolicy:
# Allows all ingress and egress to/from artifactory.
- name: artifactory
Expand Down Expand Up @@ -394,14 +394,14 @@ helm install --name artifactory --set nginx.customConfigMap=nginx-config jfrog/a
### Use an external Database

#### PostgreSQL
There are cases where you will want to use an external PostgreSQL with a different database name e.g. `my-artifactory-db`, then you need set a custom PostgreSQL connection URL, where `databaseName=my-artifactory-db`.
There are cases where you will want to use an external PostgreSQL with a different database name e.g. `my-artifactory-db`, then you need set a custom PostgreSQL connection URL, where `my-artifactory-db` is the name of the database.

This can be done with the following parameters
```bash
...
--set postgresql.enabled=false \
--set database.type=postgresql \
--set database.url='jdbc:sqlserver://${DB_HOST}:${DB_PORT};databaseName=my-artifactory-db;sendStringParametersAsUnicode=false;applicationName=Artifactory Binary Repository' \
--set database.url='jdbc:postgresql://${DB_HOST}:${DB_PORT}/my-artifactory-db' \
--set database.user=${DB_USER} \
--set database.password=${DB_PASSWORD} \
...
Expand Down Expand Up @@ -481,7 +481,7 @@ kubectl logs -n <NAMESPACE> <POD_NAME> -c <LOG_CONTAINER_NAME>
There are cases where a special, unsupported init processes is needed like checking something on the file system or testing something before spinning up the main container.

For this, there is a section for writing a custom init container in the [values.yaml](values.yaml). By default it's commented out
```
```yaml
artifactory:
## Add custom init containers
customInitContainers: |
Expand All @@ -492,7 +492,7 @@ artifactory:
There are cases where an extra sidecar container is needed. For example monitoring agents or log collection.

For this, there is a section for writing a custom sidecar container in the [values.yaml](values.yaml). By default it's commented out
```
```yaml
artifactory:
## Add custom sidecar containers
customSidecarContainers: |
Expand All @@ -503,15 +503,15 @@ artifactory:
If you need to use a custom volume in a custom init or sidecar container, you can use this option.

For this, there is a section for defining custom volumes in the [values.yaml](values.yaml). By default it's commented out
```
```yaml
artifactory:
## Add custom volumes
customVolumes: |
## Custom volume comes here ##
```

You can configure the sidecar to run as a custom user if needed by setting the following in the container template
```
```yaml
# Example of running container as root (id 0)
securityContext:
runAsUser: 0
Expand All @@ -522,7 +522,7 @@ You can configure the sidecar to run as a custom user if needed by setting the f
If you need to add [Artifactory User Plugin](https://github.com/jfrog/artifactory-user-plugins), you can use this option.

Create a secret with [Artifactory User Plugin](https://github.com/jfrog/artifactory-user-plugins) by following command:
```
```bash
# Secret with single user plugin
kubectl create secret generic archive-old-artifacts --from-file=archiveOldArtifacts.groovy --namespace=artifactory
Expand All @@ -539,7 +539,7 @@ artifactory:
```

You can now pass the created `plugins.yaml` file to helm install command to deploy Artifactory with user plugins as follows:
```
```bash
helm install --name artifactory -f plugins.yaml jfrog/artifactory
```

Expand Down Expand Up @@ -754,7 +754,7 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm

### Ingress and TLS
To get Helm to create an ingress object with a hostname, add these two lines to your Helm command:
```
```bash
helm install --name artifactory \
--set ingress.enabled=true \
--set ingress.hosts[0]="artifactory.company.com" \
Expand All @@ -767,13 +767,13 @@ If your cluster allows automatic creation/retrieval of TLS certificates (e.g. [c

To manually configure TLS, first create/retrieve a key & certificate pair for the address(es) you wish to protect. Then create a TLS secret in the namespace:

```console
```bash
kubectl create secret tls artifactory-tls --cert=path/to/tls.cert --key=path/to/tls.key
```

Include the secret's name, along with the desired hostnames, in the Artifactory Ingress TLS section of your custom `values.yaml` file:

```
```yaml
ingress:
## If true, Artifactory Ingress will be created
##
Expand All @@ -799,7 +799,7 @@ Include the secret's name, along with the desired hostnames, in the Artifactory

This example specifically enables Artifactory to work as a Docker Registry using the Repository Path method. See [Artifactory as Docker Registry](https://www.jfrog.com/confluence/display/RTF/Getting+Started+with+Artifactory+as+a+Docker+Registry) documentation for more information about this setup.

```
```yaml
ingress:
enabled: true
defaultBackend:
Expand Down Expand Up @@ -827,15 +827,32 @@ You have the option to add additional ingress rules to the Artifactory ingress.
In order to do that, simply add the following to a `artifactory-values.yaml` file:
```yaml
ingress:
additionalRules:
- host: <INGRESS_HOSTNAME>
http:
paths:
- path: /xray
backend:
serviceName: <XRAY_SERVICE_NAME>
servicePort: <XRAY_SERVICE_PORT>
enabled: true
defaultBackend:
enabled: false
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/configuration-snippet: |
rewrite "(?i)/xray(/|$)(.*)" /$2 break;
additionalRules: |
- host: <MY_HOSTNAME>
http:
paths:
- path: /
backend:
serviceName: <XRAY_SERVER_SERVICE_NAME>
servicePort: <XRAY_SERVER_SERVICE_PORT>
- path: /xray
backend:
serviceName: <XRAY_SERVER_SERVICE_NAME>
servicePort: <XRAY_SERVER_SERVICE_PORT>
- path: /artifactory
backend:
serviceName: {{ template "artifactory.nginx.fullname" . }}
servicePort: {{ .Values.nginx.externalPortHttp }}
```

and running:
Expand Down
8 changes: 4 additions & 4 deletions stable/artifactory/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ spec:
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- if .Values.ingress.hosts }}
{{- end }}
rules:
{{- if .Values.ingress.hosts }}
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host | quote }}
http:
Expand All @@ -38,11 +38,11 @@ spec:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end -}}
{{- end -}}
{{- with .Values.ingress.additionalRules }}
{{ toYaml . | indent 2 }}
{{ tpl . $ | indent 2 }}
{{- end }}

{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
Expand Down

0 comments on commit 526d877

Please sign in to comment.