make charts: charts
parent
0e21a2d1c7
commit
98c459bfed
|
@ -0,0 +1,22 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
OWNERS
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,20 @@
|
|||
annotations:
|
||||
catalog.cattle.io/certified: partner
|
||||
catalog.cattle.io/release-name: artifactory-ha
|
||||
apiVersion: v1
|
||||
appVersion: 7.17.5
|
||||
description: Universal Repository Manager supporting all major packaging formats,
|
||||
build tools and CI servers.
|
||||
home: https://www.jfrog.com/artifactory/
|
||||
icon: https://raw.githubusercontent.com/jfrog/charts/master/stable/artifactory-ha/logo/artifactory-logo.png
|
||||
keywords:
|
||||
- artifactory
|
||||
- jfrog
|
||||
- devops
|
||||
maintainers:
|
||||
- email: installers@jfrog.com
|
||||
name: Chart Maintainers at JFrog
|
||||
name: artifactory-ha
|
||||
sources:
|
||||
- https://github.com/jfrog/charts
|
||||
version: 4.13.1
|
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,140 @@
|
|||
# JFrog Artifactory Reverse Proxy Settings using Nginx
|
||||
|
||||
#### Reverse Proxy
|
||||
* To use Artifactory as docker registry it's mandatory to use Reverse Proxy.
|
||||
* Artifactory provides a Reverse Proxy Configuration Generator screen in which you can fill in a set of fields to generate
|
||||
the required configuration snippet which you can then download and install directly in the corresponding directory of your reverse proxy server.
|
||||
* To learn about configuring NGINX or Apache for reverse proxy refer to documentation provided on [JFrog wiki](https://www.jfrog.com/confluence/display/RTF/Configuring+a+Reverse+Proxy)
|
||||
* By default Artifactory helm chart uses Nginx for reverse proxy and load balancing.
|
||||
|
||||
**Note**: Nginx image distributed with Artifactory helm chart is custom image managed and maintained by JFrog.
|
||||
|
||||
#### Features of Artifactory Nginx
|
||||
* Provides default configuration with self signed SSL certificate generated on each helm install/upgrade.
|
||||
* Persist configuration and SSL certificate in `/var/opt/jfrog/nginx` directory
|
||||
|
||||
#### Changing the default Artifactory nginx conf
|
||||
Use a values.yaml file for changing the value of nginx.mainConf or nginx.artifactoryConf
|
||||
These configuration will be mounted to the nginx container using a configmap.
|
||||
For example:
|
||||
1. Create a values file `nginx-values.yaml` with the following values:
|
||||
```yaml
|
||||
nginx:
|
||||
artifactoryConf: |
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
|
||||
ssl_certificate {{ .Values.nginx.persistence.mountPath }}/ssl/tls.crt;
|
||||
ssl_certificate_key {{ .Values.nginx.persistence.mountPath }}/ssl/tls.key;
|
||||
ssl_session_cache shared:SSL:1m;
|
||||
ssl_prefer_server_ciphers on;
|
||||
## server configuration
|
||||
server {
|
||||
listen {{ .Values.nginx.internalPortHttps }} ssl;
|
||||
listen {{ .Values.nginx.internalPortHttp }} ;
|
||||
## Change to you DNS name you use to access Artifactory
|
||||
server_name ~(?<repo>.+)\.{{ include "artifactory-ha.fullname" . }} {{ include "artifactory-ha.fullname" . }};
|
||||
|
||||
if ($http_x_forwarded_proto = '') {
|
||||
set $http_x_forwarded_proto $scheme;
|
||||
}
|
||||
## Application specific logs
|
||||
## access_log /var/log/nginx/artifactory-access.log timing;
|
||||
## error_log /var/log/nginx/artifactory-error.log;
|
||||
rewrite ^/$ /artifactory/webapp/ redirect;
|
||||
rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
|
||||
if ( $repo != "" ) {
|
||||
rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/$repo/$1/$2 break;
|
||||
}
|
||||
rewrite ^/(v1|v2)/([^/]+)(.*)$ /artifactory/api/docker/$2/$1/$3;
|
||||
rewrite ^/(v1|v2)/ /artifactory/api/docker/$1/;
|
||||
chunked_transfer_encoding on;
|
||||
client_max_body_size 0;
|
||||
location /artifactory/ {
|
||||
proxy_read_timeout 900;
|
||||
proxy_pass_header Server;
|
||||
proxy_cookie_path ~*^/.* /;
|
||||
if ( $request_uri ~ ^/artifactory/(.*)$ ) {
|
||||
proxy_pass http://{{ include "artifactory-ha.fullname" . }}:{{ .Values.artifactory.externalPort }}/artifactory/$1;
|
||||
}
|
||||
proxy_pass http://{{ include "artifactory-ha.fullname" . }}:{{ .Values.artifactory.externalPort }}/artifactory/;
|
||||
proxy_set_header X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. Install/upgrade artifactory:
|
||||
```bash
|
||||
helm upgrade --install artifactory-ha jfrog/artifactory-ha -f nginx-values.yaml
|
||||
```
|
||||
|
||||
|
||||
#### Steps to use static configuration for reverse proxy in nginx.
|
||||
1. Get Artifactory service name using this command `kubectl get svc -n $NAMESPACE`
|
||||
|
||||
2. Create `artifactory.conf` file with nginx configuration. More [nginx configuration examples](https://github.com/jfrog/artifactory-docker-examples/tree/master/files/nginx/conf.d)
|
||||
|
||||
Following is example `artifactory.conf`
|
||||
|
||||
**Note**:
|
||||
* Create file with name `artifactory.conf` as it's fixed in configMap key.
|
||||
* Replace `artifactory-artifactory` with service name taken from step 1.
|
||||
|
||||
```bash
|
||||
## add ssl entries when https has been set in config
|
||||
ssl_certificate /var/opt/jfrog/nginx/ssl/tls.crt;
|
||||
ssl_certificate_key /var/opt/jfrog/nginx/ssl/tls.key;
|
||||
ssl_session_cache shared:SSL:1m;
|
||||
ssl_prefer_server_ciphers on;
|
||||
## server configuration
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen 80;
|
||||
## Change to you DNS name you use to access Artifactory
|
||||
server_name ~(?<repo>.+)\.artifactory-artifactory artifactory-artifactory;
|
||||
|
||||
if ($http_x_forwarded_proto = '') {
|
||||
set $http_x_forwarded_proto $scheme;
|
||||
}
|
||||
## Application specific logs
|
||||
## access_log /var/log/nginx/artifactory-access.log timing;
|
||||
## error_log /var/log/nginx/artifactory-error.log;
|
||||
rewrite ^/$ /artifactory/webapp/ redirect;
|
||||
rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
|
||||
if ( $repo != "" ) {
|
||||
rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/$repo/$1/$2 break;
|
||||
}
|
||||
rewrite ^/(v1|v2)/([^/]+)(.*)$ /artifactory/api/docker/$2/$1/$3;
|
||||
rewrite ^/(v1|v2)/ /artifactory/api/docker/$1/;
|
||||
chunked_transfer_encoding on;
|
||||
client_max_body_size 0;
|
||||
location /artifactory/ {
|
||||
proxy_read_timeout 900;
|
||||
proxy_pass_header Server;
|
||||
proxy_cookie_path ~*^/.* /;
|
||||
if ( $request_uri ~ ^/artifactory/(.*)$ ) {
|
||||
proxy_pass http://artifactory-artifactory:8081/artifactory/$1 break;
|
||||
}
|
||||
proxy_pass http://artifactory-artifactory:8081/artifactory/;
|
||||
proxy_set_header X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. Create configMap of `artifactory.conf` created with step above.
|
||||
```bash
|
||||
kubectl create configmap art-nginx-conf --from-file=artifactory.conf
|
||||
```
|
||||
4. Deploy Artifactory using helm chart.
|
||||
You can achieve this by providing the name of configMap created above to `nginx.customArtifactoryConfigMap` in [values.yaml](values.yaml)
|
||||
|
||||
Following is command to set values at runtime:
|
||||
```bash
|
||||
helm install --name artifactory-ha nginx.customArtifactoryConfigMap=art-nginx-conf jfrog/artifactory-ha
|
||||
```
|
|
@ -0,0 +1,42 @@
|
|||
# JFrog Artifactory Chart Upgrade Notes
|
||||
This file describes special upgrade notes needed at specific versions
|
||||
|
||||
## Upgrade from 1.X to 2.X and above (Chart Versions)
|
||||
|
||||
* If this is a new deployment or you already use an external database (`postgresql.enabled=false`), these changes **do not affect you!**
|
||||
* To upgrade from a version prior to 1.x, you first need to upgrade to latest version of 1.x as described in https://github.com/jfrog/charts/blob/master/stable/artifactory-ha/CHANGELOG.md.
|
||||
* Note: If you are upgrading from 1.x to 4.x and above chart versions, please delete the existing statefulset of postgresql before upgrading the chart due to breaking changes in postgresql subchart.
|
||||
```bash
|
||||
kubectl delete statefulsets <OLD_RELEASE_NAME>-postgresql
|
||||
```
|
||||
|
||||
## Upgrade from 0.X to 1.X (Chart Versions)
|
||||
**DOWNTIME IS REQUIRED FOR AN UPGRADE!**
|
||||
* If this is a new deployment or you already use an external database (`postgresql.enabled=false`), these changes **do not affect you!**
|
||||
* PostgreSQL sub chart was upgraded to version `6.5.x`. This version is not backward compatible with the old version (`0.9.5`)!
|
||||
* Note the following **PostgreSQL** Helm chart changes
|
||||
* The chart configuration has changed! See [values.yaml](values.yaml) for the new keys used
|
||||
* **PostgreSQL** is deployed as a StatefulSet
|
||||
* See [PostgreSQL helm chart](https://hub.helm.sh/charts/stable/postgresql) for all available configurations
|
||||
* Upgrade
|
||||
* Due to breaking changes in the **PostgreSQL** Helm chart, a migration of the database is needed from the old to the new database
|
||||
* The recommended migration process is the [full system export and import](https://www.jfrog.com/confluence/display/RTF/Importing+and+Exporting)
|
||||
* **NOTE:** To save time, export only metadata and configuration (check `Exclude Content` in the `System Import & Export`) since the Artifactory filestore is persisted
|
||||
* Upgrade steps:
|
||||
1. Block user access to Artifactory (do not shutdown)
|
||||
a. Scale down the cluster to primary node only (`node.replicaCount=0`) so the exported db and configuration will be kept on one known node (the primary)
|
||||
b. If your Artifactory HA K8s service is set to member nodes only (`service.pool=members`) you will need to access the primary node directly (use `kubectl port-forward`)
|
||||
2. Perform `Export System` from the `Admin` -> `Import & Export` -> `System` -> `Export System`
|
||||
a. Check `Exclude Content` to save export size (as Artifactory filestore will persist across upgrade)
|
||||
b. Choose to save the export on the persisted Artifactory volume (`/var/opt/jfrog/artifactory/`)
|
||||
c. Click `Export` (this can take some time)
|
||||
3. Run the `helm upgrade` with the new version. Old PostgreSQL will be removed and new one deployed
|
||||
a. You must pass explicit "ready for upgrade flag" with `--set databaseUpgradeReady=yes`. Failing to provide this will block the upgrade!
|
||||
4. Once ready, open Artifactory UI (you might need to re-enter a valid license). Skip all onboarding wizard steps
|
||||
a. **NOTE:** Don't worry you can't see the old config and files. It will all restore with the system import in the next step
|
||||
5. Perform `Import System` from the `Admin` -> `Import & Export` -> `System` -> `Import System`
|
||||
a. Browse to where the export was saved Artifactory volume (`/var/opt/jfrog/artifactory/<directory-you-set>`)
|
||||
b. Click `Import` (this can take some time)
|
||||
6. Restore access to Artifactory
|
||||
a. Scale the cluster member nodes back to the original size
|
||||
* Artifactory should now be ready to get back to normal operation
|
|
@ -0,0 +1,16 @@
|
|||
# JFrog Artifactory High Availability Helm Chart
|
||||
|
||||
Universal Repository Manager supporting all major packaging formats, build tools and CI servers.
|
||||
|
||||
## Chart Details
|
||||
This chart will do the following:
|
||||
|
||||
* Deploy Artifactory highly available cluster. 1 primary node and 2 member nodes.
|
||||
* Deploy a PostgreSQL database
|
||||
* Deploy an Nginx server(optional)
|
||||
|
||||
## Useful links
|
||||
Blog: [Herd Trust Into Your Rancher Labs Multi-Cloud Strategy with Artifactory](https://jfrog.com/blog/herd-trust-into-your-rancher-labs-multi-cloud-strategy-with-artifactory/)
|
||||
|
||||
## Activate Your Artifactory Instance
|
||||
Don't have a license? Please send an email to [rancher-jfrog-licenses@jfrog.com](mailto:rancher-jfrog-licenses@jfrog.com) to get it.
|
|
@ -0,0 +1,21 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
|
@ -0,0 +1,24 @@
|
|||
annotations:
|
||||
category: Database
|
||||
apiVersion: v1
|
||||
appVersion: 11.9.0
|
||||
description: Chart for PostgreSQL, an object-relational database management system
|
||||
(ORDBMS) with an emphasis on extensibility and on standards-compliance.
|
||||
home: https://www.postgresql.org/
|
||||
icon: https://bitnami.com/assets/stacks/postgresql/img/postgresql-stack-110x117.png
|
||||
keywords:
|
||||
- postgresql
|
||||
- postgres
|
||||
- database
|
||||
- sql
|
||||
- replication
|
||||
- cluster
|
||||
maintainers:
|
||||
- email: containers@bitnami.com
|
||||
name: Bitnami
|
||||
- email: cedric@desaintmartin.fr
|
||||
name: desaintmartin
|
||||
name: postgresql
|
||||
sources:
|
||||
- https://github.com/bitnami/bitnami-docker-postgresql
|
||||
version: 9.3.4
|
|
@ -0,0 +1,680 @@
|
|||
# PostgreSQL
|
||||
|
||||
[PostgreSQL](https://www.postgresql.org/) is an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.
|
||||
|
||||
For HA, please see [this repo](https://github.com/bitnami/charts/tree/master/bitnami/postgresql-ha)
|
||||
|
||||
## TL;DR
|
||||
|
||||
```console
|
||||
$ helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
$ helm install my-release bitnami/postgresql
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps a [PostgreSQL](https://github.com/bitnami/bitnami-docker-postgresql) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||
|
||||
Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This chart has been tested to work with NGINX Ingress, cert-manager, fluentd and Prometheus on top of the [BKPR](https://kubeprod.io/).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes 1.12+
|
||||
- Helm 2.12+ or Helm 3.0-beta3+
|
||||
- PV provisioner support in the underlying infrastructure
|
||||
|
||||
## Installing the Chart
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```console
|
||||
$ helm install my-release bitnami/postgresql
|
||||
```
|
||||
|
||||
The command deploys PostgreSQL on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation.
|
||||
|
||||
> **Tip**: List all releases using `helm list`
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
|
||||
```console
|
||||
$ helm delete my-release
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components but PVC's associated with the chart and deletes the release.
|
||||
|
||||
To delete the PVC's associated with `my-release`:
|
||||
|
||||
```console
|
||||
$ kubectl delete pvc -l release=my-release
|
||||
```
|
||||
|
||||
> **Note**: Deleting the PVC's will delete postgresql data as well. Please be cautious before doing it.
|
||||
|
||||
## Parameters
|
||||
|
||||
The following tables lists the configurable parameters of the PostgreSQL chart and their default values.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-----------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
|
||||
| `global.imageRegistry` | Global Docker Image registry | `nil` |
|
||||
| `global.postgresql.postgresqlDatabase` | PostgreSQL database (overrides `postgresqlDatabase`) | `nil` |
|
||||
| `global.postgresql.postgresqlUsername` | PostgreSQL username (overrides `postgresqlUsername`) | `nil` |
|
||||
| `global.postgresql.existingSecret` | Name of existing secret to use for PostgreSQL passwords (overrides `existingSecret`) | `nil` |
|
||||
| `global.postgresql.postgresqlPassword` | PostgreSQL admin password (overrides `postgresqlPassword`) | `nil` |
|
||||
| `global.postgresql.servicePort` | PostgreSQL port (overrides `service.port`) | `nil` |
|
||||
| `global.postgresql.replicationPassword` | Replication user password (overrides `replication.password`) | `nil` |
|
||||
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
|
||||
| `global.storageClass` | Global storage class for dynamic provisioning | `nil` |
|
||||
| `image.registry` | PostgreSQL Image registry | `docker.io` |
|
||||
| `image.repository` | PostgreSQL Image name | `bitnami/postgresql` |
|
||||
| `image.tag` | PostgreSQL Image tag | `{TAG_NAME}` |
|
||||
| `image.pullPolicy` | PostgreSQL Image pull policy | `IfNotPresent` |
|
||||
| `image.pullSecrets` | Specify Image pull secrets | `nil` (does not add image pull secrets to deployed pods) |
|
||||
| `image.debug` | Specify if debug values should be set | `false` |
|
||||
| `nameOverride` | String to partially override postgresql.fullname template with a string (will prepend the release name) | `nil` |
|
||||
| `fullnameOverride` | String to fully override postgresql.fullname template with a string | `nil` |
|
||||
| `volumePermissions.enabled` | Enable init container that changes volume permissions in the data directory (for cases where the default k8s `runAsUser` and `fsUser` values do not work) | `false` |
|
||||
| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` |
|
||||
| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/minideb` |
|
||||
| `volumePermissions.image.tag` | Init container volume-permissions image tag | `buster` |
|
||||
| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` |
|
||||
| `volumePermissions.securityContext.runAsUser` | User ID for the init container (when facing issues in OpenShift or uid unknown, try value "auto") | `0` |
|
||||
| `usePasswordFile` | Have the secrets mounted as a file instead of env vars | `false` |
|
||||
| `ldap.enabled` | Enable LDAP support | `false` |
|
||||
| `ldap.existingSecret` | Name of existing secret to use for LDAP passwords | `nil` |
|
||||
| `ldap.url` | LDAP URL beginning in the form `ldap[s]://host[:port]/basedn[?[attribute][?[scope][?[filter]]]]` | `nil` |
|
||||
| `ldap.server` | IP address or name of the LDAP server. | `nil` |
|
||||
| `ldap.port` | Port number on the LDAP server to connect to | `nil` |
|
||||
| `ldap.scheme` | Set to `ldaps` to use LDAPS. | `nil` |
|
||||
| `ldap.tls` | Set to `1` to use TLS encryption | `nil` |
|
||||
| `ldap.prefix` | String to prepend to the user name when forming the DN to bind | `nil` |
|
||||
| `ldap.suffix` | String to append to the user name when forming the DN to bind | `nil` |
|
||||
| `ldap.search_attr` | Attribute to match agains the user name in the search | `nil` |
|
||||
| `ldap.search_filter` | The search filter to use when doing search+bind authentication | `nil` |
|
||||
| `ldap.baseDN` | Root DN to begin the search for the user in | `nil` |
|
||||
| `ldap.bindDN` | DN of user to bind to LDAP | `nil` |
|
||||
| `ldap.bind_password` | Password for the user to bind to LDAP | `nil` |
|
||||
| `replication.enabled` | Enable replication | `false` |
|
||||
| `replication.user` | Replication user | `repl_user` |
|
||||
| `replication.password` | Replication user password | `repl_password` |
|
||||
| `replication.slaveReplicas` | Number of slaves replicas | `1` |
|
||||
| `replication.synchronousCommit` | Set synchronous commit mode. Allowed values: `on`, `remote_apply`, `remote_write`, `local` and `off` | `off` |
|
||||
| `replication.numSynchronousReplicas` | Number of replicas that will have synchronous replication. Note: Cannot be greater than `replication.slaveReplicas`. | `0` |
|
||||
| `replication.applicationName` | Cluster application name. Useful for advanced replication settings | `my_application` |
|
||||
| `existingSecret` | Name of existing secret to use for PostgreSQL passwords. The secret has to contain the keys `postgresql-postgres-password` which is the password for `postgresqlUsername` when it is different of `postgres`, `postgresql-password` which will override `postgresqlPassword`, `postgresql-replication-password` which will override `replication.password` and `postgresql-ldap-password` which will be sed to authenticate on LDAP. The value is evaluated as a template. | `nil` |
|
||||
| `postgresqlPostgresPassword` | PostgreSQL admin password (used when `postgresqlUsername` is not `postgres`, in which case`postgres` is the admin username). | _random 10 character alphanumeric string_ |
|
||||
| `postgresqlUsername` | PostgreSQL user (creates a non-admin user when `postgresqlUsername` is not `postgres`) | `postgres` |
|
||||
| `postgresqlPassword` | PostgreSQL user password | _random 10 character alphanumeric string_ |
|
||||
| `postgresqlDatabase` | PostgreSQL database | `nil` |
|
||||
| `postgresqlDataDir` | PostgreSQL data dir folder | `/bitnami/postgresql` (same value as persistence.mountPath) |
|
||||
| `extraEnv` | Any extra environment variables you would like to pass on to the pod. The value is evaluated as a template. | `[]` |
|
||||
| `extraEnvVarsCM` | Name of a Config Map containing extra environment variables you would like to pass on to the pod. The value is evaluated as a template. | `nil` |
|
||||
| `postgresqlInitdbArgs` | PostgreSQL initdb extra arguments | `nil` |
|
||||
| `postgresqlInitdbWalDir` | PostgreSQL location for transaction log | `nil` |
|
||||
| `postgresqlConfiguration` | Runtime Config Parameters | `nil` |
|
||||
| `postgresqlExtendedConf` | Extended Runtime Config Parameters (appended to main or default configuration) | `nil` |
|
||||
| `pgHbaConfiguration` | Content of pg_hba.conf | `nil (do not create pg_hba.conf)` |
|
||||
| `configurationConfigMap` | ConfigMap with the PostgreSQL configuration files (Note: Overrides `postgresqlConfiguration` and `pgHbaConfiguration`). The value is evaluated as a template. | `nil` |
|
||||
| `extendedConfConfigMap` | ConfigMap with the extended PostgreSQL configuration files. The value is evaluated as a template. | `nil` |
|
||||
| `initdbScripts` | Dictionary of initdb scripts | `nil` |
|
||||
| `initdbUser` | PostgreSQL user to execute the .sql and sql.gz scripts | `nil` |
|
||||
| `initdbPassword` | Password for the user specified in `initdbUser` | `nil` |
|
||||
| `initdbScriptsConfigMap` | ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`). The value is evaluated as a template. | `nil` |
|
||||
| `initdbScriptsSecret` | Secret with initdb scripts that contain sensitive information (Note: can be used with `initdbScriptsConfigMap` or `initdbScripts`). The value is evaluated as a template. | `nil` |
|
||||
| `service.type` | Kubernetes Service type | `ClusterIP` |
|
||||
| `service.port` | PostgreSQL port | `5432` |
|
||||
| `service.nodePort` | Kubernetes Service nodePort | `nil` |
|
||||
| `service.annotations` | Annotations for PostgreSQL service | `{}` (evaluated as a template) |
|
||||
| `service.loadBalancerIP` | loadBalancerIP if service type is `LoadBalancer` | `nil` |
|
||||
| `service.loadBalancerSourceRanges` | Address that are allowed when svc is LoadBalancer | `[]` (evaluated as a template) |
|
||||
| `schedulerName` | Name of the k8s scheduler (other than default) | `nil` |
|
||||
| `shmVolume.enabled` | Enable emptyDir volume for /dev/shm for master and slave(s) Pod(s) | `true` |
|
||||
| `shmVolume.chmod.enabled` | Run at init chmod 777 of the /dev/shm (ignored if `volumePermissions.enabled` is `false`) | `true` |
|
||||
| `persistence.enabled` | Enable persistence using PVC | `true` |
|
||||
| `persistence.existingClaim` | Provide an existing `PersistentVolumeClaim`, the value is evaluated as a template. | `nil` |
|
||||
| `persistence.mountPath` | Path to mount the volume at | `/bitnami/postgresql` |
|
||||
| `persistence.subPath` | Subdirectory of the volume to mount at | `""` |
|
||||
| `persistence.storageClass` | PVC Storage Class for PostgreSQL volume | `nil` |
|
||||
| `persistence.accessModes` | PVC Access Mode for PostgreSQL volume | `[ReadWriteOnce]` |
|
||||
| `persistence.size` | PVC Storage Request for PostgreSQL volume | `8Gi` |
|
||||
| `persistence.annotations` | Annotations for the PVC | `{}` |
|
||||
| `commonAnnotations` | Annotations to be added to all deployed resources (rendered as a template) | `{}` |
|
||||
| `master.nodeSelector` | Node labels for pod assignment (postgresql master) | `{}` |
|
||||
| `master.affinity` | Affinity labels for pod assignment (postgresql master) | `{}` |
|
||||
| `master.tolerations` | Toleration labels for pod assignment (postgresql master) | `[]` |
|
||||
| `master.anotations` | Map of annotations to add to the statefulset (postgresql master) | `{}` |
|
||||
| `master.labels` | Map of labels to add to the statefulset (postgresql master) | `{}` |
|
||||
| `master.podAnnotations` | Map of annotations to add to the pods (postgresql master) | `{}` |
|
||||
| `master.podLabels` | Map of labels to add to the pods (postgresql master) | `{}` |
|
||||
| `master.priorityClassName` | Priority Class to use for each pod (postgresql master) | `nil` |
|
||||
| `master.extraInitContainers` | Additional init containers to add to the pods (postgresql master) | `[]` |
|
||||
| `master.extraVolumeMounts` | Additional volume mounts to add to the pods (postgresql master) | `[]` |
|
||||
| `master.extraVolumes` | Additional volumes to add to the pods (postgresql master) | `[]` |
|
||||
| `master.sidecars` | Add additional containers to the pod | `[]` |
|
||||
| `master.service.type` | Allows using a different service type for Master | `nil` |
|
||||
| `master.service.nodePort` | Allows using a different nodePort for Master | `nil` |
|
||||
| `master.service.clusterIP` | Allows using a different clusterIP for Master | `nil` |
|
||||
| `slave.nodeSelector` | Node labels for pod assignment (postgresql slave) | `{}` |
|
||||
| `slave.affinity` | Affinity labels for pod assignment (postgresql slave) | `{}` |
|
||||
| `slave.tolerations` | Toleration labels for pod assignment (postgresql slave) | `[]` |
|
||||
| `slave.anotations` | Map of annotations to add to the statefulsets (postgresql slave) | `{}` |
|
||||
| `slave.labels` | Map of labels to add to the statefulsets (postgresql slave) | `{}` |
|
||||
| `slave.podAnnotations` | Map of annotations to add to the pods (postgresql slave) | `{}` |
|
||||
| `slave.podLabels` | Map of labels to add to the pods (postgresql slave) | `{}` |
|
||||
| `slave.priorityClassName` | Priority Class to use for each pod (postgresql slave) | `nil` |
|
||||
| `slave.extraInitContainers` | Additional init containers to add to the pods (postgresql slave) | `[]` |
|
||||
| `slave.extraVolumeMounts` | Additional volume mounts to add to the pods (postgresql slave) | `[]` |
|
||||
| `slave.extraVolumes` | Additional volumes to add to the pods (postgresql slave) | `[]` |
|
||||
| `slave.sidecars` | Add additional containers to the pod | `[]` |
|
||||
| `slave.service.type` | Allows using a different service type for Slave | `nil` |
|
||||
| `slave.service.nodePort` | Allows using a different nodePort for Slave | `nil` |
|
||||
| `slave.service.clusterIP` | Allows using a different clusterIP for Slave | `nil` |
|
||||
| `slave.persistence.enabled` | Whether to enable slave replicas persistence | `true` |
|
||||
| `terminationGracePeriodSeconds` | Seconds the pod needs to terminate gracefully | `nil` |
|
||||
| `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `250m` |
|
||||
| `securityContext.enabled` | Enable security context | `true` |
|
||||
| `securityContext.fsGroup` | Group ID for the container | `1001` |
|
||||
| `securityContext.runAsUser` | User ID for the container | `1001` |
|
||||
| `serviceAccount.enabled` | Enable service account (Note: Service Account will only be automatically created if `serviceAccount.name` is not set) | `false` |
|
||||
| `serviceAccount.name` | Name of existing service account | `nil` |
|
||||
| `livenessProbe.enabled` | Would you like a livenessProbe to be enabled | `true` |
|
||||
| `networkPolicy.enabled` | Enable NetworkPolicy | `false` |
|
||||
| `networkPolicy.allowExternal` | Don't require client label for connections | `true` |
|
||||
| `networkPolicy.explicitNamespacesSelector` | A Kubernetes LabelSelector to explicitly select namespaces from which ingress traffic could be allowed | `{}` |
|
||||
| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 30 |
|
||||
| `livenessProbe.periodSeconds` | How often to perform the probe | 10 |
|
||||
| `livenessProbe.timeoutSeconds` | When the probe times out | 5 |
|
||||
| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 |
|
||||
| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 |
|
||||
| `readinessProbe.enabled` | would you like a readinessProbe to be enabled | `true` |
|
||||
| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | 5 |
|
||||
| `readinessProbe.periodSeconds` | How often to perform the probe | 10 |
|
||||
| `readinessProbe.timeoutSeconds` | When the probe times out | 5 |
|
||||
| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 |
|
||||
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 |
|
||||
| `tls.enabled` | Enable TLS traffic support | `false` |
|
||||
| `tls.preferServerCiphers` | Whether to use the server's TLS cipher preferences rather than the client's | `true` |
|
||||
| `tls.certificatesSecret` | Name of an existing secret that contains the certificates | `nil` |
|
||||
| `tls.certFilename` | Certificate filename | `""` |
|
||||
| `tls.certKeyFilename` | Certificate key filename | `""` |
|
||||
| `tls.certCAFilename` | CA Certificate filename. If provided, PostgreSQL will authenticate TLS/SSL clients by requesting them a certificate. |`nil` |
|
||||
| `tls.crlFilename` | File containing a Certificate Revocation List |`nil` |
|
||||
| `metrics.enabled` | Start a prometheus exporter | `false` |
|
||||
| `metrics.service.type` | Kubernetes Service type | `ClusterIP` |
|
||||
| `service.clusterIP` | Static clusterIP or None for headless services | `nil` |
|
||||
| `metrics.service.annotations` | Additional annotations for metrics exporter pod | `{ prometheus.io/scrape: "true", prometheus.io/port: "9187"}` |
|
||||
| `metrics.service.loadBalancerIP` | loadBalancerIP if redis metrics service type is `LoadBalancer` | `nil` |
|
||||
| `metrics.serviceMonitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false` |
|
||||
| `metrics.serviceMonitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | `{}` |
|
||||
| `metrics.serviceMonitor.namespace` | Optional namespace in which to create ServiceMonitor | `nil` |
|
||||
| `metrics.serviceMonitor.interval` | Scrape interval. If not set, the Prometheus default scrape interval is used | `nil` |
|
||||
| `metrics.serviceMonitor.scrapeTimeout` | Scrape timeout. If not set, the Prometheus default scrape timeout is used | `nil` |
|
||||
| `metrics.prometheusRule.enabled` | Set this to true to create prometheusRules for Prometheus operator | `false` |
|
||||
| `metrics.prometheusRule.additionalLabels` | Additional labels that can be used so prometheusRules will be discovered by Prometheus | `{}` |
|
||||
| `metrics.prometheusRule.namespace` | namespace where prometheusRules resource should be created | the same namespace as postgresql |
|
||||
| `metrics.prometheusRule.rules` | [rules](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) to be created, check values for an example. | `[]` |
|
||||
| `metrics.image.registry` | PostgreSQL Exporter Image registry | `docker.io` |
|
||||
| `metrics.image.repository` | PostgreSQL Exporter Image name | `bitnami/postgres-exporter` |
|
||||
| `metrics.image.tag` | PostgreSQL Exporter Image tag | `{TAG_NAME}` |
|
||||
| `metrics.image.pullPolicy` | PostgreSQL Exporter Image pull policy | `IfNotPresent` |
|
||||
| `metrics.image.pullSecrets` | Specify Image pull secrets | `nil` (does not add image pull secrets to deployed pods) |
|
||||
| `metrics.customMetrics` | Additional custom metrics | `nil` |
|
||||
| `metrics.extraEnvVars` | Extra environment variables to add to exporter | `{}` (evaluated as a template) |
|
||||
| `metrics.securityContext.enabled` | Enable security context for metrics | `false` |
|
||||
| `metrics.securityContext.runAsUser` | User ID for the container for metrics | `1001` |
|
||||
| `metrics.livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 30 |
|
||||
| `metrics.livenessProbe.periodSeconds` | How often to perform the probe | 10 |
|
||||
| `metrics.livenessProbe.timeoutSeconds` | When the probe times out | 5 |
|
||||
| `metrics.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 |
|
||||
| `metrics.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 |
|
||||
| `metrics.readinessProbe.enabled` | would you like a readinessProbe to be enabled | `true` |
|
||||
| `metrics.readinessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 5 |
|
||||
| `metrics.readinessProbe.periodSeconds` | How often to perform the probe | 10 |
|
||||
| `metrics.readinessProbe.timeoutSeconds` | When the probe times out | 5 |
|
||||
| `metrics.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 |
|
||||
| `metrics.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 |
|
||||
| `updateStrategy` | Update strategy policy | `{type: "RollingUpdate"}` |
|
||||
| `psp.create` | Create Pod Security Policy | `false` |
|
||||
| `rbac.create` | Create Role and RoleBinding (required for PSP to work) | `false` |
|
||||
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```console
|
||||
$ helm install my-release \
|
||||
--set postgresqlPassword=secretpassword,postgresqlDatabase=my-database \
|
||||
bitnami/postgresql
|
||||
```
|
||||
|
||||
The above command sets the PostgreSQL `postgres` account password to `secretpassword`. Additionally it creates a database named `my-database`.
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
|
||||
|
||||
```console
|
||||
$ helm install my-release -f values.yaml bitnami/postgresql
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
|
||||
## Configuration and installation details
|
||||
|
||||
### [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/)
|
||||
|
||||
It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.
|
||||
|
||||
Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist.
|
||||
|
||||
### Production configuration and horizontal scaling
|
||||
|
||||
This chart includes a `values-production.yaml` file where you can find some parameters oriented to production configuration in comparison to the regular `values.yaml`. You can use this file instead of the default one.
|
||||
|
||||
- Enable replication:
|
||||
```diff
|
||||
- replication.enabled: false
|
||||
+ replication.enabled: true
|
||||
```
|
||||
|
||||
- Number of slaves replicas:
|
||||
```diff
|
||||
- replication.slaveReplicas: 1
|
||||
+ replication.slaveReplicas: 2
|
||||
```
|
||||
|
||||
- Set synchronous commit mode:
|
||||
```diff
|
||||
- replication.synchronousCommit: "off"
|
||||
+ replication.synchronousCommit: "on"
|
||||
```
|
||||
|
||||
- Number of replicas that will have synchronous replication:
|
||||
```diff
|
||||
- replication.numSynchronousReplicas: 0
|
||||
+ replication.numSynchronousReplicas: 1
|
||||
```
|
||||
|
||||
- Start a prometheus exporter:
|
||||
```diff
|
||||
- metrics.enabled: false
|
||||
+ metrics.enabled: true
|
||||
```
|
||||
|
||||
To horizontally scale this chart, you can use the `--replicas` flag to modify the number of nodes in your PostgreSQL deployment. Also you can use the `values-production.yaml` file or modify the parameters shown above.
|
||||
|
||||
### Customizing Master and Slave services in a replicated configuration
|
||||
|
||||
At the top level, there is a service object which defines the services for both master and slave. For deeper customization, there are service objects for both the master and slave types individually. This allows you to override the values in the top level service object so that the master and slave can be of different service types and with different clusterIPs / nodePorts. Also in the case you want the master and slave to be of type nodePort, you will need to set the nodePorts to different values to prevent a collision. The values that are deeper in the master.service or slave.service objects will take precedence over the top level service object.
|
||||
|
||||
### Change PostgreSQL version
|
||||
|
||||
To modify the PostgreSQL version used in this chart you can specify a [valid image tag](https://hub.docker.com/r/bitnami/postgresql/tags/) using the `image.tag` parameter. For example, `image.tag=X.Y.Z`. This approach is also applicable to other images like exporters.
|
||||
|
||||
### postgresql.conf / pg_hba.conf files as configMap
|
||||
|
||||
This helm chart also supports to customize the whole configuration file.
|
||||
|
||||
Add your custom file to "files/postgresql.conf" in your working directory. This file will be mounted as configMap to the containers and it will be used for configuring the PostgreSQL server.
|
||||
|
||||
Alternatively, you can specify PostgreSQL configuration parameters using the `postgresqlConfiguration` parameter as a dict, using camelCase, e.g. {"sharedBuffers": "500MB"}.
|
||||
|
||||
In addition to these options, you can also set an external ConfigMap with all the configuration files. This is done by setting the `configurationConfigMap` parameter. Note that this will override the two previous options.
|
||||
|
||||
### Allow settings to be loaded from files other than the default `postgresql.conf`
|
||||
|
||||
If you don't want to provide the whole PostgreSQL configuration file and only specify certain parameters, you can add your extended `.conf` files to "files/conf.d/" in your working directory.
|
||||
Those files will be mounted as configMap to the containers adding/overwriting the default configuration using the `include_dir` directive that allows settings to be loaded from files other than the default `postgresql.conf`.
|
||||
|
||||
Alternatively, you can also set an external ConfigMap with all the extra configuration files. This is done by setting the `extendedConfConfigMap` parameter. Note that this will override the previous option.
|
||||
|
||||
### Initialize a fresh instance
|
||||
|
||||
The [Bitnami PostgreSQL](https://github.com/bitnami/bitnami-docker-postgresql) image allows you to use your custom scripts to initialize a fresh instance. In order to execute the scripts, they must be located inside the chart folder `files/docker-entrypoint-initdb.d` so they can be consumed as a ConfigMap.
|
||||
|
||||
Alternatively, you can specify custom scripts using the `initdbScripts` parameter as dict.
|
||||
|
||||
In addition to these options, you can also set an external ConfigMap with all the initialization scripts. This is done by setting the `initdbScriptsConfigMap` parameter. Note that this will override the two previous options. If your initialization scripts contain sensitive information such as credentials or passwords, you can use the `initdbScriptsSecret` parameter.
|
||||
|
||||
The allowed extensions are `.sh`, `.sql` and `.sql.gz`.
|
||||
|
||||
### Securing traffic using TLS
|
||||
|
||||
TLS support can be enabled in the chart by specifying the `tls.` parameters while creating a release. The following parameters should be configured to properly enable the TLS support in the chart:
|
||||
|
||||
- `tls.enabled`: Enable TLS support. Defaults to `false`
|
||||
- `tls.certificatesSecret`: Name of an existing secret that contains the certificates. No defaults.
|
||||
- `tls.certFilename`: Certificate filename. No defaults.
|
||||
- `tls.certKeyFilename`: Certificate key filename. No defaults.
|
||||
|
||||
For example:
|
||||
|
||||
* First, create the secret with the cetificates files:
|
||||
|
||||
```console
|
||||
kubectl create secret generic certificates-tls-secret --from-file=./cert.crt --from-file=./cert.key --from-file=./ca.crt
|
||||
```
|
||||
|
||||
* Then, use the following parameters:
|
||||
|
||||
```console
|
||||
volumePermissions.enabled=true
|
||||
tls.enabled=true
|
||||
tls.certificatesSecret="certificates-tls-secret"
|
||||
tls.certFilename="cert.crt"
|
||||
tls.certKeyFilename="cert.key"
|
||||
```
|
||||
|
||||
> Note TLS and VolumePermissions: PostgreSQL requires certain permissions on sensitive files (such as certificate keys) to start up. Due to an on-going [issue](https://github.com/kubernetes/kubernetes/issues/57923) regarding kubernetes permissions and the use of `securityContext.runAsUser`, you must enable `volumePermissions` to ensure everything works as expected.
|
||||
|
||||
### Sidecars
|
||||
|
||||
If you need additional containers to run within the same pod as PostgreSQL (e.g. an additional metrics or logging exporter), you can do so via the `sidecars` config parameter. Simply define your container according to the Kubernetes container spec.
|
||||
|
||||
```yaml
|
||||
# For the PostgreSQL master
|
||||
master:
|
||||
sidecars:
|
||||
- name: your-image-name
|
||||
image: your-image
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- name: portname
|
||||
containerPort: 1234
|
||||
# For the PostgreSQL replicas
|
||||
slave:
|
||||
sidecars:
|
||||
- name: your-image-name
|
||||
image: your-image
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- name: portname
|
||||
containerPort: 1234
|
||||
```
|
||||
|
||||
### Metrics
|
||||
|
||||
The chart optionally can start a metrics exporter for [prometheus](https://prometheus.io). The metrics endpoint (port 9187) is not exposed and it is expected that the metrics are collected from inside the k8s cluster using something similar as the described in the [example Prometheus scrape configuration](https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml).
|
||||
|
||||
The exporter allows to create custom metrics from additional SQL queries. See the Chart's `values.yaml` for an example and consult the [exporters documentation](https://github.com/wrouesnel/postgres_exporter#adding-new-metrics-via-a-config-file) for more details.
|
||||
|
||||
### Use of global variables
|
||||
|
||||
In more complex scenarios, we may have the following tree of dependencies
|
||||
|
||||
```
|
||||
+--------------+
|
||||
| |
|
||||
+------------+ Chart 1 +-----------+
|
||||
| | | |
|
||||
| --------+------+ |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
| | |
|
||||
v v v
|
||||
+-------+------+ +--------+------+ +--------+------+
|
||||
| | | | | |
|
||||
| PostgreSQL | | Sub-chart 1 | | Sub-chart 2 |
|
||||
| | | | | |
|
||||
+--------------+ +---------------+ +---------------+
|
||||
```
|
||||
|
||||
The three charts below depend on the parent chart Chart 1. However, subcharts 1 and 2 may need to connect to PostgreSQL as well. In order to do so, subcharts 1 and 2 need to know the PostgreSQL credentials, so one option for deploying could be deploy Chart 1 with the following parameters:
|
||||
|
||||
```
|
||||
postgresql.postgresqlPassword=testtest
|
||||
subchart1.postgresql.postgresqlPassword=testtest
|
||||
subchart2.postgresql.postgresqlPassword=testtest
|
||||
postgresql.postgresqlDatabase=db1
|
||||
subchart1.postgresql.postgresqlDatabase=db1
|
||||
subchart2.postgresql.postgresqlDatabase=db1
|
||||
```
|
||||
|
||||
If the number of dependent sub-charts increases, installing the chart with parameters can become increasingly difficult. An alternative would be to set the credentials using global variables as follows:
|
||||
|
||||
```
|
||||
global.postgresql.postgresqlPassword=testtest
|
||||
global.postgresql.postgresqlDatabase=db1
|
||||
```
|
||||
|
||||
This way, the credentials will be available in all of the subcharts.
|
||||
|
||||
## Persistence
|
||||
|
||||
The [Bitnami PostgreSQL](https://github.com/bitnami/bitnami-docker-postgresql) image stores the PostgreSQL data and configurations at the `/bitnami/postgresql` path of the container.
|
||||
|
||||
Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube.
|
||||
See the [Parameters](#parameters) section to configure the PVC or to disable persistence.
|
||||
|
||||
If you already have data in it, you will fail to sync to standby nodes for all commits, details can refer to [code](https://github.com/bitnami/bitnami-docker-postgresql/blob/8725fe1d7d30ebe8d9a16e9175d05f7ad9260c93/9.6/debian-9/rootfs/libpostgresql.sh#L518-L556). If you need to use those data, please covert them to sql and import after `helm install` finished.
|
||||
|
||||
## NetworkPolicy
|
||||
|
||||
To enable network policy for PostgreSQL, install [a networking plugin that implements the Kubernetes NetworkPolicy spec](https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy#before-you-begin), and set `networkPolicy.enabled` to `true`.
|
||||
|
||||
For Kubernetes v1.5 & v1.6, you must also turn on NetworkPolicy by setting the DefaultDeny namespace annotation. Note: this will enforce policy for _all_ pods in the namespace:
|
||||
|
||||
```console
|
||||
$ kubectl annotate namespace default "net.beta.kubernetes.io/network-policy={\"ingress\":{\"isolation\":\"DefaultDeny\"}}"
|
||||
```
|
||||
|
||||
With NetworkPolicy enabled, traffic will be limited to just port 5432.
|
||||
|
||||
For more precise policy, set `networkPolicy.allowExternal=false`. This will only allow pods with the generated client label to connect to PostgreSQL.
|
||||
This label will be displayed in the output of a successful install.
|
||||
|
||||
## Differences between Bitnami PostgreSQL image and [Docker Official](https://hub.docker.com/_/postgres) image
|
||||
|
||||
- The Docker Official PostgreSQL image does not support replication. If you pass any replication environment variable, this would be ignored. The only environment variables supported by the Docker Official image are POSTGRES_USER, POSTGRES_DB, POSTGRES_PASSWORD, POSTGRES_INITDB_ARGS, POSTGRES_INITDB_WALDIR and PGDATA. All the remaining environment variables are specific to the Bitnami PostgreSQL image.
|
||||
- The Bitnami PostgreSQL image is non-root by default. This requires that you run the pod with `securityContext` and updates the permissions of the volume with an `initContainer`. A key benefit of this configuration is that the pod follows security best practices and is prepared to run on Kubernetes distributions with hard security constraints like OpenShift.
|
||||
- For OpenShift, one may either define the runAsUser and fsGroup accordingly, or try this more dynamic option: volumePermissions.securityContext.runAsUser="auto",securityContext.enabled=false,shmVolume.chmod.enabled=false
|
||||
|
||||
### Deploy chart using Docker Official PostgreSQL Image
|
||||
|
||||
From chart version 4.0.0, it is possible to use this chart with the Docker Official PostgreSQL image.
|
||||
Besides specifying the new Docker repository and tag, it is important to modify the PostgreSQL data directory and volume mount point. Basically, the PostgreSQL data dir cannot be the mount point directly, it has to be a subdirectory.
|
||||
|
||||
```
|
||||
image.repository=postgres
|
||||
image.tag=10.6
|
||||
postgresqlDataDir=/data/pgdata
|
||||
persistence.mountPath=/data/
|
||||
```
|
||||
|
||||
## Upgrade
|
||||
|
||||
It's necessary to specify the existing passwords while performing an upgrade to ensure the secrets are not updated with invalid randomly generated passwords. Remember to specify the existing values of the `postgresqlPassword` and `replication.password` parameters when upgrading the chart:
|
||||
|
||||
```bash
|
||||
$ helm upgrade my-release stable/postgresql \
|
||||
--set postgresqlPassword=[POSTGRESQL_PASSWORD] \
|
||||
--set replication.password=[REPLICATION_PASSWORD]
|
||||
```
|
||||
|
||||
> Note: you need to substitute the placeholders _[POSTGRESQL_PASSWORD]_, and _[REPLICATION_PASSWORD]_ with the values obtained from instructions in the installation notes.
|
||||
|
||||
## 9.0.0
|
||||
|
||||
In this version the chart was adapted to follow the Helm label best practices, see [PR 3021](https://github.com/bitnami/charts/pull/3021). That means the backward compatibility is not guarantee when upgrading the chart to this major version.
|
||||
|
||||
As a workaround, you can delete the existing statefulset (using the `--cascade=false` flag pods are not deleted) before upgrade the chart. For example, this can be a valid workflow:
|
||||
|
||||
- Deploy an old version (8.X.X)
|
||||
```console
|
||||
$ helm install postgresql bitnami/postgresql --version 8.10.14
|
||||
```
|
||||
|
||||
- Old version is up and running
|
||||
```console
|
||||
$ helm ls
|
||||
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
|
||||
postgresql default 1 2020-08-04 13:39:54.783480286 +0000 UTC deployed postgresql-8.10.14 11.8.0
|
||||
|
||||
$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
postgresql-postgresql-0 1/1 Running 0 76s
|
||||
```
|
||||
|
||||
- The upgrade to the latest one (9.X.X) is going to fail
|
||||
```console
|
||||
$ helm upgrade postgresql bitnami/postgresql
|
||||
Error: UPGRADE FAILED: cannot patch "postgresql-postgresql" with kind StatefulSet: StatefulSet.apps "postgresql-postgresql" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden
|
||||
```
|
||||
|
||||
- Delete the statefulset
|
||||
```console
|
||||
$ kubectl delete statefulsets.apps --cascade=false postgresql-postgresql
|
||||
statefulset.apps "postgresql-postgresql" deleted
|
||||
```
|
||||
|
||||
- Now the upgrade works
|
||||
```cosnole
|
||||
$ helm upgrade postgresql bitnami/postgresql
|
||||
$ helm ls
|
||||
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
|
||||
postgresql default 3 2020-08-04 13:42:08.020385884 +0000 UTC deployed postgresql-9.1.2 11.8.0
|
||||
```
|
||||
|
||||
- We can kill the existing pod and the new statefulset is going to create a new one:
|
||||
```console
|
||||
$ kubectl delete pod postgresql-postgresql-0
|
||||
pod "postgresql-postgresql-0" deleted
|
||||
|
||||
$ kubectl get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
postgresql-postgresql-0 1/1 Running 0 19s
|
||||
```
|
||||
|
||||
Please, note that without the `--cascade=false` both objects (statefulset and pod) are going to be removed and both objects will be deployed again with the `helm upgrade` command
|
||||
|
||||
## 8.0.0
|
||||
|
||||
Prefixes the port names with their protocols to comply with Istio conventions.
|
||||
|
||||
If you depend on the port names in your setup, make sure to update them to reflect this change.
|
||||
|
||||
## 7.1.0
|
||||
|
||||
Adds support for LDAP configuration.
|
||||
|
||||
## 7.0.0
|
||||
|
||||
Helm performs a lookup for the object based on its group (apps), version (v1), and kind (Deployment). Also known as its GroupVersionKind, or GVK. Changing the GVK is considered a compatibility breaker from Kubernetes' point of view, so you cannot "upgrade" those objects to the new GVK in-place. Earlier versions of Helm 3 did not perform the lookup correctly which has since been fixed to match the spec.
|
||||
|
||||
In https://github.com/helm/charts/pull/17281 the `apiVersion` of the statefulset resources was updated to `apps/v1` in tune with the api's deprecated, resulting in compatibility breakage.
|
||||
|
||||
This major version bump signifies this change.
|
||||
|
||||
## 6.5.7
|
||||
|
||||
In this version, the chart will use PostgreSQL with the Postgis extension included. The version used with Postgresql version 10, 11 and 12 is Postgis 2.5. It has been compiled with the following dependencies:
|
||||
|
||||
- protobuf
|
||||
- protobuf-c
|
||||
- json-c
|
||||
- geos
|
||||
- proj
|
||||
|
||||
## 5.0.0
|
||||
|
||||
In this version, the **chart is using PostgreSQL 11 instead of PostgreSQL 10**. You can find the main difference and notable changes in the following links: [https://www.postgresql.org/about/news/1894/](https://www.postgresql.org/about/news/1894/) and [https://www.postgresql.org/about/featurematrix/](https://www.postgresql.org/about/featurematrix/).
|
||||
|
||||
For major releases of PostgreSQL, the internal data storage format is subject to change, thus complicating upgrades, you can see some errors like the following one in the logs:
|
||||
|
||||
```console
|
||||
Welcome to the Bitnami postgresql container
|
||||
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
|
||||
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
|
||||
Send us your feedback at containers@bitnami.com
|
||||
|
||||
INFO ==> ** Starting PostgreSQL setup **
|
||||
NFO ==> Validating settings in POSTGRESQL_* env vars..
|
||||
INFO ==> Initializing PostgreSQL database...
|
||||
INFO ==> postgresql.conf file not detected. Generating it...
|
||||
INFO ==> pg_hba.conf file not detected. Generating it...
|
||||
INFO ==> Deploying PostgreSQL with persisted data...
|
||||
INFO ==> Configuring replication parameters
|
||||
INFO ==> Loading custom scripts...
|
||||
INFO ==> Enabling remote connections
|
||||
INFO ==> Stopping PostgreSQL...
|
||||
INFO ==> ** PostgreSQL setup finished! **
|
||||
|
||||
INFO ==> ** Starting PostgreSQL **
|
||||
[1] FATAL: database files are incompatible with server
|
||||
[1] DETAIL: The data directory was initialized by PostgreSQL version 10, which is not compatible with this version 11.3.
|
||||
```
|
||||
|
||||
In this case, you should migrate the data from the old chart to the new one following an approach similar to that described in [this section](https://www.postgresql.org/docs/current/upgrading.html#UPGRADING-VIA-PGDUMPALL) from the official documentation. Basically, create a database dump in the old chart, move and restore it in the new one.
|
||||
|
||||
### 4.0.0
|
||||
|
||||
This chart will use by default the Bitnami PostgreSQL container starting from version `10.7.0-r68`. This version moves the initialization logic from node.js to bash. This new version of the chart requires setting the `POSTGRES_PASSWORD` in the slaves as well, in order to properly configure the `pg_hba.conf` file. Users from previous versions of the chart are advised to upgrade immediately.
|
||||
|
||||
IMPORTANT: If you do not want to upgrade the chart version then make sure you use the `10.7.0-r68` version of the container. Otherwise, you will get this error
|
||||
|
||||
```
|
||||
The POSTGRESQL_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development
|
||||
```
|
||||
|
||||
### 3.0.0
|
||||
|
||||
This releases make it possible to specify different nodeSelector, affinity and tolerations for master and slave pods.
|
||||
It also fixes an issue with `postgresql.master.fullname` helper template not obeying fullnameOverride.
|
||||
|
||||
#### Breaking changes
|
||||
|
||||
- `affinty` has been renamed to `master.affinity` and `slave.affinity`.
|
||||
- `tolerations` has been renamed to `master.tolerations` and `slave.tolerations`.
|
||||
- `nodeSelector` has been renamed to `master.nodeSelector` and `slave.nodeSelector`.
|
||||
|
||||
### 2.0.0
|
||||
|
||||
In order to upgrade from the `0.X.X` branch to `1.X.X`, you should follow the below steps:
|
||||
|
||||
- Obtain the service name (`SERVICE_NAME`) and password (`OLD_PASSWORD`) of the existing postgresql chart. You can find the instructions to obtain the password in the NOTES.txt, the service name can be obtained by running
|
||||
|
||||
```console
|
||||
$ kubectl get svc
|
||||
```
|
||||
|
||||
- Install (not upgrade) the new version
|
||||
|
||||
```console
|
||||
$ helm repo update
|
||||
$ helm install my-release bitnami/postgresql
|
||||
```
|
||||
|
||||
- Connect to the new pod (you can obtain the name by running `kubectl get pods`):
|
||||
|
||||
```console
|
||||
$ kubectl exec -it NAME bash
|
||||
```
|
||||
|
||||
- Once logged in, create a dump file from the previous database using `pg_dump`, for that we should connect to the previous postgresql chart:
|
||||
|
||||
```console
|
||||
$ pg_dump -h SERVICE_NAME -U postgres DATABASE_NAME > /tmp/backup.sql
|
||||
```
|
||||
|
||||
After run above command you should be prompted for a password, this password is the previous chart password (`OLD_PASSWORD`).
|
||||
This operation could take some time depending on the database size.
|
||||
|
||||
- Once you have the backup file, you can restore it with a command like the one below:
|
||||
|
||||
```console
|
||||
$ psql -U postgres DATABASE_NAME < /tmp/backup.sql
|
||||
```
|
||||
|
||||
In this case, you are accessing to the local postgresql, so the password should be the new one (you can find it in NOTES.txt).
|
||||
|
||||
If you want to restore the database and the database schema does not exist, it is necessary to first follow the steps described below.
|
||||
|
||||
```console
|
||||
$ psql -U postgres
|
||||
postgres=# drop database DATABASE_NAME;
|
||||
postgres=# create database DATABASE_NAME;
|
||||
postgres=# create user USER_NAME;
|
||||
postgres=# alter role USER_NAME with password 'BITNAMI_USER_PASSWORD';
|
||||
postgres=# grant all privileges on database DATABASE_NAME to USER_NAME;
|
||||
postgres=# alter database DATABASE_NAME owner to USER_NAME;
|
||||
```
|
|
@ -0,0 +1,22 @@
|
|||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
|
@ -0,0 +1,21 @@
|
|||
annotations:
|
||||
category: Infrastructure
|
||||
apiVersion: v1
|
||||
appVersion: 0.6.2
|
||||
description: A Library Helm Chart for grouping common logic between bitnami charts.
|
||||
This chart is not deployable by itself.
|
||||
home: http://www.bitnami.com/
|
||||
icon: https://bitnami.com/downloads/logos/bitnami-mark.png
|
||||
keywords:
|
||||
- common
|
||||
- helper
|
||||
- template
|
||||
- function
|
||||
- bitnami
|
||||
maintainers:
|
||||
- email: containers@bitnami.com
|
||||
name: Bitnami
|
||||
name: common
|
||||
sources:
|
||||
- https://github.com/bitnami/charts
|
||||
version: 0.6.2
|
|
@ -0,0 +1,274 @@
|
|||
# Bitnami Common Library Chart
|
||||
|
||||
A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between bitnami charts.
|
||||
|
||||
## TL;DR
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
- name: common
|
||||
version: 0.x.x
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
```
|
||||
|
||||
```bash
|
||||
$ helm dependency update
|
||||
```
|
||||
|
||||
```yaml
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
data:
|
||||
myvalue: "Hello World"
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart provides a common template helpers which can be used to develop new charts using [Helm](https://helm.sh) package manager.
|
||||
|
||||
Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This Helm chart has been tested on top of [Bitnami Kubernetes Production Runtime](https://kubeprod.io/) (BKPR). Deploy BKPR to get automated TLS certificates, logging and monitoring for your applications.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Kubernetes 1.12+
|
||||
- Helm 2.12+ or Helm 3.0-beta3+
|
||||
|
||||
## Parameters
|
||||
|
||||
The following table lists the helpers available in the library which are scoped in different sections.
|
||||
|
||||
**Names**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.names.name` | Expand the name of the chart or use `.Values.nameOverride` | `.` Chart context |
|
||||
| `common.names.fullname` | Create a default fully qualified app name. | `.` Chart context |
|
||||
| `common.names.chart` | Chart name plus version | `.` Chart context |
|
||||
|
||||
**Images**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.images.image` | Return the proper and full image name | `dict "imageRoot" .Values.path.to.the.image "global" $`, see [ImageRoot](#imageroot) for the structure. |
|
||||
| `common.images.pullSecrets` | Return the proper Docker Image Registry Secret Names | `dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global` |
|
||||
|
||||
**Labels**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.labels.standard` | Return Kubernetes standard labels | `.` Chart context |
|
||||
| `common.labels.matchLabels` | Return the proper Docker Image Registry Secret Names | `.` Chart context |
|
||||
|
||||
**Storage**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.storage.class` | Return the proper Storage Class | `dict "persistence" .Values.path.to.the.persistence "global" $`, see [Persistence](#persistence) for the structure. |
|
||||
|
||||
**TplValues**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.tplvalues.render` | Renders a value that contains template | `dict "value" .Values.path.to.the.Value "context" $`, value is the value should rendered as template, context frecuently is the chart context `$` or `.` |
|
||||
|
||||
**Capabilities**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.capabilities.deployment.apiVersion` | Return the appropriate apiVersion for deployment. | `.` Chart context |
|
||||
| `common.capabilities.ingress.apiVersion` | Return the appropriate apiVersion for ingress. | `.` Chart context |
|
||||
|
||||
**Validations**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.validations.values.single.empty` | Validate a value must not be empty. | `dict "valueKey" "path.to.value" "secret" "secret.name" "field" "my-password" "context" $` secret and field are optional. In case they are given, the helper will generate a how to get instruction. See [ValidateValue](#validatevalue) |
|
||||
| `common.validations.values.multiple.empty` | Validate a multiple values must not be empty. It returns a shared error for all the values. | `dict "required" (list $validateValueConf00 $validateValueConf01) "context" $`. See [ValidateValue](#validatevalue) |
|
||||
| `common.validations.values.mariadb.passwords` | When a chart is using `bitnami/mariadb` as subchart you should use this to validate required password are not empty. It returns a shared error for all the values. | `dict "secret" "mariadb-secret" "context" $` |
|
||||
| `common.validations.values.postgresql.passwords` | This helper will ensure required password are not empty. It returns a shared error for all the values. | `dict "secret" "postgresql-secret" "subchart" "true" "context" $` subchart field is optional and could be true or false it depends on where you will use postgresql chart and the helper. |
|
||||
|
||||
**Warnings**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.warnings.rollingTag` | Warning about using rolling tag. | `ImageRoot` see [ImageRoot](#imageroot) for the structure. |
|
||||
|
||||
**Errors**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.errors.upgrade.passwords.empty` | It will ensure required passwords are given when we are upgrading a chart. If `validationErrors` is not empty it will throw an error and will stop the upgrade action. | `dict "validationErrors" (list $validationError00 $validationError01) "context" $` |
|
||||
|
||||
**Utils**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.utils.fieldToEnvVar` | Build environment variable name given a field. | `dict "field" "my-password"` |
|
||||
| `common.utils.secret.getvalue` | Print instructions to get a secret value. | `dict "secret" "secret-name" "field" "secret-value-field" "context" $` |
|
||||
|
||||
**Secrets**
|
||||
|
||||
| Helper identifier | Description | Expected Input |
|
||||
|--------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `common.secrets.name` | Generate the name of the secret. | `dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $` see [ExistingSecret](#existingsecret) for the structure. |
|
||||
| `common.secrets.key` | Generate secret key. | `dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName"` see [ExistingSecret](#existingsecret) for the structure. |
|
||||
|
||||
## Special input schemas
|
||||
|
||||
### ImageRoot
|
||||
|
||||
```yaml
|
||||
registry:
|
||||
type: string
|
||||
description: Docker registry where the image is located
|
||||
example: docker.io
|
||||
|
||||
repository:
|
||||
type: string
|
||||
description: Repository and image name
|
||||
example: bitnami/nginx
|
||||
|
||||
tag:
|
||||
type: string
|
||||
description: image tag
|
||||
example: 1.16.1-debian-10-r63
|
||||
|
||||
pullPolicy:
|
||||
type: string
|
||||
description: Specify a imagePullPolicy. Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
|
||||
pullSecrets:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
description: Optionally specify an array of imagePullSecrets.
|
||||
|
||||
debug:
|
||||
type: boolean
|
||||
description: Set to true if you would like to see extra information on logs
|
||||
example: false
|
||||
|
||||
## An instance would be:
|
||||
# registry: docker.io
|
||||
# repository: bitnami/nginx
|
||||
# tag: 1.16.1-debian-10-r63
|
||||
# pullPolicy: IfNotPresent
|
||||
# debug: false
|
||||
```
|
||||
|
||||
### Persistence
|
||||
|
||||
```yaml
|
||||
enabled:
|
||||
type: boolean
|
||||
description: Whether enable persistence.
|
||||
example: true
|
||||
|
||||
storageClass:
|
||||
type: string
|
||||
description: Ghost data Persistent Volume Storage Class, If set to "-", storageClassName: "" which disables dynamic provisioning.
|
||||
example: "-"
|
||||
|
||||
accessMode:
|
||||
type: string
|
||||
description: Access mode for the Persistent Volume Storage.
|
||||
example: ReadWriteOnce
|
||||
|
||||
size:
|
||||
type: string
|
||||
description: Size the Persistent Volume Storage.
|
||||
example: 8Gi
|
||||
|
||||
path:
|
||||
type: string
|
||||
description: Path to be persisted.
|
||||
example: /bitnami
|
||||
|
||||
## An instance would be:
|
||||
# enabled: true
|
||||
# storageClass: "-"
|
||||
# accessMode: ReadWriteOnce
|
||||
# size: 8Gi
|
||||
# path: /bitnami
|
||||
```
|
||||
|
||||
### ExistingSecret
|
||||
```yaml
|
||||
name:
|
||||
type: string
|
||||
description: Name of the existing secret.
|
||||
example: mySecret
|
||||
keyMapping:
|
||||
description: Mapping between the expected key name and the name of the key in the existing secret.
|
||||
type: object
|
||||
|
||||
## An instance would be:
|
||||
# name: mySecret
|
||||
# keyMapping:
|
||||
# password: myPasswordKey
|
||||
```
|
||||
|
||||
**Example of use**
|
||||
|
||||
When we store sensitive data for a deployment in a secret, some times we want to give to users the possiblity of using theirs existing secrets.
|
||||
|
||||
```yaml
|
||||
# templates/secret.yaml
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels:
|
||||
app: {{ include "common.names.fullname" . }}
|
||||
type: Opaque
|
||||
data:
|
||||
password: {{ .Values.password | b64enc | quote }}
|
||||
|
||||
# templates/dpl.yaml
|
||||
---
|
||||
...
|
||||
env:
|
||||
- name: PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "common.secrets.name" (dict "existingSecret" .Values.existingSecret "context" $) }}
|
||||
key: {{ include "common.secrets.key" (dict "existingSecret" .Values.existingSecret "key" "password") }}
|
||||
...
|
||||
|
||||
# values.yaml
|
||||
---
|
||||
name: mySecret
|
||||
keyMapping:
|
||||
password: myPasswordKey
|
||||
```
|
||||
|
||||
### ValidateValue
|
||||
|
||||
**NOTES.txt**
|
||||
|
||||
```
|
||||
{{- $validateValueConf00 := (dict "valueKey" "path.to.value00" "secret" "secretName" "field" "password-00") -}}
|
||||
{{- $validateValueConf01 := (dict "valueKey" "path.to.value01" "secret" "secretName" "field" "password-01") -}}
|
||||
|
||||
{{ include "common.validations.values.multiple.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
|
||||
```
|
||||
|
||||
If we force those values to be empty we will see some alerts
|
||||
|
||||
```console
|
||||
$ helm install test mychart --set path.to.value00="",path.to.value01=""
|
||||
'path.to.value00' must not be empty, please add '--set path.to.value00=$PASSWORD_00' to the command. To get the current value:
|
||||
|
||||
export PASSWORD_00=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-00}" | base64 --decode)
|
||||
|
||||
'path.to.value01' must not be empty, please add '--set path.to.value01=$PASSWORD_01' to the command. To get the current value:
|
||||
|
||||
export PASSWORD_01=$(kubectl get secret --namespace default secretName -o jsonpath="{.data.password-01}" | base64 --decode)
|
||||
```
|
||||
|
||||
## Notable changes
|
||||
|
||||
N/A
|
|
@ -0,0 +1,22 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Return the appropriate apiVersion for deployment.
|
||||
*/}}
|
||||
{{- define "common.capabilities.deployment.apiVersion" -}}
|
||||
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "apps/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for ingress.
|
||||
*/}}
|
||||
{{- define "common.capabilities.ingress.apiVersion" -}}
|
||||
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "networking.k8s.io/v1beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -0,0 +1,20 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Through error when upgrading using empty passwords values that must not be empty.
|
||||
|
||||
Usage:
|
||||
{{- $validationError00 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password00" "secret" "secretName" "field" "password-00") -}}
|
||||
{{- $validationError01 := include "common.validations.values.single.empty" (dict "valueKey" "path.to.password01" "secret" "secretName" "field" "password-01") -}}
|
||||
{{ include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $validationError00 $validationError01) "context" $) }}
|
||||
|
||||
Required password params:
|
||||
- validationErrors - String - Required. List of validation strings to be return, if it is empty it won't throw error.
|
||||
- context - Context - Required. Parent context.
|
||||
*/}}
|
||||
{{- define "common.errors.upgrade.passwords.empty" -}}
|
||||
{{- $validationErrors := join "" .validationErrors -}}
|
||||
{{- if and $validationErrors .context.Release.IsUpgrade -}}
|
||||
{{- $errorString := "\nPASSWORDS ERROR: you must provide your current passwords when upgrade the release%s" -}}
|
||||
{{- printf $errorString $validationErrors | fail -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -0,0 +1,43 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Return the proper image name
|
||||
{{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }}
|
||||
*/}}
|
||||
{{- define "common.images.image" -}}
|
||||
{{- $registryName := .imageRoot.registry -}}
|
||||
{{- $repositoryName := .imageRoot.repository -}}
|
||||
{{- $tag := .imageRoot.tag | toString -}}
|
||||
{{- if .global }}
|
||||
{{- if .global.imageRegistry }}
|
||||
{{- $registryName = .global.imageRegistry -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names
|
||||
{{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }}
|
||||
*/}}
|
||||
{{- define "common.images.pullSecrets" -}}
|
||||
{{- $pullSecrets := list }}
|
||||
|
||||
{{- if .global }}
|
||||
{{- range .global.imagePullSecrets -}}
|
||||
{{- $pullSecrets = append $pullSecrets . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range .images -}}
|
||||
{{- range .pullSecrets -}}
|
||||
{{- $pullSecrets = append $pullSecrets . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if (not (empty $pullSecrets)) }}
|
||||
imagePullSecrets:
|
||||
{{- range $pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
|
@ -0,0 +1,18 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Kubernetes standard labels
|
||||
*/}}
|
||||
{{- define "common.labels.standard" -}}
|
||||
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||
helm.sh/chart: {{ include "common.names.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
|
||||
*/}}
|
||||
{{- define "common.labels.matchLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "common.names.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
|
@ -0,0 +1,32 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "common.names.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "common.names.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "common.names.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -0,0 +1,49 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Generate secret name.
|
||||
|
||||
Usage:
|
||||
{{ include "common.secrets.name" (dict "existingSecret" .Values.path.to.the.existingSecret "defaultNameSuffix" "mySuffix" "context" $) }}
|
||||
|
||||
Params:
|
||||
- existingSecret - ExistingSecret - Optional. The path to the existing secrets in the values.yaml given by the user
|
||||
to be used istead of the default one. +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret
|
||||
- defaultNameSuffix - String - Optional. It is used only if we have several secrets in the same deployment.
|
||||
- context - Dict - Required. The context for the template evaluation.
|
||||
*/}}
|
||||
{{- define "common.secrets.name" -}}
|
||||
{{- $name := (include "common.names.fullname" .context) -}}
|
||||
|
||||
{{- if .defaultNameSuffix -}}
|
||||
{{- $name = cat $name .defaultNameSuffix -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with .existingSecret -}}
|
||||
{{- $name = .name -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- printf "%s" $name -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Generate secret key.
|
||||
|
||||
Usage:
|
||||
{{ include "common.secrets.key" (dict "existingSecret" .Values.path.to.the.existingSecret "key" "keyName") }}
|
||||
|
||||
Params:
|
||||
- existingSecret - ExistingSecret - Optional. The path to the existing secrets in the values.yaml given by the user
|
||||
to be used istead of the default one. +info: https://github.com/bitnami/charts/tree/master/bitnami/common#existingsecret
|
||||
- key - String - Required. Name of the key in the secret.
|
||||
*/}}
|
||||
{{- define "common.secrets.key" -}}
|
||||
{{- $key := .key -}}
|
||||
|
||||
{{- if .existingSecret -}}
|
||||
{{- if .existingSecret.keyMapping -}}
|
||||
{{- $key = index .existingSecret.keyMapping $.key -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- printf "%s" $key -}}
|
||||
{{- end -}}
|
|
@ -0,0 +1,23 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Return the proper Storage Class
|
||||
{{ include "common.storage.class" ( dict "persistence" .Values.path.to.the.persistence "global" $) }}
|
||||
*/}}
|
||||
{{- define "common.storage.class" -}}
|
||||
|
||||
{{- $storageClass := .persistence.storageClass -}}
|
||||
{{- if .global -}}
|
||||
{{- if .global.storageClass -}}
|
||||
{{- $storageClass = .global.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $storageClass -}}
|
||||
{{- if (eq "-" $storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else }}
|
||||
{{- printf "storageClassName: %s" $storageClass -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- end -}}
|
|
@ -0,0 +1,13 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Renders a value that contains template.
|
||||
Usage:
|
||||
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.tplvalues.render" -}}
|
||||
{{- if typeIs "string" .value }}
|
||||
{{- tpl .value .context }}
|
||||
{{- else }}
|
||||
{{- tpl (.value | toYaml) .context }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
|
@ -0,0 +1,26 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Print instructions to get a secret value.
|
||||
Usage:
|
||||
{{ include "common.utils.secret.getvalue" (dict "secret" "secret-name" "field" "secret-value-field" "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.utils.secret.getvalue" -}}
|
||||
{{- $varname := include "common.utils.fieldToEnvVar" . -}}
|
||||
export {{ $varname }}=$(kubectl get secret --namespace {{ .context.Release.Namespace }} {{ .secret }} -o jsonpath="{.data.{{ .field }}}" | base64 --decode)
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Build env var name given a field
|
||||
Usage:
|
||||
{{ include "common.utils.fieldToEnvVar" dict "field" "my-password" }}
|
||||
*/}}
|
||||
{{- define "common.utils.fieldToEnvVar" -}}
|
||||
{{- $fieldNameSplit := splitList "-" .field -}}
|
||||
{{- $upperCaseFieldNameSplit := list -}}
|
||||
|
||||
{{- range $fieldNameSplit -}}
|
||||
{{- $upperCaseFieldNameSplit = append $upperCaseFieldNameSplit ( upper . ) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ join "_" $upperCaseFieldNameSplit }}
|
||||
{{- end -}}
|
|
@ -0,0 +1,219 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Validate values must not be empty.
|
||||
|
||||
Usage:
|
||||
{{- $validateValueConf00 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-00") -}}
|
||||
{{- $validateValueConf01 := (dict "valueKey" "path.to.value" "secret" "secretName" "field" "password-01") -}}
|
||||
{{ include "common.validations.values.empty" (dict "required" (list $validateValueConf00 $validateValueConf01) "context" $) }}
|
||||
|
||||
Validate value params:
|
||||
- valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password"
|
||||
- secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret"
|
||||
- field - String - Optional. Name of the field in the secret data, e.g: "mysql-password"
|
||||
*/}}
|
||||
{{- define "common.validations.values.multiple.empty" -}}
|
||||
{{- range .required -}}
|
||||
{{- include "common.validations.values.single.empty" (dict "valueKey" .valueKey "secret" .secret "field" .field "context" $.context) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Validate a value must not be empty.
|
||||
|
||||
Usage:
|
||||
{{ include "common.validations.value.empty" (dict "valueKey" "mariadb.password" "secret" "secretName" "field" "my-password" "context" $) }}
|
||||
|
||||
Validate value params:
|
||||
- valueKey - String - Required. The path to the validating value in the values.yaml, e.g: "mysql.password"
|
||||
- secret - String - Optional. Name of the secret where the validating value is generated/stored, e.g: "mysql-passwords-secret"
|
||||
- field - String - Optional. Name of the field in the secret data, e.g: "mysql-password"
|
||||
*/}}
|
||||
{{- define "common.validations.values.single.empty" -}}
|
||||
{{- $valueKeyArray := splitList "." .valueKey -}}
|
||||
{{- $value := "" -}}
|
||||
{{- $latestObj := $.context.Values -}}
|
||||
{{- range $valueKeyArray -}}
|
||||
{{- if not $latestObj -}}
|
||||
{{- printf "please review the entire path of '%s' exists in values" $.valueKey | fail -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $value = ( index $latestObj . ) -}}
|
||||
{{- $latestObj = $value -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not $value -}}
|
||||
{{- $varname := "my-value" -}}
|
||||
{{- $getCurrentValue := "" -}}
|
||||
{{- if and .secret .field -}}
|
||||
{{- $varname = include "common.utils.fieldToEnvVar" . -}}
|
||||
{{- $getCurrentValue = printf " To get the current value:\n\n %s\n" (include "common.utils.secret.getvalue" .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- printf "\n '%s' must not be empty, please add '--set %s=$%s' to the command.%s" .valueKey .valueKey $varname $getCurrentValue -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate a mariadb required password must not be empty.
|
||||
|
||||
Usage:
|
||||
{{ include "common.validations.values.mariadb.passwords" (dict "secret" "secretName" "context" $) }}
|
||||
|
||||
Validate value params:
|
||||
- secret - String - Required. Name of the secret where mysql values are stored, e.g: "mysql-passwords-secret"
|
||||
*/}}
|
||||
{{- define "common.validations.values.mariadb.passwords" -}}
|
||||
{{- if and (not .context.Values.mariadb.existingSecret) .context.Values.mariadb.enabled -}}
|
||||
{{- $requiredPasswords := list -}}
|
||||
|
||||
{{- if .context.Values.mariadb.secret.requirePasswords -}}
|
||||
{{- $requiredRootMariadbPassword := dict "valueKey" "mariadb.rootUser.password" "secret" .secretName "field" "mariadb-root-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredRootMariadbPassword -}}
|
||||
|
||||
{{- if not (empty .context.Values.mariadb.db.user) -}}
|
||||
{{- $requiredMariadbPassword := dict "valueKey" "mariadb.db.password" "secret" .secretName "field" "mariadb-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredMariadbPassword -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .context.Values.mariadb.replication.enabled -}}
|
||||
{{- $requiredReplicationPassword := dict "valueKey" "mariadb.replication.password" "secret" .secretName "field" "mariadb-replication-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredReplicationPassword -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate a postgresql required password must not be empty.
|
||||
|
||||
Usage:
|
||||
{{ include "common.validations.values.postgresql.passwords" (dict "secret" "secretName" "subchart" false "context" $) }}
|
||||
Params:
|
||||
- secret - String - Required. Name of the secret where postgresql values are stored, e.g: "mysql-passwords-secret"
|
||||
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.validations.values.postgresql.passwords" -}}
|
||||
{{- $existingSecret := include "common.postgresql.values.existingSecret" . -}}
|
||||
{{- $enabled := include "common.postgresql.values.enabled" . -}}
|
||||
{{- $valueKeyPostgresqlPassword := include "common.postgresql.values.key.postgressPassword" . -}}
|
||||
{{- $enabledReplication := include "common.postgresql.values.enabled.replication" . -}}
|
||||
{{- $valueKeyPostgresqlReplicationEnabled := include "common.postgresql.values.key.replicationPassword" . -}}
|
||||
|
||||
{{- if and (not $existingSecret) $enabled -}}
|
||||
{{- $requiredPasswords := list -}}
|
||||
|
||||
{{- $requiredPostgresqlPassword := dict "valueKey" $valueKeyPostgresqlPassword "secret" .secret "field" "postgresql-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlPassword -}}
|
||||
|
||||
{{- if $enabledReplication -}}
|
||||
{{- $requiredPostgresqlReplicationPassword := dict "valueKey" $valueKeyPostgresqlReplicationEnabled "secret" .secret "field" "postgresql-replication-password" -}}
|
||||
{{- $requiredPasswords = append $requiredPasswords $requiredPostgresqlReplicationPassword -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- include "common.validations.values.multiple.empty" (dict "required" $requiredPasswords "context" .context) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliar function to decide whether evaluate global values.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.use.global" (dict "key" "key-of-global" "context" $) }}
|
||||
Params:
|
||||
- key - String - Required. Field to be evaluated within global, e.g: "existingSecret"
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.use.global" -}}
|
||||
{{- if .context.Values.global -}}
|
||||
{{- if .context.Values.global.postgresql -}}
|
||||
{{- index .context.Values.global.postgresql .key | quote -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliar function to get the right value for existingSecret.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.existingSecret" (dict "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.existingSecret" -}}
|
||||
{{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "existingSecret" "context" .context) -}}
|
||||
|
||||
{{- if .subchart -}}
|
||||
{{- default (.context.Values.postgresql.existingSecret | quote) $globalValue -}}
|
||||
{{- else -}}
|
||||
{{- default (.context.Values.existingSecret | quote) $globalValue -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliar function to get the right value for enabled postgresql.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.enabled" (dict "context" $) }}
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.enabled" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- .context.Values.postgresql.enabled | quote -}}
|
||||
{{- else -}}
|
||||
true
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliar function to get the right value for the key postgressPassword.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.key.postgressPassword" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.key.postgressPassword" -}}
|
||||
{{- $globalValue := include "common.postgresql.values.use.global" (dict "key" "postgresqlUsername" "context" .context) -}}
|
||||
|
||||
{{- if not $globalValue -}}
|
||||
{{- if .subchart -}}
|
||||
postgresql.postgresqlPassword
|
||||
{{- else -}}
|
||||
postgresqlPassword
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
global.postgresql.postgresqlPassword
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliar function to get the right value for enabled.replication.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.enabled.replication" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.enabled.replication" -}}
|
||||
{{- if .subchart -}}
|
||||
{{- .context.Values.postgresql.replication.enabled | quote -}}
|
||||
{{- else -}}
|
||||
{{- .context.Values.replication.enabled | quote -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Auxiliar function to get the right value for the key replication.password.
|
||||
|
||||
Usage:
|
||||
{{ include "common.postgresql.values.key.replicationPassword" (dict "subchart" "true" "context" $) }}
|
||||
Params:
|
||||
- subchart - Boolean - Optional. Whether postgresql is used as subchart or not. Default: false
|
||||
*/}}
|
||||
{{- define "common.postgresql.values.key.replicationPassword" -}}
|
||||
{{- if .subchart -}}
|
||||
postgresql.replication.password
|
||||
{{- else -}}
|
||||
replication.password
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -0,0 +1,14 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Warning about using rolling tag.
|
||||
Usage:
|
||||
{{ include "common.warnings.rollingTag" .Values.path.to.the.imageRoot }}
|
||||
*/}}
|
||||
{{- define "common.warnings.rollingTag" -}}
|
||||
|
||||
{{- if and (contains "bitnami/" .repository) (not (.tag | toString | regexFind "-r\\d+$|sha256:")) }}
|
||||
WARNING: Rolling tag detected ({{ .repository }}:{{ .tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment.
|
||||
+info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/
|
||||
{{- end }}
|
||||
|
||||
{{- end -}}
|
|
@ -0,0 +1,3 @@
|
|||
## bitnami/common
|
||||
## It is required by CI/CD tools and processes.
|
||||
exampleValue: common-chart
|
|
@ -0,0 +1,3 @@
|
|||
commonAnnotations:
|
||||
helm.sh/hook: 'pre-install, pre-upgrade'
|
||||
helm.sh/hook-weight: '-1'
|
|
@ -0,0 +1 @@
|
|||
# Leave this file empty to ensure that CI runs builds against the default configuration in values.yaml.
|
|
@ -0,0 +1,2 @@
|
|||
shmVolume:
|
||||
enabled: false
|
|
@ -0,0 +1 @@
|
|||
Copy here your postgresql.conf and/or pg_hba.conf files to use it as a config map.
|
|
@ -0,0 +1,4 @@
|
|||
If you don't want to provide the whole configuration file and only specify certain parameters, you can copy here your extended `.conf` files.
|
||||
These files will be injected as a config maps and add/overwrite the default configuration using the `include_dir` directive that allows settings to be loaded from files other than the default `postgresql.conf`.
|
||||
|
||||
More info in the [bitnami-docker-postgresql README](https://github.com/bitnami/bitnami-docker-postgresql#configuration-file).
|
|
@ -0,0 +1,3 @@
|
|||
You can copy here your custom `.sh`, `.sql` or `.sql.gz` file so they are executed during the first boot of the image.
|
||||
|
||||
More info in the [bitnami-docker-postgresql](https://github.com/bitnami/bitnami-docker-postgresql#initializing-a-new-instance) repository.
|
|
@ -0,0 +1,6 @@
|
|||
dependencies:
|
||||
- name: common
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 0.6.2
|
||||
digest: sha256:740783295d301fdd168fafdbaa760de27ab54b0ff36b513589a5a2515072b885
|
||||
generated: "2020-09-01T17:40:02.795096189Z"
|
|
@ -0,0 +1,4 @@
|
|||
dependencies:
|
||||
- name: common
|
||||
version: 0.x.x
|
||||
repository: https://charts.bitnami.com/bitnami
|
|
@ -0,0 +1,59 @@
|
|||
** Please be patient while the chart is being deployed **
|
||||
|
||||
PostgreSQL can be accessed via port {{ template "postgresql.port" . }} on the following DNS name from within your cluster:
|
||||
|
||||
{{ template "postgresql.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local - Read/Write connection
|
||||
{{- if .Values.replication.enabled }}
|
||||
{{ template "postgresql.fullname" . }}-read.{{ .Release.Namespace }}.svc.cluster.local - Read only connection
|
||||
{{- end }}
|
||||
|
||||
{{- if and (not (eq .Values.postgresqlUsername "postgres")) (or .Values.postgresqlPostgresPassword (include "postgresql.useExistingSecret" .)) }}
|
||||
|
||||
To get the password for "postgres" run:
|
||||
|
||||
export POSTGRES_ADMIN_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "postgresql.secretName" . }} -o jsonpath="{.data.postgresql-postgres-password}" | base64 --decode)
|
||||
{{- end }}
|
||||
|
||||
To get the password for "{{ template "postgresql.username" . }}" run:
|
||||
|
||||
export POSTGRES_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "postgresql.secretName" . }} -o jsonpath="{.data.postgresql-password}" | base64 --decode)
|
||||
|
||||
To connect to your database run the following command:
|
||||
|
||||
kubectl run {{ template "postgresql.fullname" . }}-client --rm --tty -i --restart='Never' --namespace {{ .Release.Namespace }} --image {{ template "postgresql.image" . }} --env="PGPASSWORD=$POSTGRES_PASSWORD" {{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}
|
||||
--labels="{{ template "postgresql.fullname" . }}-client=true" {{- end }} --command -- psql --host {{ template "postgresql.fullname" . }} -U {{ .Values.postgresqlUsername }} -d {{- if .Values.postgresqlDatabase }} {{ .Values.postgresqlDatabase }}{{- else }} postgres{{- end }} -p {{ template "postgresql.port" . }}
|
||||
|
||||
{{ if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}
|
||||
Note: Since NetworkPolicy is enabled, only pods with label {{ template "postgresql.fullname" . }}-client=true" will be able to connect to this PostgreSQL cluster.
|
||||
{{- end }}
|
||||
|
||||
To connect to your database from outside the cluster execute the following commands:
|
||||
|
||||
{{- if contains "NodePort" .Values.service.type }}
|
||||
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "postgresql.fullname" . }})
|
||||
{{ if (include "postgresql.password" . ) }}PGPASSWORD="$POSTGRES_PASSWORD" {{ end }}psql --host $NODE_IP --port $NODE_PORT -U {{ .Values.postgresqlUsername }} -d {{- if .Values.postgresqlDatabase }} {{ .Values.postgresqlDatabase }}{{- else }} postgres{{- end }}
|
||||
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "postgresql.fullname" . }}'
|
||||
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "postgresql.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
{{ if (include "postgresql.password" . ) }}PGPASSWORD="$POSTGRES_PASSWORD" {{ end }}psql --host $SERVICE_IP --port {{ template "postgresql.port" . }} -U {{ .Values.postgresqlUsername }} -d {{- if .Values.postgresqlDatabase }} {{ .Values.postgresqlDatabase }}{{- else }} postgres{{- end }}
|
||||
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
|
||||
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "postgresql.fullname" . }} {{ template "postgresql.port" . }}:{{ template "postgresql.port" . }} &
|
||||
{{ if (include "postgresql.password" . ) }}PGPASSWORD="$POSTGRES_PASSWORD" {{ end }}psql --host 127.0.0.1 -U {{ .Values.postgresqlUsername }} -d {{- if .Values.postgresqlDatabase }} {{ .Values.postgresqlDatabase }}{{- else }} postgres{{- end }} -p {{ template "postgresql.port" . }}
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- include "postgresql.validateValues" . -}}
|
||||
|
||||
{{- include "common.warnings.rollingTag" .Values.image -}}
|
||||
|
||||
{{- $passwordValidationErrors := include "common.validations.values.postgresql.passwords" (dict "secret" (include "postgresql.fullname" .) "context" $) -}}
|
||||
|
||||
{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" (list $passwordValidationErrors) "context" $) -}}
|
|
@ -0,0 +1,501 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "postgresql.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
*/}}
|
||||
{{- define "postgresql.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
*/}}
|
||||
{{- define "postgresql.master.fullname" -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- $fullname := default (printf "%s-%s" .Release.Name $name) .Values.fullnameOverride -}}
|
||||
{{- if .Values.replication.enabled -}}
|
||||
{{- printf "%s-%s" $fullname "master" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" $fullname | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for networkpolicy.
|
||||
*/}}
|
||||
{{- define "postgresql.networkPolicy.apiVersion" -}}
|
||||
{{- if semverCompare ">=1.4-0, <1.7-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
"extensions/v1beta1"
|
||||
{{- else if semverCompare "^1.7-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
"networking.k8s.io/v1"
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "postgresql.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper PostgreSQL image name
|
||||
*/}}
|
||||
{{- define "postgresql.image" -}}
|
||||
{{- $registryName := .Values.image.registry -}}
|
||||
{{- $repositoryName := .Values.image.repository -}}
|
||||
{{- $tag := .Values.image.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return PostgreSQL postgres user password
|
||||
*/}}
|
||||
{{- define "postgresql.postgres.password" -}}
|
||||
{{- if .Values.global.postgresql.postgresqlPostgresPassword }}
|
||||
{{- .Values.global.postgresql.postgresqlPostgresPassword -}}
|
||||
{{- else if .Values.postgresqlPostgresPassword -}}
|
||||
{{- .Values.postgresqlPostgresPassword -}}
|
||||
{{- else -}}
|
||||
{{- randAlphaNum 10 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return PostgreSQL password
|
||||
*/}}
|
||||
{{- define "postgresql.password" -}}
|
||||
{{- if .Values.global.postgresql.postgresqlPassword }}
|
||||
{{- .Values.global.postgresql.postgresqlPassword -}}
|
||||
{{- else if .Values.postgresqlPassword -}}
|
||||
{{- .Values.postgresqlPassword -}}
|
||||
{{- else -}}
|
||||
{{- randAlphaNum 10 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return PostgreSQL replication password
|
||||
*/}}
|
||||
{{- define "postgresql.replication.password" -}}
|
||||
{{- if .Values.global.postgresql.replicationPassword }}
|
||||
{{- .Values.global.postgresql.replicationPassword -}}
|
||||
{{- else if .Values.replication.password -}}
|
||||
{{- .Values.replication.password -}}
|
||||
{{- else -}}
|
||||
{{- randAlphaNum 10 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return PostgreSQL username
|
||||
*/}}
|
||||
{{- define "postgresql.username" -}}
|
||||
{{- if .Values.global.postgresql.postgresqlUsername }}
|
||||
{{- .Values.global.postgresql.postgresqlUsername -}}
|
||||
{{- else -}}
|
||||
{{- .Values.postgresqlUsername -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Return PostgreSQL replication username
|
||||
*/}}
|
||||
{{- define "postgresql.replication.username" -}}
|
||||
{{- if .Values.global.postgresql.replicationUser }}
|
||||
{{- .Values.global.postgresql.replicationUser -}}
|
||||
{{- else -}}
|
||||
{{- .Values.replication.user -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return PostgreSQL port
|
||||
*/}}
|
||||
{{- define "postgresql.port" -}}
|
||||
{{- if .Values.global.postgresql.servicePort }}
|
||||
{{- .Values.global.postgresql.servicePort -}}
|
||||
{{- else -}}
|
||||
{{- .Values.service.port -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return PostgreSQL created database
|
||||
*/}}
|
||||
{{- define "postgresql.database" -}}
|
||||
{{- if .Values.global.postgresql.postgresqlDatabase }}
|
||||
{{- .Values.global.postgresql.postgresqlDatabase -}}
|
||||
{{- else if .Values.postgresqlDatabase -}}
|
||||
{{- .Values.postgresqlDatabase -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper image name to change the volume permissions
|
||||
*/}}
|
||||
{{- define "postgresql.volumePermissions.image" -}}
|
||||
{{- $registryName := .Values.volumePermissions.image.registry -}}
|
||||
{{- $repositoryName := .Values.volumePermissions.image.repository -}}
|
||||
{{- $tag := .Values.volumePermissions.image.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper PostgreSQL metrics image name
|
||||
*/}}
|
||||
{{- define "postgresql.metrics.image" -}}
|
||||
{{- $registryName := default "docker.io" .Values.metrics.image.registry -}}
|
||||
{{- $repositoryName := .Values.metrics.image.repository -}}
|
||||
{{- $tag := default "latest" .Values.metrics.image.tag | toString -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
|
||||
Also, we can't use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the password secret.
|
||||
*/}}
|
||||
{{- define "postgresql.secretName" -}}
|
||||
{{- if .Values.global.postgresql.existingSecret }}
|
||||
{{- printf "%s" (tpl .Values.global.postgresql.existingSecret $) -}}
|
||||
{{- else if .Values.existingSecret -}}
|
||||
{{- printf "%s" (tpl .Values.existingSecret $) -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" (include "postgresql.fullname" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return true if we should use an existingSecret.
|
||||
*/}}
|
||||
{{- define "postgresql.useExistingSecret" -}}
|
||||
{{- if or .Values.global.postgresql.existingSecret .Values.existingSecret -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return true if a secret object should be created
|
||||
*/}}
|
||||
{{- define "postgresql.createSecret" -}}
|
||||
{{- if not (include "postgresql.useExistingSecret" .) -}}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the configuration ConfigMap name.
|
||||
*/}}
|
||||
{{- define "postgresql.configurationCM" -}}
|
||||
{{- if .Values.configurationConfigMap -}}
|
||||
{{- printf "%s" (tpl .Values.configurationConfigMap $) -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-configuration" (include "postgresql.fullname" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the extended configuration ConfigMap name.
|
||||
*/}}
|
||||
{{- define "postgresql.extendedConfigurationCM" -}}
|
||||
{{- if .Values.extendedConfConfigMap -}}
|
||||
{{- printf "%s" (tpl .Values.extendedConfConfigMap $) -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-extended-configuration" (include "postgresql.fullname" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return true if a configmap should be mounted with PostgreSQL configuration
|
||||
*/}}
|
||||
{{- define "postgresql.mountConfigurationCM" -}}
|
||||
{{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap }}
|
||||
{{- true -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the initialization scripts ConfigMap name.
|
||||
*/}}
|
||||
{{- define "postgresql.initdbScriptsCM" -}}
|
||||
{{- if .Values.initdbScriptsConfigMap -}}
|
||||
{{- printf "%s" (tpl .Values.initdbScriptsConfigMap $) -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-init-scripts" (include "postgresql.fullname" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the initialization scripts Secret name.
|
||||
*/}}
|
||||
{{- define "postgresql.initdbScriptsSecret" -}}
|
||||
{{- printf "%s" (tpl .Values.initdbScriptsSecret $) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the metrics ConfigMap name.
|
||||
*/}}
|
||||
{{- define "postgresql.metricsCM" -}}
|
||||
{{- printf "%s-metrics" (include "postgresql.fullname" .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names
|
||||
*/}}
|
||||
{{- define "postgresql.imagePullSecrets" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
|
||||
Also, we can not use a single if because lazy evaluation is not an option
|
||||
*/}}
|
||||
{{- if .Values.global }}
|
||||
{{- if .Values.global.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.global.imagePullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets .Values.volumePermissions.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.metrics.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.volumePermissions.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- else if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets .Values.volumePermissions.image.pullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.metrics.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- range .Values.volumePermissions.image.pullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the readiness probe command
|
||||
*/}}
|
||||
{{- define "postgresql.readinessProbeCommand" -}}
|
||||
- |
|
||||
{{- if (include "postgresql.database" .) }}
|
||||
exec pg_isready -U {{ include "postgresql.username" . | quote }} -d "dbname={{ include "postgresql.database" . }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}{{- end }}" -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||
{{- else }}
|
||||
exec pg_isready -U {{ include "postgresql.username" . | quote }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} -d "sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}"{{- end }} -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||
{{- end }}
|
||||
{{- if contains "bitnami/" .Values.image.repository }}
|
||||
[ -f /opt/bitnami/postgresql/tmp/.initialized ] || [ -f /bitnami/postgresql/.initialized ]
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Storage Class
|
||||
*/}}
|
||||
{{- define "postgresql.storageClass" -}}
|
||||
{{/*
|
||||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
|
||||
but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic.
|
||||
*/}}
|
||||
{{- if .Values.global -}}
|
||||
{{- if .Values.global.storageClass -}}
|
||||
{{- if (eq "-" .Values.global.storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else }}
|
||||
{{- printf "storageClassName: %s" .Values.global.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Values.persistence.storageClass -}}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else }}
|
||||
{{- printf "storageClassName: %s" .Values.persistence.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Values.persistence.storageClass -}}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) -}}
|
||||
{{- printf "storageClassName: \"\"" -}}
|
||||
{{- else }}
|
||||
{{- printf "storageClassName: %s" .Values.persistence.storageClass -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Renders a value that contains template.
|
||||
Usage:
|
||||
{{ include "postgresql.tplValue" ( dict "value" .Values.path.to.the.Value "context" $) }}
|
||||
*/}}
|
||||
{{- define "postgresql.tplValue" -}}
|
||||
{{- if typeIs "string" .value }}
|
||||
{{- tpl .value .context }}
|
||||
{{- else }}
|
||||
{{- tpl (.value | toYaml) .context }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for statefulset.
|
||||
*/}}
|
||||
{{- define "postgresql.statefulset.apiVersion" -}}
|
||||
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "apps/v1beta2" -}}
|
||||
{{- else -}}
|
||||
{{- print "apps/v1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Compile all warnings into a single message, and call fail.
|
||||
*/}}
|
||||
{{- define "postgresql.validateValues" -}}
|
||||
{{- $messages := list -}}
|
||||
{{- $messages := append $messages (include "postgresql.validateValues.ldapConfigurationMethod" .) -}}
|
||||
{{- $messages := append $messages (include "postgresql.validateValues.psp" .) -}}
|
||||
{{- $messages := append $messages (include "postgresql.validateValues.tls" .) -}}
|
||||
{{- $messages := without $messages "" -}}
|
||||
{{- $message := join "\n" $messages -}}
|
||||
|
||||
{{- if $message -}}
|
||||
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate values of Postgresql - If ldap.url is used then you don't need the other settings for ldap
|
||||
*/}}
|
||||
{{- define "postgresql.validateValues.ldapConfigurationMethod" -}}
|
||||
{{- if and .Values.ldap.enabled (and (not (empty .Values.ldap.url)) (not (empty .Values.ldap.server))) }}
|
||||
postgresql: ldap.url, ldap.server
|
||||
You cannot set both `ldap.url` and `ldap.server` at the same time.
|
||||
Please provide a unique way to configure LDAP.
|
||||
More info at https://www.postgresql.org/docs/current/auth-ldap.html
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate values of Postgresql - If PSP is enabled RBAC should be enabled too
|
||||
*/}}
|
||||
{{- define "postgresql.validateValues.psp" -}}
|
||||
{{- if and .Values.psp.create (not .Values.rbac.create) }}
|
||||
postgresql: psp.create, rbac.create
|
||||
RBAC should be enabled if PSP is enabled in order for PSP to work.
|
||||
More info at https://kubernetes.io/docs/concepts/policy/pod-security-policy/#authorizing-policies
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the appropriate apiVersion for podsecuritypolicy.
|
||||
*/}}
|
||||
{{- define "podsecuritypolicy.apiVersion" -}}
|
||||
{{- if semverCompare "<1.10-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "policy/v1beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate values of Postgresql TLS - When TLS is enabled, so must be VolumePermissions
|
||||
*/}}
|
||||
{{- define "postgresql.validateValues.tls" -}}
|
||||
{{- if and .Values.tls.enabled (not .Values.volumePermissions.enabled) }}
|
||||
postgresql: tls.enabled, volumePermissions.enabled
|
||||
When TLS is enabled you must enable volumePermissions as well to ensure certificates files have
|
||||
the right permissions.
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the path to the cert file.
|
||||
*/}}
|
||||
{{- define "postgresql.tlsCert" -}}
|
||||
{{- required "Certificate filename is required when TLS in enabled" .Values.tls.certFilename | printf "/opt/bitnami/postgresql/certs/%s" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the path to the cert key file.
|
||||
*/}}
|
||||
{{- define "postgresql.tlsCertKey" -}}
|
||||
{{- required "Certificate Key filename is required when TLS in enabled" .Values.tls.certKeyFilename | printf "/opt/bitnami/postgresql/certs/%s" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the path to the CA cert file.
|
||||
*/}}
|
||||
{{- define "postgresql.tlsCACert" -}}
|
||||
{{- printf "/opt/bitnami/postgresql/certs/%s" .Values.tls.certCAFilename -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the path to the CRL file.
|
||||
*/}}
|
||||
{{- define "postgresql.tlsCRL" -}}
|
||||
{{- if .Values.tls.crlFilename -}}
|
||||
{{- printf "/opt/bitnami/postgresql/certs/%s" .Values.tls.crlFilename -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -0,0 +1,26 @@
|
|||
{{ if and (or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration) (not .Values.configurationConfigMap) }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}-configuration
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- if (.Files.Glob "files/postgresql.conf") }}
|
||||
{{ (.Files.Glob "files/postgresql.conf").AsConfig | indent 2 }}
|
||||
{{- else if .Values.postgresqlConfiguration }}
|
||||
postgresql.conf: |
|
||||
{{- range $key, $value := default dict .Values.postgresqlConfiguration }}
|
||||
{{ $key | snakecase }}={{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if (.Files.Glob "files/pg_hba.conf") }}
|
||||
{{ (.Files.Glob "files/pg_hba.conf").AsConfig | indent 2 }}
|
||||
{{- else if .Values.pgHbaConfiguration }}
|
||||
pg_hba.conf: |
|
||||
{{ .Values.pgHbaConfiguration | indent 4 }}
|
||||
{{- end }}
|
||||
{{ end }}
|
|
@ -0,0 +1,21 @@
|
|||
{{- if and (or (.Files.Glob "files/conf.d/*.conf") .Values.postgresqlExtendedConf) (not .Values.extendedConfConfigMap)}}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}-extended-configuration
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- with .Files.Glob "files/conf.d/*.conf" }}
|
||||
{{ .AsConfig | indent 2 }}
|
||||
{{- end }}
|
||||
{{ with .Values.postgresqlExtendedConf }}
|
||||
override.conf: |
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key | snakecase }}={{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,24 @@
|
|||
{{- if and (or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScripts) (not .Values.initdbScriptsConfigMap) }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}-init-scripts
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Files.Glob "files/docker-entrypoint-initdb.d/*.sql.gz" }}
|
||||
binaryData:
|
||||
{{- range $path, $bytes := . }}
|
||||
{{ base $path }}: {{ $.Files.Get $path | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- with .Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql}" }}
|
||||
{{ .AsConfig | indent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.initdbScripts }}
|
||||
{{ toYaml . | indent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,13 @@
|
|||
{{- if and .Values.metrics.enabled .Values.metrics.customMetrics }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "postgresql.metricsCM" . }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
custom-metrics.yaml: {{ toYaml .Values.metrics.customMetrics | quote }}
|
||||
{{- end }}
|
|
@ -0,0 +1,25 @@
|
|||
{{- if .Values.metrics.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}-metrics
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
annotations:
|
||||
{{- if .Values.commonAnnotations }}
|
||||
{{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- toYaml .Values.metrics.service.annotations | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.metrics.service.type }}
|
||||
{{- if and (eq .Values.metrics.service.type "LoadBalancer") .Values.metrics.service.loadBalancerIP }}
|
||||
loadBalancerIP: {{ .Values.metrics.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http-metrics
|
||||
port: 9187
|
||||
targetPort: http-metrics
|
||||
selector:
|
||||
{{- include "common.labels.matchLabels" . | nindent 4 }}
|
||||
role: master
|
||||
{{- end }}
|
|
@ -0,0 +1,36 @@
|
|||
{{- if .Values.networkPolicy.enabled }}
|
||||
kind: NetworkPolicy
|
||||
apiVersion: {{ template "postgresql.networkPolicy.apiVersion" . }}
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
{{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
ingress:
|
||||
# Allow inbound connections
|
||||
- ports:
|
||||
- port: {{ template "postgresql.port" . }}
|
||||
{{- if not .Values.networkPolicy.allowExternal }}
|
||||
from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
{{ template "postgresql.fullname" . }}-client: "true"
|
||||
{{- if .Values.networkPolicy.explicitNamespacesSelector }}
|
||||
namespaceSelector:
|
||||
{{ toYaml .Values.networkPolicy.explicitNamespacesSelector | indent 12 }}
|
||||
{{- end }}
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
{{- include "common.labels.matchLabels" . | nindent 14 }}
|
||||
role: slave
|
||||
{{- end }}
|
||||
# Allow prometheus scrapes
|
||||
- ports:
|
||||
- port: 9187
|
||||
{{- end }}
|
|
@ -0,0 +1,37 @@
|
|||
{{- if .Values.psp.create }}
|
||||
apiVersion: {{ include "podsecuritypolicy.apiVersion" . }}
|
||||
kind: PodSecurityPolicy
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
privileged: false
|
||||
volumes:
|
||||
- 'configMap'
|
||||
- 'secret'
|
||||
- 'persistentVolumeClaim'
|
||||
- 'emptyDir'
|
||||
- 'projected'
|
||||
hostNetwork: false
|
||||
hostIPC: false
|
||||
hostPID: false
|
||||
runAsUser:
|
||||
rule: 'MustRunAsNonRoot'
|
||||
seLinux:
|
||||
rule: 'RunAsAny'
|
||||
supplementalGroups:
|
||||
rule: 'MustRunAs'
|
||||
ranges:
|
||||
- min: 1
|
||||
max: 65535
|
||||
fsGroup:
|
||||
rule: 'MustRunAs'
|
||||
ranges:
|
||||
- min: 1
|
||||
max: 65535
|
||||
readOnlyRootFilesystem: false
|
||||
{{- end }}
|
|
@ -0,0 +1,23 @@
|
|||
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
{{- with .Values.metrics.prometheusRule.namespace }}
|
||||
namespace: {{ . }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- with .Values.metrics.prometheusRule.additionalLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.metrics.prometheusRule.rules }}
|
||||
groups:
|
||||
- name: {{ template "postgresql.name" $ }}
|
||||
rules: {{ tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,19 @@
|
|||
{{- if .Values.rbac.create }}
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- if .Values.psp.create }}
|
||||
- apiGroups: ["extensions"]
|
||||
resources: ["podsecuritypolicies"]
|
||||
verbs: ["use"]
|
||||
resourceNames:
|
||||
- {{ template "postgresql.fullname" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,19 @@
|
|||
{{- if .Values.rbac.create }}
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ default (include "postgresql.fullname" . ) .Values.serviceAccount.name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
|
@ -0,0 +1,23 @@
|
|||
{{- if (include "postgresql.createSecret" .) }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
type: Opaque
|
||||
data:
|
||||
{{- if and .Values.postgresqlPostgresPassword (not (eq .Values.postgresqlUsername "postgres")) }}
|
||||
postgresql-postgres-password: {{ include "postgresql.postgres.password" . | b64enc | quote }}
|
||||
{{- end }}
|
||||
postgresql-password: {{ include "postgresql.password" . | b64enc | quote }}
|
||||
{{- if .Values.replication.enabled }}
|
||||
postgresql-replication-password: {{ include "postgresql.replication.password" . | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- if (and .Values.ldap.enabled .Values.ldap.bind_password)}}
|
||||
postgresql-ldap-password: {{ .Values.ldap.bind_password | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
|
@ -0,0 +1,11 @@
|
|||
{{- if and (.Values.serviceAccount.enabled) (not .Values.serviceAccount.name) }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,33 @@
|
|||
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ include "postgresql.fullname" . }}
|
||||
{{- if .Values.metrics.serviceMonitor.namespace }}
|
||||
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.metrics.serviceMonitor.additionalLabels }}
|
||||
{{- toYaml .Values.metrics.serviceMonitor.additionalLabels | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
spec:
|
||||
endpoints:
|
||||
- port: http-metrics
|
||||
{{- if .Values.metrics.serviceMonitor.interval }}
|
||||
interval: {{ .Values.metrics.serviceMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
{{- end }}
|
|
@ -0,0 +1,345 @@
|
|||
{{- if .Values.replication.enabled }}
|
||||
apiVersion: {{ template "postgresql.statefulset.apiVersion" . }}
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: "{{ template "postgresql.fullname" . }}-slave"
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- with .Values.slave.labels }}
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if .Values.commonAnnotations }}
|
||||
{{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.slave.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
serviceName: {{ template "postgresql.fullname" . }}-headless
|
||||
replicas: {{ .Values.replication.slaveReplicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
role: slave
|
||||
template:
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 8 }}
|
||||
role: slave
|
||||
{{- with .Values.slave.podLabels }}
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.slave.podAnnotations }}
|
||||
annotations:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.schedulerName }}
|
||||
schedulerName: "{{ .Values.schedulerName }}"
|
||||
{{- end }}
|
||||
{{- include "postgresql.imagePullSecrets" . | indent 6 }}
|
||||
{{- if .Values.slave.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.slave.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.slave.affinity }}
|
||||
affinity:
|
||||
{{ toYaml .Values.slave.affinity | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.slave.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml .Values.slave.tolerations | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.terminationGracePeriodSeconds }}
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
fsGroup: {{ .Values.securityContext.fsGroup }}
|
||||
{{- end }}
|
||||
{{- if .Values.serviceAccount.enabled }}
|
||||
serviceAccountName: {{ default (include "postgresql.fullname" . ) .Values.serviceAccount.name}}
|
||||
{{- end }}
|
||||
{{- if or .Values.slave.extraInitContainers (and .Values.volumePermissions.enabled (or .Values.persistence.enabled (and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled))) }}
|
||||
initContainers:
|
||||
{{- if and .Values.volumePermissions.enabled (or .Values.persistence.enabled (and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled) .Values.tls.enabled) }}
|
||||
- name: init-chmod-data
|
||||
image: {{ template "postgresql.volumePermissions.image" . }}
|
||||
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
||||
{{- if .Values.resources }}
|
||||
resources: {{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
command:
|
||||
- /bin/sh
|
||||
- -cx
|
||||
- |
|
||||
{{- if .Values.persistence.enabled }}
|
||||
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||
chown `id -u`:`id -G | cut -d " " -f2` {{ .Values.persistence.mountPath }}
|
||||
{{- else }}
|
||||
chown {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} {{ .Values.persistence.mountPath }}
|
||||
{{- end }}
|
||||
mkdir -p {{ .Values.persistence.mountPath }}/data {{- if (include "postgresql.mountConfigurationCM" .) }} {{ .Values.persistence.mountPath }}/conf {{- end }}
|
||||
chmod 700 {{ .Values.persistence.mountPath }}/data {{- if (include "postgresql.mountConfigurationCM" .) }} {{ .Values.persistence.mountPath }}/conf {{- end }}
|
||||
find {{ .Values.persistence.mountPath }} -mindepth 1 -maxdepth 1 {{- if not (include "postgresql.mountConfigurationCM" .) }} -not -name "conf" {{- end }} -not -name ".snapshot" -not -name "lost+found" | \
|
||||
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||
xargs chown -R `id -u`:`id -G | cut -d " " -f2`
|
||||
{{- else }}
|
||||
xargs chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled }}
|
||||
chmod -R 777 /dev/shm
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
cp /tmp/certs/* /opt/bitnami/postgresql/certs/
|
||||
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||
chown -R `id -u`:`id -G | cut -d " " -f2` /opt/bitnami/postgresql/certs/
|
||||
{{- else }}
|
||||
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /opt/bitnami/postgresql/certs/
|
||||
{{- end }}
|
||||
chmod 600 {{ template "postgresql.tlsCertKey" . }}
|
||||
{{- end }}
|
||||
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||
securityContext:
|
||||
{{- else }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.volumePermissions.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{ if .Values.persistence.enabled }}
|
||||
- name: data
|
||||
mountPath: {{ .Values.persistence.mountPath }}
|
||||
subPath: {{ .Values.persistence.subPath }}
|
||||
{{- end }}
|
||||
{{- if .Values.shmVolume.enabled }}
|
||||
- name: dshm
|
||||
mountPath: /dev/shm
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: raw-certificates
|
||||
mountPath: /tmp/certs
|
||||
- name: postgresql-certificates
|
||||
mountPath: /opt/bitnami/postgresql/certs
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.slave.extraInitContainers }}
|
||||
{{ tpl .Values.slave.extraInitContainers . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.slave.priorityClassName }}
|
||||
priorityClassName: {{ .Values.slave.priorityClassName }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ template "postgresql.fullname" . }}
|
||||
image: {{ template "postgresql.image" . }}
|
||||
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
|
||||
{{- if .Values.resources }}
|
||||
resources: {{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" .Values.image.debug | quote }}
|
||||
- name: POSTGRESQL_VOLUME_DIR
|
||||
value: "{{ .Values.persistence.mountPath }}"
|
||||
- name: POSTGRESQL_PORT_NUMBER
|
||||
value: "{{ template "postgresql.port" . }}"
|
||||
{{- if .Values.persistence.mountPath }}
|
||||
- name: PGDATA
|
||||
value: {{ .Values.postgresqlDataDir | quote }}
|
||||
{{- end }}
|
||||
- name: POSTGRES_REPLICATION_MODE
|
||||
value: "slave"
|
||||
- name: POSTGRES_REPLICATION_USER
|
||||
value: {{ include "postgresql.replication.username" . | quote }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: POSTGRES_REPLICATION_PASSWORD_FILE
|
||||
value: "/opt/bitnami/postgresql/secrets/postgresql-replication-password"
|
||||
{{- else }}
|
||||
- name: POSTGRES_REPLICATION_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: postgresql-replication-password
|
||||
{{- end }}
|
||||
- name: POSTGRES_CLUSTER_APP_NAME
|
||||
value: {{ .Values.replication.applicationName }}
|
||||
- name: POSTGRES_MASTER_HOST
|
||||
value: {{ template "postgresql.fullname" . }}
|
||||
- name: POSTGRES_MASTER_PORT_NUMBER
|
||||
value: {{ include "postgresql.port" . | quote }}
|
||||
{{- if and (not (eq .Values.postgresqlUsername "postgres")) (or .Values.postgresqlPostgresPassword (include "postgresql.useExistingSecret" .)) }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: POSTGRES_POSTGRES_PASSWORD_FILE
|
||||
value: "/opt/bitnami/postgresql/secrets/postgresql-postgres-password"
|
||||
{{- else }}
|
||||
- name: POSTGRES_POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: postgresql-postgres-password
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: POSTGRES_PASSWORD_FILE
|
||||
value: "/opt/bitnami/postgresql/secrets/postgresql-password"
|
||||
{{- else }}
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
- name: POSTGRESQL_ENABLE_TLS
|
||||
value: {{ ternary "yes" "no" .Values.tls.enabled | quote }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: POSTGRESQL_TLS_PREFER_SERVER_CIPHERS
|
||||
value: {{ ternary "yes" "no" .Values.tls.preferServerCiphers | quote }}
|
||||
- name: POSTGRESQL_TLS_CERT_FILE
|
||||
value: {{ template "postgresql.tlsCert" . }}
|
||||
- name: POSTGRESQL_TLS_KEY_FILE
|
||||
value: {{ template "postgresql.tlsCertKey" . }}
|
||||
{{- if .Values.tls.certCAFilename }}
|
||||
- name: POSTGRESQL_TLS_CA_FILE
|
||||
value: {{ template "postgresql.tlsCACert" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.crlFilename }}
|
||||
- name: POSTGRESQL_TLS_CRL_FILE
|
||||
value: {{ template "postgresql.tlsCRL" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: tcp-postgresql
|
||||
containerPort: {{ template "postgresql.port" . }}
|
||||
{{- if .Values.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
{{- if (include "postgresql.database" .) }}
|
||||
- exec pg_isready -U {{ include "postgresql.username" . | quote }} -d "dbname={{ include "postgresql.database" . }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}{{- end }}" -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||
{{- else }}
|
||||
- exec pg_isready -U {{ include "postgresql.username" . | quote }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} -d "sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}"{{- end }} -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||
{{- end }}
|
||||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- -e
|
||||
{{- include "postgresql.readinessProbeCommand" . | nindent 16 }}
|
||||
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: postgresql-password
|
||||
mountPath: /opt/bitnami/postgresql/secrets/
|
||||
{{- end }}
|
||||
{{- if .Values.shmVolume.enabled }}
|
||||
- name: dshm
|
||||
mountPath: /dev/shm
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.enabled }}
|
||||
- name: data
|
||||
mountPath: {{ .Values.persistence.mountPath }}
|
||||
subPath: {{ .Values.persistence.subPath }}
|
||||
{{ end }}
|
||||
{{- if or (.Files.Glob "files/conf.d/*.conf") .Values.postgresqlExtendedConf .Values.extendedConfConfigMap }}
|
||||
- name: postgresql-extended-config
|
||||
mountPath: /bitnami/postgresql/conf/conf.d/
|
||||
{{- end }}
|
||||
{{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap }}
|
||||
- name: postgresql-config
|
||||
mountPath: /bitnami/postgresql/conf
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: postgresql-certificates
|
||||
mountPath: /opt/bitnami/postgresql/certs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.slave.extraVolumeMounts }}
|
||||
{{- toYaml .Values.slave.extraVolumeMounts | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.slave.sidecars }}
|
||||
{{- include "postgresql.tplValue" ( dict "value" .Values.slave.sidecars "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: postgresql-password
|
||||
secret:
|
||||
secretName: {{ template "postgresql.secretName" . }}
|
||||
{{- end }}
|
||||
{{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap}}
|
||||
- name: postgresql-config
|
||||
configMap:
|
||||
name: {{ template "postgresql.configurationCM" . }}
|
||||
{{- end }}
|
||||
{{- if or (.Files.Glob "files/conf.d/*.conf") .Values.postgresqlExtendedConf .Values.extendedConfConfigMap }}
|
||||
- name: postgresql-extended-config
|
||||
configMap:
|
||||
name: {{ template "postgresql.extendedConfigurationCM" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: raw-certificates
|
||||
secret:
|
||||
secretName: {{ required "A secret containing TLS certificates is required when TLS is enabled" .Values.tls.certificatesSecret }}
|
||||
- name: postgresql-certificates
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.shmVolume.enabled }}
|
||||
- name: dshm
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
{{- end }}
|
||||
{{- if or (not .Values.persistence.enabled) (not .Values.slave.persistence.enabled) }}
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.slave.extraVolumes }}
|
||||
{{- toYaml .Values.slave.extraVolumes | nindent 8 }}
|
||||
{{- end }}
|
||||
updateStrategy:
|
||||
type: {{ .Values.updateStrategy.type }}
|
||||
{{- if (eq "Recreate" .Values.updateStrategy.type) }}
|
||||
rollingUpdate: null
|
||||
{{- end }}
|
||||
{{- if and .Values.persistence.enabled .Values.slave.persistence.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
{{- with .Values.persistence.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{ include "postgresql.storageClass" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,514 @@
|
|||
apiVersion: {{ template "postgresql.statefulset.apiVersion" . }}
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ template "postgresql.master.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- with .Values.master.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
{{- if .Values.commonAnnotations }}
|
||||
{{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.master.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
serviceName: {{ template "postgresql.fullname" . }}-headless
|
||||
replicas: 1
|
||||
updateStrategy:
|
||||
type: {{ .Values.updateStrategy.type }}
|
||||
{{- if (eq "Recreate" .Values.updateStrategy.type) }}
|
||||
rollingUpdate: null
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
role: master
|
||||
template:
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 8 }}
|
||||
role: master
|
||||
{{- with .Values.master.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.master.podAnnotations }}
|
||||
annotations: {{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.schedulerName }}
|
||||
schedulerName: "{{ .Values.schedulerName }}"
|
||||
{{- end }}
|
||||
{{- include "postgresql.imagePullSecrets" . | indent 6 }}
|
||||
{{- if .Values.master.nodeSelector }}
|
||||
nodeSelector: {{- toYaml .Values.master.nodeSelector | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.master.affinity }}
|
||||
affinity: {{- toYaml .Values.master.affinity | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.master.tolerations }}
|
||||
tolerations: {{- toYaml .Values.master.tolerations | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.terminationGracePeriodSeconds }}
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
fsGroup: {{ .Values.securityContext.fsGroup }}
|
||||
{{- end }}
|
||||
{{- if .Values.serviceAccount.enabled }}
|
||||
serviceAccountName: {{ default (include "postgresql.fullname" . ) .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- if or .Values.master.extraInitContainers (and .Values.volumePermissions.enabled (or .Values.persistence.enabled (and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled))) }}
|
||||
initContainers:
|
||||
{{- if and .Values.volumePermissions.enabled (or .Values.persistence.enabled (and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled) .Values.tls.enabled) }}
|
||||
- name: init-chmod-data
|
||||
image: {{ template "postgresql.volumePermissions.image" . }}
|
||||
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
||||
{{- if .Values.resources }}
|
||||
resources: {{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
command:
|
||||
- /bin/sh
|
||||
- -cx
|
||||
- |
|
||||
{{- if .Values.persistence.enabled }}
|
||||
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||
chown `id -u`:`id -G | cut -d " " -f2` {{ .Values.persistence.mountPath }}
|
||||
{{- else }}
|
||||
chown {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} {{ .Values.persistence.mountPath }}
|
||||
{{- end }}
|
||||
mkdir -p {{ .Values.persistence.mountPath }}/data {{- if (include "postgresql.mountConfigurationCM" .) }} {{ .Values.persistence.mountPath }}/conf {{- end }}
|
||||
chmod 700 {{ .Values.persistence.mountPath }}/data {{- if (include "postgresql.mountConfigurationCM" .) }} {{ .Values.persistence.mountPath }}/conf {{- end }}
|
||||
find {{ .Values.persistence.mountPath }} -mindepth 1 -maxdepth 1 {{- if not (include "postgresql.mountConfigurationCM" .) }} -not -name "conf" {{- end }} -not -name ".snapshot" -not -name "lost+found" | \
|
||||
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||
xargs chown -R `id -u`:`id -G | cut -d " " -f2`
|
||||
{{- else }}
|
||||
xargs chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and .Values.shmVolume.enabled .Values.shmVolume.chmod.enabled }}
|
||||
chmod -R 777 /dev/shm
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
cp /tmp/certs/* /opt/bitnami/postgresql/certs/
|
||||
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||
chown -R `id -u`:`id -G | cut -d " " -f2` /opt/bitnami/postgresql/certs/
|
||||
{{- else }}
|
||||
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /opt/bitnami/postgresql/certs/
|
||||
{{- end }}
|
||||
chmod 600 {{ template "postgresql.tlsCertKey" . }}
|
||||
{{- end }}
|
||||
{{- if eq ( toString ( .Values.volumePermissions.securityContext.runAsUser )) "auto" }}
|
||||
securityContext:
|
||||
{{- else }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.volumePermissions.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.persistence.enabled }}
|
||||
- name: data
|
||||
mountPath: {{ .Values.persistence.mountPath }}
|
||||
subPath: {{ .Values.persistence.subPath }}
|
||||
{{- end }}
|
||||
{{- if .Values.shmVolume.enabled }}
|
||||
- name: dshm
|
||||
mountPath: /dev/shm
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: raw-certificates
|
||||
mountPath: /tmp/certs
|
||||
- name: postgresql-certificates
|
||||
mountPath: /opt/bitnami/postgresql/certs
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.master.extraInitContainers }}
|
||||
{{- include "postgresql.tplValue" ( dict "value" .Values.master.extraInitContainers "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.master.priorityClassName }}
|
||||
priorityClassName: {{ .Values.master.priorityClassName }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ template "postgresql.fullname" . }}
|
||||
image: {{ template "postgresql.image" . }}
|
||||
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
|
||||
{{- if .Values.resources }}
|
||||
resources: {{- toYaml .Values.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" .Values.image.debug | quote }}
|
||||
- name: POSTGRESQL_PORT_NUMBER
|
||||
value: "{{ template "postgresql.port" . }}"
|
||||
- name: POSTGRESQL_VOLUME_DIR
|
||||
value: "{{ .Values.persistence.mountPath }}"
|
||||
{{- if .Values.postgresqlInitdbArgs }}
|
||||
- name: POSTGRES_INITDB_ARGS
|
||||
value: {{ .Values.postgresqlInitdbArgs | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.postgresqlInitdbWalDir }}
|
||||
- name: POSTGRES_INITDB_WALDIR
|
||||
value: {{ .Values.postgresqlInitdbWalDir | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.initdbUser }}
|
||||
- name: POSTGRESQL_INITSCRIPTS_USERNAME
|
||||
value: {{ .Values.initdbUser }}
|
||||
{{- end }}
|
||||
{{- if .Values.initdbPassword }}
|
||||
- name: POSTGRESQL_INITSCRIPTS_PASSWORD
|
||||
value: {{ .Values.initdbPassword }}
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.mountPath }}
|
||||
- name: PGDATA
|
||||
value: {{ .Values.postgresqlDataDir | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.replication.enabled }}
|
||||
- name: POSTGRES_REPLICATION_MODE
|
||||
value: "master"
|
||||
- name: POSTGRES_REPLICATION_USER
|
||||
value: {{ include "postgresql.replication.username" . | quote }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: POSTGRES_REPLICATION_PASSWORD_FILE
|
||||
value: "/opt/bitnami/postgresql/secrets/postgresql-replication-password"
|
||||
{{- else }}
|
||||
- name: POSTGRES_REPLICATION_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: postgresql-replication-password
|
||||
{{- end }}
|
||||
{{- if not (eq .Values.replication.synchronousCommit "off")}}
|
||||
- name: POSTGRES_SYNCHRONOUS_COMMIT_MODE
|
||||
value: {{ .Values.replication.synchronousCommit | quote }}
|
||||
- name: POSTGRES_NUM_SYNCHRONOUS_REPLICAS
|
||||
value: {{ .Values.replication.numSynchronousReplicas | quote }}
|
||||
{{- end }}
|
||||
- name: POSTGRES_CLUSTER_APP_NAME
|
||||
value: {{ .Values.replication.applicationName }}
|
||||
{{- end }}
|
||||
{{- if and (not (eq .Values.postgresqlUsername "postgres")) (or .Values.postgresqlPostgresPassword (include "postgresql.useExistingSecret" .)) }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: POSTGRES_POSTGRES_PASSWORD_FILE
|
||||
value: "/opt/bitnami/postgresql/secrets/postgresql-postgres-password"
|
||||
{{- else }}
|
||||
- name: POSTGRES_POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: postgresql-postgres-password
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: POSTGRES_USER
|
||||
value: {{ include "postgresql.username" . | quote }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: POSTGRES_PASSWORD_FILE
|
||||
value: "/opt/bitnami/postgresql/secrets/postgresql-password"
|
||||
{{- else }}
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
{{- if (include "postgresql.database" .) }}
|
||||
- name: POSTGRES_DB
|
||||
value: {{ (include "postgresql.database" .) | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraEnv }}
|
||||
{{- include "postgresql.tplValue" (dict "value" .Values.extraEnv "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
- name: POSTGRESQL_ENABLE_LDAP
|
||||
value: {{ ternary "yes" "no" .Values.ldap.enabled | quote }}
|
||||
{{- if .Values.ldap.enabled }}
|
||||
- name: POSTGRESQL_LDAP_SERVER
|
||||
value: {{ .Values.ldap.server }}
|
||||
- name: POSTGRESQL_LDAP_PORT
|
||||
value: {{ .Values.ldap.port | quote }}
|
||||
- name: POSTGRESQL_LDAP_SCHEME
|
||||
value: {{ .Values.ldap.scheme }}
|
||||
{{- if .Values.ldap.tls }}
|
||||
- name: POSTGRESQL_LDAP_TLS
|
||||
value: "1"
|
||||
{{- end}}
|
||||
- name: POSTGRESQL_LDAP_PREFIX
|
||||
value: {{ .Values.ldap.prefix | quote }}
|
||||
- name: POSTGRESQL_LDAP_SUFFIX
|
||||
value: {{ .Values.ldap.suffix | quote}}
|
||||
- name: POSTGRESQL_LDAP_BASE_DN
|
||||
value: {{ .Values.ldap.baseDN }}
|
||||
- name: POSTGRESQL_LDAP_BIND_DN
|
||||
value: {{ .Values.ldap.bindDN }}
|
||||
{{- if (not (empty .Values.ldap.bind_password)) }}
|
||||
- name: POSTGRESQL_LDAP_BIND_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: postgresql-ldap-password
|
||||
{{- end}}
|
||||
- name: POSTGRESQL_LDAP_SEARCH_ATTR
|
||||
value: {{ .Values.ldap.search_attr }}
|
||||
- name: POSTGRESQL_LDAP_SEARCH_FILTER
|
||||
value: {{ .Values.ldap.search_filter }}
|
||||
- name: POSTGRESQL_LDAP_URL
|
||||
value: {{ .Values.ldap.url }}
|
||||
{{- end}}
|
||||
- name: POSTGRESQL_ENABLE_TLS
|
||||
value: {{ ternary "yes" "no" .Values.tls.enabled | quote }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: POSTGRESQL_TLS_PREFER_SERVER_CIPHERS
|
||||
value: {{ ternary "yes" "no" .Values.tls.preferServerCiphers | quote }}
|
||||
- name: POSTGRESQL_TLS_CERT_FILE
|
||||
value: {{ template "postgresql.tlsCert" . }}
|
||||
- name: POSTGRESQL_TLS_KEY_FILE
|
||||
value: {{ template "postgresql.tlsCertKey" . }}
|
||||
{{- if .Values.tls.certCAFilename }}
|
||||
- name: POSTGRESQL_TLS_CA_FILE
|
||||
value: {{ template "postgresql.tlsCACert" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.crlFilename }}
|
||||
- name: POSTGRESQL_TLS_CRL_FILE
|
||||
value: {{ template "postgresql.tlsCRL" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraEnvVarsCM }}
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ tpl .Values.extraEnvVarsCM . }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: tcp-postgresql
|
||||
containerPort: {{ template "postgresql.port" . }}
|
||||
{{- if .Values.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
{{- if (include "postgresql.database" .) }}
|
||||
- exec pg_isready -U {{ include "postgresql.username" . | quote }} -d "dbname={{ include "postgresql.database" . }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}{{- end }}" -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||
{{- else }}
|
||||
- exec pg_isready -U {{ include "postgresql.username" . | quote }} {{- if and .Values.tls.enabled .Values.tls.certCAFilename }} -d "sslcert={{ include "postgresql.tlsCert" . }} sslkey={{ include "postgresql.tlsCertKey" . }}"{{- end }} -h 127.0.0.1 -p {{ template "postgresql.port" . }}
|
||||
{{- end }}
|
||||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- -e
|
||||
{{- include "postgresql.readinessProbeCommand" . | nindent 16 }}
|
||||
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScriptsConfigMap .Values.initdbScripts }}
|
||||
- name: custom-init-scripts
|
||||
mountPath: /docker-entrypoint-initdb.d/
|
||||
{{- end }}
|
||||
{{- if .Values.initdbScriptsSecret }}
|
||||
- name: custom-init-scripts-secret
|
||||
mountPath: /docker-entrypoint-initdb.d/secret
|
||||
{{- end }}
|
||||
{{- if or (.Files.Glob "files/conf.d/*.conf") .Values.postgresqlExtendedConf .Values.extendedConfConfigMap }}
|
||||
- name: postgresql-extended-config
|
||||
mountPath: /bitnami/postgresql/conf/conf.d/
|
||||
{{- end }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: postgresql-password
|
||||
mountPath: /opt/bitnami/postgresql/secrets/
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: postgresql-certificates
|
||||
mountPath: /opt/bitnami/postgresql/certs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.shmVolume.enabled }}
|
||||
- name: dshm
|
||||
mountPath: /dev/shm
|
||||
{{- end }}
|
||||
{{- if .Values.persistence.enabled }}
|
||||
- name: data
|
||||
mountPath: {{ .Values.persistence.mountPath }}
|
||||
subPath: {{ .Values.persistence.subPath }}
|
||||
{{- end }}
|
||||
{{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap }}
|
||||
- name: postgresql-config
|
||||
mountPath: /bitnami/postgresql/conf
|
||||
{{- end }}
|
||||
{{- if .Values.master.extraVolumeMounts }}
|
||||
{{- toYaml .Values.master.extraVolumeMounts | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.master.sidecars }}
|
||||
{{- include "postgresql.tplValue" ( dict "value" .Values.master.sidecars "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
image: {{ template "postgresql.metrics.image" . }}
|
||||
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
|
||||
{{- if .Values.metrics.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.metrics.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- $database := required "In order to enable metrics you need to specify a database (.Values.postgresqlDatabase or .Values.global.postgresql.postgresqlDatabase)" (include "postgresql.database" .) }}
|
||||
{{- $sslmode := ternary "require" "disable" .Values.tls.enabled }}
|
||||
{{- if and .Values.tls.enabled .Values.tls.certCAFilename }}
|
||||
- name: DATA_SOURCE_NAME
|
||||
value: {{ printf "host=127.0.0.1 port=%d user=%s sslmode=%s sslcert=%s sslkey=%s" (int (include "postgresql.port" .)) (include "postgresql.username" .) $sslmode (include "postgresql.tlsCert" .) (include "postgresql.tlsCertKey" .) }}
|
||||
{{- else }}
|
||||
- name: DATA_SOURCE_URI
|
||||
value: {{ printf "127.0.0.1:%d/%s?sslmode=%s" (int (include "postgresql.port" .)) $database $sslmode }}
|
||||
{{- end }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: DATA_SOURCE_PASS_FILE
|
||||
value: "/opt/bitnami/postgresql/secrets/postgresql-password"
|
||||
{{- else }}
|
||||
- name: DATA_SOURCE_PASS
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "postgresql.secretName" . }}
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
- name: DATA_SOURCE_USER
|
||||
value: {{ template "postgresql.username" . }}
|
||||
{{- if .Values.metrics.extraEnvVars }}
|
||||
{{- include "postgresql.tplValue" (dict "value" .Values.metrics.extraEnvVars "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http-metrics
|
||||
initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http-metrics
|
||||
initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: postgresql-password
|
||||
mountPath: /opt/bitnami/postgresql/secrets/
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: postgresql-certificates
|
||||
mountPath: /opt/bitnami/postgresql/certs
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.customMetrics }}
|
||||
- name: custom-metrics
|
||||
mountPath: /conf
|
||||
readOnly: true
|
||||
args: ["--extend.query-path", "/conf/custom-metrics.yaml"]
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: http-metrics
|
||||
containerPort: 9187
|
||||
{{- if .Values.metrics.resources }}
|
||||
resources: {{- toYaml .Values.metrics.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if or (.Files.Glob "files/postgresql.conf") (.Files.Glob "files/pg_hba.conf") .Values.postgresqlConfiguration .Values.pgHbaConfiguration .Values.configurationConfigMap}}
|
||||
- name: postgresql-config
|
||||
configMap:
|
||||
name: {{ template "postgresql.configurationCM" . }}
|
||||
{{- end }}
|
||||
{{- if or (.Files.Glob "files/conf.d/*.conf") .Values.postgresqlExtendedConf .Values.extendedConfConfigMap }}
|
||||
- name: postgresql-extended-config
|
||||
configMap:
|
||||
name: {{ template "postgresql.extendedConfigurationCM" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: postgresql-password
|
||||
secret:
|
||||
secretName: {{ template "postgresql.secretName" . }}
|
||||
{{- end }}
|
||||
{{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScriptsConfigMap .Values.initdbScripts }}
|
||||
- name: custom-init-scripts
|
||||
configMap:
|
||||
name: {{ template "postgresql.initdbScriptsCM" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.initdbScriptsSecret }}
|
||||
- name: custom-init-scripts-secret
|
||||
secret:
|
||||
secretName: {{ template "postgresql.initdbScriptsSecret" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.tls.enabled }}
|
||||
- name: raw-certificates
|
||||
secret:
|
||||
secretName: {{ required "A secret containing TLS certificates is required when TLS is enabled" .Values.tls.certificatesSecret }}
|
||||
- name: postgresql-certificates
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.master.extraVolumes }}
|
||||
{{- toYaml .Values.master.extraVolumes | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.customMetrics }}
|
||||
- name: custom-metrics
|
||||
configMap:
|
||||
name: {{ template "postgresql.metricsCM" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.shmVolume.enabled }}
|
||||
- name: dshm
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
{{- end }}
|
||||
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
{{- with .Values.persistence.existingClaim }}
|
||||
claimName: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- else if not .Values.persistence.enabled }}
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
{{- else if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
{{- with .Values.persistence.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := . }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{ include "postgresql.storageClass" . }}
|
||||
{{- end }}
|
|
@ -0,0 +1,18 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}-headless
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
{{- if .Values.commonAnnotations }}
|
||||
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
ports:
|
||||
- name: tcp-postgresql
|
||||
port: {{ template "postgresql.port" . }}
|
||||
targetPort: tcp-postgresql
|
||||
selector:
|
||||
{{- include "common.labels.matchLabels" . | nindent 4 }}
|
|
@ -0,0 +1,42 @@
|
|||
{{- if .Values.replication.enabled }}
|
||||
{{- $serviceAnnotations := coalesce .Values.slave.service.annotations .Values.service.annotations -}}
|
||||
{{- $serviceType := coalesce .Values.slave.service.type .Values.service.type -}}
|
||||
{{- $serviceLoadBalancerIP := coalesce .Values.slave.service.loadBalancerIP .Values.service.loadBalancerIP -}}
|
||||
{{- $serviceLoadBalancerSourceRanges := coalesce .Values.slave.service.loadBalancerSourceRanges .Values.service.loadBalancerSourceRanges -}}
|
||||
{{- $serviceClusterIP := coalesce .Values.slave.service.clusterIP .Values.service.clusterIP -}}
|
||||
{{- $serviceNodePort := coalesce .Values.slave.service.nodePort .Values.service.nodePort -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}-read
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
annotations:
|
||||
{{- if .Values.commonAnnotations }}
|
||||
{{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $serviceAnnotations }}
|
||||
{{- include "postgresql.tplValue" (dict "value" $serviceAnnotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ $serviceType }}
|
||||
{{- if and $serviceLoadBalancerIP (eq $serviceType "LoadBalancer") }}
|
||||
loadBalancerIP: {{ $serviceLoadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if and (eq $serviceType "LoadBalancer") $serviceLoadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges: {{- include "postgresql.tplValue" (dict "value" $serviceLoadBalancerSourceRanges "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if and (eq $serviceType "ClusterIP") $serviceClusterIP }}
|
||||
clusterIP: {{ $serviceClusterIP }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: tcp-postgresql
|
||||
port: {{ template "postgresql.port" . }}
|
||||
targetPort: tcp-postgresql
|
||||
{{- if $serviceNodePort }}
|
||||
nodePort: {{ $serviceNodePort }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "common.labels.matchLabels" . | nindent 4 }}
|
||||
role: slave
|
||||
{{- end }}
|
|
@ -0,0 +1,40 @@
|
|||
{{- $serviceAnnotations := coalesce .Values.master.service.annotations .Values.service.annotations -}}
|
||||
{{- $serviceType := coalesce .Values.master.service.type .Values.service.type -}}
|
||||
{{- $serviceLoadBalancerIP := coalesce .Values.master.service.loadBalancerIP .Values.service.loadBalancerIP -}}
|
||||
{{- $serviceLoadBalancerSourceRanges := coalesce .Values.master.service.loadBalancerSourceRanges .Values.service.loadBalancerSourceRanges -}}
|
||||
{{- $serviceClusterIP := coalesce .Values.master.service.clusterIP .Values.service.clusterIP -}}
|
||||
{{- $serviceNodePort := coalesce .Values.master.service.nodePort .Values.service.nodePort -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" . | nindent 4 }}
|
||||
annotations:
|
||||
{{- if .Values.commonAnnotations }}
|
||||
{{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if $serviceAnnotations }}
|
||||
{{- include "postgresql.tplValue" (dict "value" $serviceAnnotations "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ $serviceType }}
|
||||
{{- if and $serviceLoadBalancerIP (eq $serviceType "LoadBalancer") }}
|
||||
loadBalancerIP: {{ $serviceLoadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if and (eq $serviceType "LoadBalancer") $serviceLoadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges: {{- include "postgresql.tplValue" (dict "value" $serviceLoadBalancerSourceRanges "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- if and (eq $serviceType "ClusterIP") $serviceClusterIP }}
|
||||
clusterIP: {{ $serviceClusterIP }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: tcp-postgresql
|
||||
port: {{ template "postgresql.port" . }}
|
||||
targetPort: tcp-postgresql
|
||||
{{- if $serviceNodePort }}
|
||||
nodePort: {{ $serviceNodePort }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "common.labels.matchLabels" . | nindent 4 }}
|
||||
role: master
|
|
@ -0,0 +1,594 @@
|
|||
## Global Docker image parameters
|
||||
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
|
||||
## Current available global Docker image parameters: imageRegistry and imagePullSecrets
|
||||
##
|
||||
global:
|
||||
postgresql: {}
|
||||
# imageRegistry: myRegistryName
|
||||
# imagePullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
# storageClass: myStorageClass
|
||||
|
||||
## Bitnami PostgreSQL image version
|
||||
## ref: https://hub.docker.com/r/bitnami/postgresql/tags/
|
||||
##
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/postgresql
|
||||
tag: 11.9.0-debian-10-r1
|
||||
## Specify a imagePullPolicy
|
||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Set to true if you would like to see extra information on logs
|
||||
## It turns BASH and NAMI debugging in minideb
|
||||
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||
debug: false
|
||||
|
||||
## String to partially override postgresql.fullname template (will maintain the release name)
|
||||
##
|
||||
# nameOverride:
|
||||
|
||||
## String to fully override postgresql.fullname template
|
||||
##
|
||||
# fullnameOverride:
|
||||
|
||||
##
|
||||
## Init containers parameters:
|
||||
## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup
|
||||
##
|
||||
volumePermissions:
|
||||
enabled: false
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/minideb
|
||||
tag: buster
|
||||
## Specify a imagePullPolicy
|
||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
##
|
||||
pullPolicy: Always
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
## Init container Security Context
|
||||
## Note: the chown of the data folder is done to securityContext.runAsUser
|
||||
## and not the below volumePermissions.securityContext.runAsUser
|
||||
## When runAsUser is set to special value "auto", init container will try to chwon the
|
||||
## data folder to autodetermined user&group, using commands: `id -u`:`id -G | cut -d" " -f2`
|
||||
## "auto" is especially useful for OpenShift which has scc with dynamic userids (and 0 is not allowed).
|
||||
## You may want to use this volumePermissions.securityContext.runAsUser="auto" in combination with
|
||||
## pod securityContext.enabled=false and shmVolume.chmod.enabled=false
|
||||
##
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
|
||||
## Use an alternate scheduler, e.g. "stork".
|
||||
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||
##
|
||||
# schedulerName:
|
||||
|
||||
## Pod Security Context
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
enabled: true
|
||||
fsGroup: 1001
|
||||
runAsUser: 1001
|
||||
|
||||
## Pod Service Account
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
|
||||
serviceAccount:
|
||||
enabled: false
|
||||
## Name of an already existing service account. Setting this value disables the automatic service account creation.
|
||||
# name:
|
||||
|
||||
## Pod Security Policy
|
||||
## ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/
|
||||
psp:
|
||||
create: false
|
||||
|
||||
## Creates role for ServiceAccount
|
||||
## Required for PSP
|
||||
rbac:
|
||||
create: false
|
||||
|
||||
replication:
|
||||
enabled: true
|
||||
user: repl_user
|
||||
password: repl_password
|
||||
slaveReplicas: 2
|
||||
## Set synchronous commit mode: on, off, remote_apply, remote_write and local
|
||||
## ref: https://www.postgresql.org/docs/9.6/runtime-config-wal.html#GUC-WAL-LEVEL
|
||||
synchronousCommit: 'on'
|
||||
## From the number of `slaveReplicas` defined above, set the number of those that will have synchronous replication
|
||||
## NOTE: It cannot be > slaveReplicas
|
||||
numSynchronousReplicas: 1
|
||||
## Replication Cluster application name. Useful for defining multiple replication policies
|
||||
applicationName: my_application
|
||||
|
||||
## PostgreSQL admin password (used when `postgresqlUsername` is not `postgres`)
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-user-on-first-run (see note!)
|
||||
# postgresqlPostgresPassword:
|
||||
|
||||
## PostgreSQL user (has superuser privileges if username is `postgres`)
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run
|
||||
postgresqlUsername: postgres
|
||||
|
||||
## PostgreSQL password
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run
|
||||
##
|
||||
# postgresqlPassword:
|
||||
|
||||
## PostgreSQL password using existing secret
|
||||
## existingSecret: secret
|
||||
|
||||
## Mount PostgreSQL secret as a file instead of passing environment variable
|
||||
# usePasswordFile: false
|
||||
|
||||
## Create a database
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-on-first-run
|
||||
##
|
||||
# postgresqlDatabase:
|
||||
|
||||
## PostgreSQL data dir
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||
##
|
||||
postgresqlDataDir: /bitnami/postgresql/data
|
||||
|
||||
## An array to add extra environment variables
|
||||
## For example:
|
||||
## extraEnv:
|
||||
## - name: FOO
|
||||
## value: "bar"
|
||||
##
|
||||
# extraEnv:
|
||||
extraEnv: []
|
||||
|
||||
## Name of a ConfigMap containing extra env vars
|
||||
##
|
||||
# extraEnvVarsCM:
|
||||
|
||||
## Specify extra initdb args
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||
##
|
||||
# postgresqlInitdbArgs:
|
||||
|
||||
## Specify a custom location for the PostgreSQL transaction log
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||
##
|
||||
# postgresqlInitdbWalDir:
|
||||
|
||||
## PostgreSQL configuration
|
||||
## Specify runtime configuration parameters as a dict, using camelCase, e.g.
|
||||
## {"sharedBuffers": "500MB"}
|
||||
## Alternatively, you can put your postgresql.conf under the files/ directory
|
||||
## ref: https://www.postgresql.org/docs/current/static/runtime-config.html
|
||||
##
|
||||
# postgresqlConfiguration:
|
||||
|
||||
## PostgreSQL extended configuration
|
||||
## As above, but _appended_ to the main configuration
|
||||
## Alternatively, you can put your *.conf under the files/conf.d/ directory
|
||||
## https://github.com/bitnami/bitnami-docker-postgresql#allow-settings-to-be-loaded-from-files-other-than-the-default-postgresqlconf
|
||||
##
|
||||
# postgresqlExtendedConf:
|
||||
|
||||
## PostgreSQL client authentication configuration
|
||||
## Specify content for pg_hba.conf
|
||||
## Default: do not create pg_hba.conf
|
||||
## Alternatively, you can put your pg_hba.conf under the files/ directory
|
||||
# pgHbaConfiguration: |-
|
||||
# local all all trust
|
||||
# host all all localhost trust
|
||||
# host mydatabase mysuser 192.168.0.0/24 md5
|
||||
|
||||
## ConfigMap with PostgreSQL configuration
|
||||
## NOTE: This will override postgresqlConfiguration and pgHbaConfiguration
|
||||
# configurationConfigMap:
|
||||
|
||||
## ConfigMap with PostgreSQL extended configuration
|
||||
# extendedConfConfigMap:
|
||||
|
||||
## initdb scripts
|
||||
## Specify dictionary of scripts to be run at first boot
|
||||
## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory
|
||||
##
|
||||
# initdbScripts:
|
||||
# my_init_script.sh: |
|
||||
# #!/bin/sh
|
||||
# echo "Do something."
|
||||
|
||||
## Specify the PostgreSQL username and password to execute the initdb scripts
|
||||
# initdbUser:
|
||||
# initdbPassword:
|
||||
|
||||
## ConfigMap with scripts to be run at first boot
|
||||
## NOTE: This will override initdbScripts
|
||||
# initdbScriptsConfigMap:
|
||||
|
||||
## Secret with scripts to be run at first boot (in case it contains sensitive information)
|
||||
## NOTE: This can work along initdbScripts or initdbScriptsConfigMap
|
||||
# initdbScriptsSecret:
|
||||
|
||||
## Optional duration in seconds the pod needs to terminate gracefully.
|
||||
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods
|
||||
##
|
||||
# terminationGracePeriodSeconds: 30
|
||||
|
||||
## LDAP configuration
|
||||
##
|
||||
ldap:
|
||||
enabled: false
|
||||
url: ''
|
||||
server: ''
|
||||
port: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
baseDN: ''
|
||||
bindDN: ''
|
||||
bind_password:
|
||||
search_attr: ''
|
||||
search_filter: ''
|
||||
scheme: ''
|
||||
tls: false
|
||||
|
||||
## PostgreSQL service configuration
|
||||
service:
|
||||
## PosgresSQL service type
|
||||
type: ClusterIP
|
||||
# clusterIP: None
|
||||
port: 5432
|
||||
|
||||
## Specify the nodePort value for the LoadBalancer and NodePort service types.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
|
||||
##
|
||||
# nodePort:
|
||||
|
||||
## Provide any additional annotations which may be required. Evaluated as a template.
|
||||
##
|
||||
annotations: {}
|
||||
## Set the LoadBalancer service type to internal only.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||
##
|
||||
# loadBalancerIP:
|
||||
## Load Balancer sources. Evaluated as a template.
|
||||
## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
|
||||
##
|
||||
# loadBalancerSourceRanges:
|
||||
# - 10.10.10.0/24
|
||||
|
||||
## Start master and slave(s) pod(s) without limitations on shm memory.
|
||||
## By default docker and containerd (and possibly other container runtimes)
|
||||
## limit `/dev/shm` to `64M` (see e.g. the
|
||||
## [docker issue](https://github.com/docker-library/postgres/issues/416) and the
|
||||
## [containerd issue](https://github.com/containerd/containerd/issues/3654),
|
||||
## which could be not enough if PostgreSQL uses parallel workers heavily.
|
||||
##
|
||||
shmVolume:
|
||||
## Set `shmVolume.enabled` to `true` to mount a new tmpfs volume to remove
|
||||
## this limitation.
|
||||
##
|
||||
enabled: true
|
||||
## Set to `true` to `chmod 777 /dev/shm` on a initContainer.
|
||||
## This option is ingored if `volumePermissions.enabled` is `false`
|
||||
##
|
||||
chmod:
|
||||
enabled: true
|
||||
|
||||
## PostgreSQL data Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||
## If undefined (the default) or set to null, no storageClassName spec is
|
||||
## set, choosing the default provisioner. (gp2 on AWS, standard on
|
||||
## GKE, AWS & OpenStack)
|
||||
##
|
||||
persistence:
|
||||
enabled: true
|
||||
## A manually managed Persistent Volume and Claim
|
||||
## If defined, PVC must be created manually before volume will be bound
|
||||
## The value is evaluated as a template, so, for example, the name can depend on .Release or .Chart
|
||||
##
|
||||
# existingClaim:
|
||||
|
||||
## The path the volume will be mounted at, useful when using different
|
||||
## PostgreSQL images.
|
||||
##
|
||||
mountPath: /bitnami/postgresql
|
||||
|
||||
## The subdirectory of the volume to mount to, useful in dev environments
|
||||
## and one PV for multiple services.
|
||||
##
|
||||
subPath: ''
|
||||
|
||||
# storageClass: "-"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
size: 8Gi
|
||||
annotations: {}
|
||||
|
||||
## updateStrategy for PostgreSQL StatefulSet and its slaves StatefulSets
|
||||
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
|
||||
##
|
||||
## PostgreSQL Master parameters
|
||||
##
|
||||
master:
|
||||
## Node, affinity, tolerations, and priorityclass settings for pod assignment
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption
|
||||
nodeSelector: {}
|
||||
affinity: {}
|
||||
tolerations: []
|
||||
labels: {}
|
||||
annotations: {}
|
||||
podLabels: {}
|
||||
podAnnotations: {}
|
||||
priorityClassName: ''
|
||||
## Additional PostgreSQL Master Volume mounts
|
||||
##
|
||||
extraVolumeMounts: []
|
||||
## Additional PostgreSQL Master Volumes
|
||||
##
|
||||
extraVolumes: []
|
||||
## Add sidecars to the pod
|
||||
##
|
||||
## For example:
|
||||
## sidecars:
|
||||
## - name: your-image-name
|
||||
## image: your-image
|
||||
## imagePullPolicy: Always
|
||||
## ports:
|
||||
## - name: portname
|
||||
## containerPort: 1234
|
||||
sidecars: []
|
||||
|
||||
## Override the service configuration for master
|
||||
##
|
||||
service: {}
|
||||
# type:
|
||||
# nodePort:
|
||||
# clusterIP:
|
||||
|
||||
##
|
||||
## PostgreSQL Slave parameters
|
||||
##
|
||||
slave:
|
||||
## Node, affinity, tolerations, and priorityclass settings for pod assignment
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption
|
||||
nodeSelector: {}
|
||||
affinity: {}
|
||||
tolerations: []
|
||||
labels: {}
|
||||
annotations: {}
|
||||
podLabels: {}
|
||||
podAnnotations: {}
|
||||
priorityClassName: ''
|
||||
## Extra init containers
|
||||
## Example
|
||||
##
|
||||
## extraInitContainers:
|
||||
## - name: do-something
|
||||
## image: busybox
|
||||
## command: ['do', 'something']
|
||||
extraInitContainers: []
|
||||
## Additional PostgreSQL Slave Volume mounts
|
||||
##
|
||||
extraVolumeMounts: []
|
||||
## Additional PostgreSQL Slave Volumes
|
||||
##
|
||||
extraVolumes: []
|
||||
## Add sidecars to the pod
|
||||
##
|
||||
## For example:
|
||||
## sidecars:
|
||||
## - name: your-image-name
|
||||
## image: your-image
|
||||
## imagePullPolicy: Always
|
||||
## ports:
|
||||
## - name: portname
|
||||
## containerPort: 1234
|
||||
sidecars: []
|
||||
|
||||
## Override the service configuration for slave
|
||||
##
|
||||
service: {}
|
||||
# type:
|
||||
# nodePort:
|
||||
# clusterIP:
|
||||
## Whether to enable PostgreSQL slave replicas data Persistent
|
||||
##
|
||||
persistence:
|
||||
enabled: true
|
||||
|
||||
## Configure resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources:
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 250m
|
||||
|
||||
## Add annotations to all the deployed resources
|
||||
##
|
||||
commonAnnotations: {}
|
||||
|
||||
networkPolicy:
|
||||
## Enable creation of NetworkPolicy resources. Only Ingress traffic is filtered for now.
|
||||
##
|
||||
enabled: false
|
||||
|
||||
## The Policy model to apply. When set to false, only pods with the correct
|
||||
## client label will have network access to the port PostgreSQL is listening
|
||||
## on. When true, PostgreSQL will accept connections from any source
|
||||
## (with the correct destination port).
|
||||
##
|
||||
allowExternal: true
|
||||
|
||||
## if explicitNamespacesSelector is missing or set to {}, only client Pods that are in the networkPolicy's namespace
|
||||
## and that match other criteria, the ones that have the good label, can reach the DB.
|
||||
## But sometimes, we want the DB to be accessible to clients from other namespaces, in this case, we can use this
|
||||
## LabelSelector to select these namespaces, note that the networkPolicy's namespace should also be explicitly added.
|
||||
##
|
||||
## Example:
|
||||
## explicitNamespacesSelector:
|
||||
## matchLabels:
|
||||
## role: frontend
|
||||
## matchExpressions:
|
||||
## - {key: role, operator: In, values: [frontend]}
|
||||
explicitNamespacesSelector: {}
|
||||
|
||||
## Configure extra options for liveness and readiness probes
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
successThreshold: 1
|
||||
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
successThreshold: 1
|
||||
|
||||
##
|
||||
## TLS configuration
|
||||
##
|
||||
tls:
|
||||
# Enable TLS traffic
|
||||
enabled: false
|
||||
#
|
||||
# Whether to use the server's TLS cipher preferences rather than the client's.
|
||||
preferServerCiphers: true
|
||||
#
|
||||
# Name of the Secret that contains the certificates
|
||||
certificatesSecret: ''
|
||||
#
|
||||
# Certificate filename
|
||||
certFilename: ''
|
||||
#
|
||||
# Certificate Key filename
|
||||
certKeyFilename: ''
|
||||
#
|
||||
# CA Certificate filename
|
||||
# If provided, PostgreSQL will authenticate TLS/SSL clients by requesting them a certificate
|
||||
# ref: https://www.postgresql.org/docs/9.6/auth-methods.html
|
||||
certCAFilename:
|
||||
#
|
||||
# File containing a Certificate Revocation List
|
||||
crlFilename:
|
||||
|
||||
## Configure metrics exporter
|
||||
##
|
||||
metrics:
|
||||
enabled: true
|
||||
# resources: {}
|
||||
service:
|
||||
type: ClusterIP
|
||||
annotations:
|
||||
prometheus.io/scrape: 'true'
|
||||
prometheus.io/port: '9187'
|
||||
loadBalancerIP:
|
||||
serviceMonitor:
|
||||
enabled: false
|
||||
additionalLabels: {}
|
||||
# namespace: monitoring
|
||||
# interval: 30s
|
||||
# scrapeTimeout: 10s
|
||||
## Custom PrometheusRule to be defined
|
||||
## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart
|
||||
## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions
|
||||
prometheusRule:
|
||||
enabled: false
|
||||
additionalLabels: {}
|
||||
namespace: ''
|
||||
## These are just examples rules, please adapt them to your needs.
|
||||
## Make sure to constraint the rules to the current postgresql service.
|
||||
## rules:
|
||||
## - alert: HugeReplicationLag
|
||||
## expr: pg_replication_lag{service="{{ template "postgresql.fullname" . }}-metrics"} / 3600 > 1
|
||||
## for: 1m
|
||||
## labels:
|
||||
## severity: critical
|
||||
## annotations:
|
||||
## description: replication for {{ template "postgresql.fullname" . }} PostgreSQL is lagging by {{ "{{ $value }}" }} hour(s).
|
||||
## summary: PostgreSQL replication is lagging by {{ "{{ $value }}" }} hour(s).
|
||||
rules: []
|
||||
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/postgres-exporter
|
||||
tag: 0.8.0-debian-10-r188
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
## Define additional custom metrics
|
||||
## ref: https://github.com/wrouesnel/postgres_exporter#adding-new-metrics-via-a-config-file
|
||||
# customMetrics:
|
||||
# pg_database:
|
||||
# query: "SELECT d.datname AS name, CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') THEN pg_catalog.pg_database_size(d.datname) ELSE 0 END AS size FROM pg_catalog.pg_database d where datname not in ('template0', 'template1', 'postgres')"
|
||||
# metrics:
|
||||
# - name:
|
||||
# usage: "LABEL"
|
||||
# description: "Name of the database"
|
||||
# - size_bytes:
|
||||
# usage: "GAUGE"
|
||||
# description: "Size of the database in bytes"
|
||||
## An array to add extra env vars to configure postgres-exporter
|
||||
## see: https://github.com/wrouesnel/postgres_exporter#environment-variables
|
||||
## For example:
|
||||
# extraEnvVars:
|
||||
# - name: PG_EXPORTER_DISABLE_DEFAULT_METRICS
|
||||
# value: "true"
|
||||
extraEnvVars: {}
|
||||
|
||||
## Pod Security Context
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
enabled: false
|
||||
runAsUser: 1001
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
|
||||
## Configure extra options for liveness and readiness probes
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
successThreshold: 1
|
||||
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
successThreshold: 1
|
|
@ -0,0 +1,103 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"postgresqlUsername": {
|
||||
"type": "string",
|
||||
"title": "Admin user",
|
||||
"form": true
|
||||
},
|
||||
"postgresqlPassword": {
|
||||
"type": "string",
|
||||
"title": "Password",
|
||||
"form": true
|
||||
},
|
||||
"persistence": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"size": {
|
||||
"type": "string",
|
||||
"title": "Persistent Volume Size",
|
||||
"form": true,
|
||||
"render": "slider",
|
||||
"sliderMin": 1,
|
||||
"sliderMax": 100,
|
||||
"sliderUnit": "Gi"
|
||||
}
|
||||
}
|
||||
},
|
||||
"resources": {
|
||||
"type": "object",
|
||||
"title": "Required Resources",
|
||||
"description": "Configure resource requests",
|
||||
"form": true,
|
||||
"properties": {
|
||||
"requests": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"memory": {
|
||||
"type": "string",
|
||||
"form": true,
|
||||
"render": "slider",
|
||||
"title": "Memory Request",
|
||||
"sliderMin": 10,
|
||||
"sliderMax": 2048,
|
||||
"sliderUnit": "Mi"
|
||||
},
|
||||
"cpu": {
|
||||
"type": "string",
|
||||
"form": true,
|
||||
"render": "slider",
|
||||
"title": "CPU Request",
|
||||
"sliderMin": 10,
|
||||
"sliderMax": 2000,
|
||||
"sliderUnit": "m"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"replication": {
|
||||
"type": "object",
|
||||
"form": true,
|
||||
"title": "Replication Details",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"title": "Enable Replication",
|
||||
"form": true
|
||||
},
|
||||
"slaveReplicas": {
|
||||
"type": "integer",
|
||||
"title": "Slave Replicas",
|
||||
"form": true,
|
||||
"hidden": {
|
||||
"value": false,
|
||||
"path": "replication/enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"volumePermissions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"form": true,
|
||||
"title": "Enable Init Containers",
|
||||
"description": "Change the owner of the persist volume mountpoint to RunAsUser:fsGroup"
|
||||
}
|
||||
}
|
||||
},
|
||||
"metrics": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"title": "Configure metrics exporter",
|
||||
"form": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,600 @@
|
|||
## Global Docker image parameters
|
||||
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
|
||||
## Current available global Docker image parameters: imageRegistry and imagePullSecrets
|
||||
##
|
||||
global:
|
||||
postgresql: {}
|
||||
# imageRegistry: myRegistryName
|
||||
# imagePullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
# storageClass: myStorageClass
|
||||
|
||||
## Bitnami PostgreSQL image version
|
||||
## ref: https://hub.docker.com/r/bitnami/postgresql/tags/
|
||||
##
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/postgresql
|
||||
tag: 11.9.0-debian-10-r1
|
||||
## Specify a imagePullPolicy
|
||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
|
||||
## Set to true if you would like to see extra information on logs
|
||||
## It turns BASH and NAMI debugging in minideb
|
||||
## ref: https://github.com/bitnami/minideb-extras/#turn-on-bash-debugging
|
||||
debug: false
|
||||
|
||||
## String to partially override postgresql.fullname template (will maintain the release name)
|
||||
##
|
||||
# nameOverride:
|
||||
|
||||
## String to fully override postgresql.fullname template
|
||||
##
|
||||
# fullnameOverride:
|
||||
|
||||
##
|
||||
## Init containers parameters:
|
||||
## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup
|
||||
##
|
||||
volumePermissions:
|
||||
enabled: false
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/minideb
|
||||
tag: buster
|
||||
## Specify a imagePullPolicy
|
||||
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
##
|
||||
pullPolicy: Always
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
## Init container Security Context
|
||||
## Note: the chown of the data folder is done to securityContext.runAsUser
|
||||
## and not the below volumePermissions.securityContext.runAsUser
|
||||
## When runAsUser is set to special value "auto", init container will try to chwon the
|
||||
## data folder to autodetermined user&group, using commands: `id -u`:`id -G | cut -d" " -f2`
|
||||
## "auto" is especially useful for OpenShift which has scc with dynamic userids (and 0 is not allowed).
|
||||
## You may want to use this volumePermissions.securityContext.runAsUser="auto" in combination with
|
||||
## pod securityContext.enabled=false and shmVolume.chmod.enabled=false
|
||||
##
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
|
||||
## Use an alternate scheduler, e.g. "stork".
|
||||
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
|
||||
##
|
||||
# schedulerName:
|
||||
|
||||
## Pod Security Context
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
enabled: true
|
||||
fsGroup: 1001
|
||||
runAsUser: 1001
|
||||
|
||||
## Pod Service Account
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
|
||||
serviceAccount:
|
||||
enabled: false
|
||||
## Name of an already existing service account. Setting this value disables the automatic service account creation.
|
||||
# name:
|
||||
|
||||
## Pod Security Policy
|
||||
## ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/
|
||||
psp:
|
||||
create: false
|
||||
|
||||
## Creates role for ServiceAccount
|
||||
## Required for PSP
|
||||
rbac:
|
||||
create: false
|
||||
|
||||
replication:
|
||||
enabled: false
|
||||
user: repl_user
|
||||
password: repl_password
|
||||
slaveReplicas: 1
|
||||
## Set synchronous commit mode: on, off, remote_apply, remote_write and local
|
||||
## ref: https://www.postgresql.org/docs/9.6/runtime-config-wal.html#GUC-WAL-LEVEL
|
||||
synchronousCommit: 'off'
|
||||
## From the number of `slaveReplicas` defined above, set the number of those that will have synchronous replication
|
||||
## NOTE: It cannot be > slaveReplicas
|
||||
numSynchronousReplicas: 0
|
||||
## Replication Cluster application name. Useful for defining multiple replication policies
|
||||
applicationName: my_application
|
||||
|
||||
## PostgreSQL admin password (used when `postgresqlUsername` is not `postgres`)
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-user-on-first-run (see note!)
|
||||
# postgresqlPostgresPassword:
|
||||
|
||||
## PostgreSQL user (has superuser privileges if username is `postgres`)
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run
|
||||
postgresqlUsername: postgres
|
||||
|
||||
## PostgreSQL password
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run
|
||||
##
|
||||
# postgresqlPassword:
|
||||
|
||||
## PostgreSQL password using existing secret
|
||||
## existingSecret: secret
|
||||
|
||||
## Mount PostgreSQL secret as a file instead of passing environment variable
|
||||
# usePasswordFile: false
|
||||
|
||||
## Create a database
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-on-first-run
|
||||
##
|
||||
# postgresqlDatabase:
|
||||
|
||||
## PostgreSQL data dir
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||
##
|
||||
postgresqlDataDir: /bitnami/postgresql/data
|
||||
|
||||
## An array to add extra environment variables
|
||||
## For example:
|
||||
## extraEnv:
|
||||
## - name: FOO
|
||||
## value: "bar"
|
||||
##
|
||||
# extraEnv:
|
||||
extraEnv: []
|
||||
|
||||
## Name of a ConfigMap containing extra env vars
|
||||
##
|
||||
# extraEnvVarsCM:
|
||||
|
||||
## Specify extra initdb args
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||
##
|
||||
# postgresqlInitdbArgs:
|
||||
|
||||
## Specify a custom location for the PostgreSQL transaction log
|
||||
## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md
|
||||
##
|
||||
# postgresqlInitdbWalDir:
|
||||
|
||||
## PostgreSQL configuration
|
||||
## Specify runtime configuration parameters as a dict, using camelCase, e.g.
|
||||
## {"sharedBuffers": "500MB"}
|
||||
## Alternatively, you can put your postgresql.conf under the files/ directory
|
||||
## ref: https://www.postgresql.org/docs/current/static/runtime-config.html
|
||||
##
|
||||
# postgresqlConfiguration:
|
||||
|
||||
## PostgreSQL extended configuration
|
||||
## As above, but _appended_ to the main configuration
|
||||
## Alternatively, you can put your *.conf under the files/conf.d/ directory
|
||||
## https://github.com/bitnami/bitnami-docker-postgresql#allow-settings-to-be-loaded-from-files-other-than-the-default-postgresqlconf
|
||||
##
|
||||
# postgresqlExtendedConf:
|
||||
|
||||
## PostgreSQL client authentication configuration
|
||||
## Specify content for pg_hba.conf
|
||||
## Default: do not create pg_hba.conf
|
||||
## Alternatively, you can put your pg_hba.conf under the files/ directory
|
||||
# pgHbaConfiguration: |-
|
||||
# local all all trust
|
||||
# host all all localhost trust
|
||||
# host mydatabase mysuser 192.168.0.0/24 md5
|
||||
|
||||
## ConfigMap with PostgreSQL configuration
|
||||
## NOTE: This will override postgresqlConfiguration and pgHbaConfiguration
|
||||
# configurationConfigMap:
|
||||
|
||||
## ConfigMap with PostgreSQL extended configuration
|
||||
# extendedConfConfigMap:
|
||||
|
||||
## initdb scripts
|
||||
## Specify dictionary of scripts to be run at first boot
|
||||
## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory
|
||||
##
|
||||
# initdbScripts:
|
||||
# my_init_script.sh: |
|
||||
# #!/bin/sh
|
||||
# echo "Do something."
|
||||
|
||||
## ConfigMap with scripts to be run at first boot
|
||||
## NOTE: This will override initdbScripts
|
||||
# initdbScriptsConfigMap:
|
||||
|
||||
## Secret with scripts to be run at first boot (in case it contains sensitive information)
|
||||
## NOTE: This can work along initdbScripts or initdbScriptsConfigMap
|
||||
# initdbScriptsSecret:
|
||||
|
||||
## Specify the PostgreSQL username and password to execute the initdb scripts
|
||||
# initdbUser:
|
||||
# initdbPassword:
|
||||
|
||||
## Optional duration in seconds the pod needs to terminate gracefully.
|
||||
## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods
|
||||
##
|
||||
# terminationGracePeriodSeconds: 30
|
||||
|
||||
## LDAP configuration
|
||||
##
|
||||
ldap:
|
||||
enabled: false
|
||||
url: ''
|
||||
server: ''
|
||||
port: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
baseDN: ''
|
||||
bindDN: ''
|
||||
bind_password:
|
||||
search_attr: ''
|
||||
search_filter: ''
|
||||
scheme: ''
|
||||
tls: false
|
||||
|
||||
## PostgreSQL service configuration
|
||||
service:
|
||||
## PosgresSQL service type
|
||||
type: ClusterIP
|
||||
# clusterIP: None
|
||||
port: 5432
|
||||
|
||||
## Specify the nodePort value for the LoadBalancer and NodePort service types.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
|
||||
##
|
||||
# nodePort:
|
||||
|
||||
## Provide any additional annotations which may be required. Evaluated as a template.
|
||||
##
|
||||
annotations: {}
|
||||
## Set the LoadBalancer service type to internal only.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
|
||||
##
|
||||
# loadBalancerIP:
|
||||
## Load Balancer sources. Evaluated as a template.
|
||||
## https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
|
||||
##
|
||||
# loadBalancerSourceRanges:
|
||||
# - 10.10.10.0/24
|
||||
|
||||
## Start master and slave(s) pod(s) without limitations on shm memory.
|
||||
## By default docker and containerd (and possibly other container runtimes)
|
||||
## limit `/dev/shm` to `64M` (see e.g. the
|
||||
## [docker issue](https://github.com/docker-library/postgres/issues/416) and the
|
||||
## [containerd issue](https://github.com/containerd/containerd/issues/3654),
|
||||
## which could be not enough if PostgreSQL uses parallel workers heavily.
|
||||
##
|
||||
shmVolume:
|
||||
## Set `shmVolume.enabled` to `true` to mount a new tmpfs volume to remove
|
||||
## this limitation.
|
||||
##
|
||||
enabled: true
|
||||
## Set to `true` to `chmod 777 /dev/shm` on a initContainer.
|
||||
## This option is ingored if `volumePermissions.enabled` is `false`
|
||||
##
|
||||
chmod:
|
||||
enabled: true
|
||||
|
||||
## PostgreSQL data Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||
## If undefined (the default) or set to null, no storageClassName spec is
|
||||
## set, choosing the default provisioner. (gp2 on AWS, standard on
|
||||
## GKE, AWS & OpenStack)
|
||||
##
|
||||
persistence:
|
||||
enabled: true
|
||||
## A manually managed Persistent Volume and Claim
|
||||
## If defined, PVC must be created manually before volume will be bound
|
||||
## The value is evaluated as a template, so, for example, the name can depend on .Release or .Chart
|
||||
##
|
||||
# existingClaim:
|
||||
|
||||
## The path the volume will be mounted at, useful when using different
|
||||
## PostgreSQL images.
|
||||
##
|
||||
mountPath: /bitnami/postgresql
|
||||
|
||||
## The subdirectory of the volume to mount to, useful in dev environments
|
||||
## and one PV for multiple services.
|
||||
##
|
||||
subPath: ''
|
||||
|
||||
# storageClass: "-"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
size: 8Gi
|
||||
annotations: {}
|
||||
|
||||
## updateStrategy for PostgreSQL StatefulSet and its slaves StatefulSets
|
||||
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
|
||||
##
|
||||
## PostgreSQL Master parameters
|
||||
##
|
||||
master:
|
||||
## Node, affinity, tolerations, and priorityclass settings for pod assignment
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption
|
||||
nodeSelector: {}
|
||||
affinity: {}
|
||||
tolerations: []
|
||||
labels: {}
|
||||
annotations: {}
|
||||
podLabels: {}
|
||||
podAnnotations: {}
|
||||
priorityClassName: ''
|
||||
## Extra init containers
|
||||
## Example
|
||||
##
|
||||
## extraInitContainers:
|
||||
## - name: do-something
|
||||
## image: busybox
|
||||
## command: ['do', 'something']
|
||||
extraInitContainers: []
|
||||
|
||||
## Additional PostgreSQL Master Volume mounts
|
||||
##
|
||||
extraVolumeMounts: []
|
||||
## Additional PostgreSQL Master Volumes
|
||||
##
|
||||
extraVolumes: []
|
||||
## Add sidecars to the pod
|
||||
##
|
||||
## For example:
|
||||
## sidecars:
|
||||
## - name: your-image-name
|
||||
## image: your-image
|
||||
## imagePullPolicy: Always
|
||||
## ports:
|
||||
## - name: portname
|
||||
## containerPort: 1234
|
||||
sidecars: []
|
||||
|
||||
## Override the service configuration for master
|
||||
##
|
||||
service: {}
|
||||
# type:
|
||||
# nodePort:
|
||||
# clusterIP:
|
||||
|
||||
##
|
||||
## PostgreSQL Slave parameters
|
||||
##
|
||||
slave:
|
||||
## Node, affinity, tolerations, and priorityclass settings for pod assignment
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature
|
||||
## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption
|
||||
nodeSelector: {}
|
||||
affinity: {}
|
||||
tolerations: []
|
||||
labels: {}
|
||||
annotations: {}
|
||||
podLabels: {}
|
||||
podAnnotations: {}
|
||||
priorityClassName: ''
|
||||
extraInitContainers: |
|
||||
# - name: do-something
|
||||
# image: busybox
|
||||
# command: ['do', 'something']
|
||||
## Additional PostgreSQL Slave Volume mounts
|
||||
##
|
||||
extraVolumeMounts: []
|
||||
## Additional PostgreSQL Slave Volumes
|
||||
##
|
||||
extraVolumes: []
|
||||
## Add sidecars to the pod
|
||||
##
|
||||
## For example:
|
||||
## sidecars:
|
||||
## - name: your-image-name
|
||||
## image: your-image
|
||||
## imagePullPolicy: Always
|
||||
## ports:
|
||||
## - name: portname
|
||||
## containerPort: 1234
|
||||
sidecars: []
|
||||
|
||||
## Override the service configuration for slave
|
||||
##
|
||||
service: {}
|
||||
# type:
|
||||
# nodePort:
|
||||
# clusterIP:
|
||||
## Whether to enable PostgreSQL slave replicas data Persistent
|
||||
##
|
||||
persistence:
|
||||
enabled: true
|
||||
|
||||
## Configure resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources:
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 250m
|
||||
|
||||
## Add annotations to all the deployed resources
|
||||
##
|
||||
commonAnnotations: {}
|
||||
|
||||
networkPolicy:
|
||||
## Enable creation of NetworkPolicy resources. Only Ingress traffic is filtered for now.
|
||||
##
|
||||
enabled: false
|
||||
|
||||
## The Policy model to apply. When set to false, only pods with the correct
|
||||
## client label will have network access to the port PostgreSQL is listening
|
||||
## on. When true, PostgreSQL will accept connections from any source
|
||||
## (with the correct destination port).
|
||||
##
|
||||
allowExternal: true
|
||||
|
||||
## if explicitNamespacesSelector is missing or set to {}, only client Pods that are in the networkPolicy's namespace
|
||||
## and that match other criteria, the ones that have the good label, can reach the DB.
|
||||
## But sometimes, we want the DB to be accessible to clients from other namespaces, in this case, we can use this
|
||||
## LabelSelector to select these namespaces, note that the networkPolicy's namespace should also be explicitly added.
|
||||
##
|
||||
## Example:
|
||||
## explicitNamespacesSelector:
|
||||
## matchLabels:
|
||||
## role: frontend
|
||||
## matchExpressions:
|
||||
## - {key: role, operator: In, values: [frontend]}
|
||||
explicitNamespacesSelector: {}
|
||||
|
||||
## Configure extra options for liveness and readiness probes
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
successThreshold: 1
|
||||
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
successThreshold: 1
|
||||
|
||||
##
|
||||
## TLS configuration
|
||||
##
|
||||
tls:
|
||||
# Enable TLS traffic
|
||||
enabled: false
|
||||
#
|
||||
# Whether to use the server's TLS cipher preferences rather than the client's.
|
||||
preferServerCiphers: true
|
||||
#
|
||||
# Name of the Secret that contains the certificates
|
||||
certificatesSecret: ''
|
||||
#
|
||||
# Certificate filename
|
||||
certFilename: ''
|
||||
#
|
||||
# Certificate Key filename
|
||||
certKeyFilename: ''
|
||||
#
|
||||
# CA Certificate filename
|
||||
# If provided, PostgreSQL will authenticate TLS/SSL clients by requesting them a certificate
|
||||
# ref: https://www.postgresql.org/docs/9.6/auth-methods.html
|
||||
certCAFilename:
|
||||
#
|
||||
# File containing a Certificate Revocation List
|
||||
crlFilename:
|
||||
|
||||
## Configure metrics exporter
|
||||
##
|
||||
metrics:
|
||||
enabled: false
|
||||
# resources: {}
|
||||
service:
|
||||
type: ClusterIP
|
||||
annotations:
|
||||
prometheus.io/scrape: 'true'
|
||||
prometheus.io/port: '9187'
|
||||
loadBalancerIP:
|
||||
serviceMonitor:
|
||||
enabled: false
|
||||
additionalLabels: {}
|
||||
# namespace: monitoring
|
||||
# interval: 30s
|
||||
# scrapeTimeout: 10s
|
||||
## Custom PrometheusRule to be defined
|
||||
## The value is evaluated as a template, so, for example, the value can depend on .Release or .Chart
|
||||
## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions
|
||||
prometheusRule:
|
||||
enabled: false
|
||||
additionalLabels: {}
|
||||
namespace: ''
|
||||
## These are just examples rules, please adapt them to your needs.
|
||||
## Make sure to constraint the rules to the current postgresql service.
|
||||
## rules:
|
||||
## - alert: HugeReplicationLag
|
||||
## expr: pg_replication_lag{service="{{ template "postgresql.fullname" . }}-metrics"} / 3600 > 1
|
||||
## for: 1m
|
||||
## labels:
|
||||
## severity: critical
|
||||
## annotations:
|
||||
## description: replication for {{ template "postgresql.fullname" . }} PostgreSQL is lagging by {{ "{{ $value }}" }} hour(s).
|
||||
## summary: PostgreSQL replication is lagging by {{ "{{ $value }}" }} hour(s).
|
||||
rules: []
|
||||
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/postgres-exporter
|
||||
tag: 0.8.0-debian-10-r188
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||
##
|
||||
# pullSecrets:
|
||||
# - myRegistryKeySecretName
|
||||
## Define additional custom metrics
|
||||
## ref: https://github.com/wrouesnel/postgres_exporter#adding-new-metrics-via-a-config-file
|
||||
# customMetrics:
|
||||
# pg_database:
|
||||
# query: "SELECT d.datname AS name, CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') THEN pg_catalog.pg_database_size(d.datname) ELSE 0 END AS size_bytes FROM pg_catalog.pg_database d where datname not in ('template0', 'template1', 'postgres')"
|
||||
# metrics:
|
||||
# - name:
|
||||
# usage: "LABEL"
|
||||
# description: "Name of the database"
|
||||
# - size_bytes:
|
||||
# usage: "GAUGE"
|
||||
# description: "Size of the database in bytes"
|
||||
#
|
||||
## An array to add extra env vars to configure postgres-exporter
|
||||
## see: https://github.com/wrouesnel/postgres_exporter#environment-variables
|
||||
## For example:
|
||||
# extraEnvVars:
|
||||
# - name: PG_EXPORTER_DISABLE_DEFAULT_METRICS
|
||||
# value: "true"
|
||||
extraEnvVars: {}
|
||||
|
||||
## Pod Security Context
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
|
||||
##
|
||||
securityContext:
|
||||
enabled: false
|
||||
runAsUser: 1001
|
||||
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
|
||||
## Configure extra options for liveness and readiness probes
|
||||
livenessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
successThreshold: 1
|
||||
|
||||
readinessProbe:
|
||||
enabled: true
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
successThreshold: 1
|
|
@ -0,0 +1,11 @@
|
|||
databaseUpgradeReady: true
|
||||
artifactory:
|
||||
masterKey: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
# To Fix ct tool --reuse-values - PASSWORDS ERROR: you must provide your current passwords when upgrade the release
|
||||
postgresql:
|
||||
postgresqlPassword: password
|
||||
access:
|
||||
accessConfig:
|
||||
security:
|
||||
tls: true
|
||||
resetAccessCAKeys: true
|
|
@ -0,0 +1,9 @@
|
|||
# Leave this file empty to ensure that CI runs builds against the default configuration in values.yaml.
|
||||
databaseUpgradeReady: true
|
||||
## This is an exception here because HA needs masterKey to connect with other node members and it is commented in values to support 6.x to 7.x Migration
|
||||
## Please refer https://github.com/jfrog/charts/blob/master/stable/artifactory-ha/README.md#special-upgrade-notes-1
|
||||
artifactory:
|
||||
masterKey: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
# To Fix ct tool --reuse-values - PASSWORDS ERROR: you must provide your current passwords when upgrade the release
|
||||
postgresql:
|
||||
postgresqlPassword: password
|
|
@ -0,0 +1,47 @@
|
|||
databaseUpgradeReady: true
|
||||
# To Fix ct tool --reuse-values - PASSWORDS ERROR: you must provide your current passwords when upgrade the release
|
||||
postgresql:
|
||||
postgresqlPassword: password
|
||||
global:
|
||||
versions:
|
||||
artifactory: 7.12.8
|
||||
masterKey: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
joinKey: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
|
||||
customInitContainers: |
|
||||
- name: "custom-setup"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
imagePullPolicy: "{{ .Values.artifactory.image.pullPolicy }}"
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- 'touch {{ .Values.artifactory.persistence.mountPath }}/example-custom-setup'
|
||||
volumeMounts:
|
||||
- mountPath: "{{ .Values.artifactory.persistence.mountPath }}"
|
||||
name: volume
|
||||
# Add custom volumes
|
||||
customVolumes: |
|
||||
- name: custom-script
|
||||
emptyDir:
|
||||
sizeLimit: 100Mi
|
||||
# Add custom volumesMounts
|
||||
customVolumeMounts: |
|
||||
- name: custom-script
|
||||
mountPath: "/scripts"
|
||||
# Add custom sidecar containers
|
||||
customSidecarContainers: |
|
||||
- name: "sidecar-list-etc"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
imagePullPolicy: "{{ .Values.artifactory.image.pullPolicy }}"
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
command: ["sh","-c","echo 'Sidecar is running' >> /scripts/sidecar.txt; cat /scripts/sidecar.txt; while true; do sleep 30; done"]
|
||||
volumeMounts:
|
||||
- mountPath: "/scripts"
|
||||
name: custom-script
|
||||
resources:
|
||||
requests:
|
||||
memory: "32Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
|
@ -0,0 +1,8 @@
|
|||
databaseUpgradeReady: true
|
||||
# To Fix ct tool --reuse-values - PASSWORDS ERROR: you must provide your current passwords when upgrade the release
|
||||
postgresql:
|
||||
postgresqlPassword: password
|
||||
artifactory:
|
||||
masterKey: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
migration:
|
||||
enabled: false
|
|
@ -0,0 +1,12 @@
|
|||
databaseUpgradeReady: true
|
||||
artifactory:
|
||||
masterKey: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
persistence:
|
||||
enabled: true
|
||||
|
||||
postgresql:
|
||||
postgresqlPassword: "password"
|
||||
postgresqlExtendedConf:
|
||||
maxConnections: "102"
|
||||
persistence:
|
||||
enabled: true
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,32 @@
|
|||
migration:
|
||||
product: ARTIFACTORY
|
||||
oldDataDir: /var/opt/jfrog/artifactory
|
||||
moveDirectories:
|
||||
map:
|
||||
# Note : $JF_ROOT_DATA_DIR will be prepended to the sourceDirectoryPath value only if relative path and $JF_ROOT_DATA_DIR/var will be prepended to the targetDirectoryPath value
|
||||
# map should be in format example: targetDirectoryPath=sourceDirectoryPath
|
||||
backup/access=access/backup
|
||||
etc/access=access/etc
|
||||
data/access=access/data
|
||||
work/access=access/tmp
|
||||
log/archived/access=access/logs
|
||||
log/archived/artifactory=logs
|
||||
etc/replicator=replicator/etc
|
||||
backup/replicator=replicator/backup
|
||||
data/replicator=replicator/data
|
||||
log/archived/replicator=replicator/logs
|
||||
linkFiles:
|
||||
map:
|
||||
# Note : $JF_ROOT_DATA_DIR will be prepended to the sourceDirectoryPath value only if relative path and $JF_ROOT_DATA_DIR will be prepended to the targetDirectoryPath value
|
||||
# map should be in format example: targetDirectoryPath=sourceDirectoryPath
|
||||
etc/artifactory=etc
|
||||
backup/artifactory=backup
|
||||
data/artifactory=data
|
||||
support/artifactory=support
|
||||
cleanUpOldDataDir:
|
||||
# Note $JF_ROOT_DATA_DIR will be prepended to the map entry
|
||||
map:
|
||||
access
|
||||
replicator
|
||||
metadata
|
||||
logs
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
|
||||
statusCheck(){
|
||||
local retries=0
|
||||
# Max Timeout in seconds default ~3600
|
||||
local maxTimeOutInSeconds=$1
|
||||
MaxRetries=$(( maxTimeOutInSeconds/10 ))
|
||||
# Wait for DB to start
|
||||
sleep 30
|
||||
until [ "`curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:8082/router/api/v1/system/health`" == "200" ];
|
||||
do
|
||||
echo Waiting for Artifactory to start --- sleeping for 10 seconds
|
||||
if [[ ${retries} -eq ${MaxRetries} ]]
|
||||
then
|
||||
echo Failed to start.
|
||||
exit 1
|
||||
fi
|
||||
retries=$(( retries+1 ))
|
||||
sleep 10
|
||||
done
|
||||
|
||||
sleep 20
|
||||
echo "Artifactory started sucessfully...in Init Container"
|
||||
echo "Stopping artifactory in Init Container..."
|
||||
${scriptsPath}/artifactory.sh stop
|
||||
echo "Exiting Init Container..."
|
||||
|
||||
}
|
||||
|
||||
scriptsPath="/opt/jfrog/artifactory/app/bin"
|
||||
maxTimeOut=$2
|
||||
bash ${scriptsPath}/migrate.sh $1
|
||||
status=$?
|
||||
if [[ ${status} -eq 1 && -f /tmp/error ]]; then
|
||||
echo "Migration is not supported ...Exiting Init Container"
|
||||
exit 1
|
||||
elif [[ ${status} -eq 0 ]]; then
|
||||
echo "Waiting for Artifactory to start in Init Container"
|
||||
/entrypoint-artifactory.sh &
|
||||
statusCheck ${maxTimeOut}
|
||||
else
|
||||
echo "Migration not necessary...Exiting Init Container"
|
||||
exit 0
|
||||
fi
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
|
@ -0,0 +1,424 @@
|
|||
questions:
|
||||
# Advance Settings
|
||||
- variable: artifactory.masterKey
|
||||
default: "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
|
||||
description: "Artifactory master key. For security reasons, we strongly recommend you generate your own master key using this command: 'openssl rand -hex 32'"
|
||||
type: string
|
||||
label: Artifactory master key
|
||||
group: "Security Settings"
|
||||
|
||||
# Container Images
|
||||
- variable: defaultImage
|
||||
default: true
|
||||
description: "Use default Docker image"
|
||||
label: Use Default Image
|
||||
type: boolean
|
||||
show_subquestion_if: false
|
||||
group: "Container Images"
|
||||
subquestions:
|
||||
- variable: initContainerImage
|
||||
default: "docker.bintray.io/alpine:3.12"
|
||||
description: "Init image name"
|
||||
type: string
|
||||
label: Init image name
|
||||
- variable: artifactory.image.repository
|
||||
default: "docker.bintray.io/jfrog/artifactory-pro"
|
||||
description: "Artifactory image name"
|
||||
type: string
|
||||
label: Artifactory Image Name
|
||||
- variable: artifactory.image.version
|
||||
default: "7.6.3"
|
||||
description: "Artifactory image tag"
|
||||
type: string
|
||||
label: Artifactory Image Tag
|
||||
- variable: nginx.image.repository
|
||||
default: "docker.bintray.io/jfrog/nginx-artifactory-pro"
|
||||
description: "Nginx image name"
|
||||
type: string
|
||||
label: Nginx Image Name
|
||||
- variable: nginx.image.version
|
||||
default: "7.6.3"
|
||||
description: "Nginx image tag"
|
||||
type: string
|
||||
label: Nginx Image Tag
|
||||
- variable: imagePullSecrets
|
||||
description: "Image Pull Secret"
|
||||
type: string
|
||||
label: Image Pull Secret
|
||||
|
||||
# Services and LoadBalancing Settings
|
||||
- variable: artifactory.node.replicaCount
|
||||
default: "2"
|
||||
description: "Number of Secondary Nodes"
|
||||
type: string
|
||||
label: Number of Secondary Nodes
|
||||
show_subquestion_if: true
|
||||
group: "Services and Load Balancing"
|
||||
- variable: ingress.enabled
|
||||
default: false
|
||||
description: "Expose app using Layer 7 Load Balancer - ingress"
|
||||
type: boolean
|
||||
label: Expose app using Layer 7 Load Balancer
|
||||
show_subquestion_if: true
|
||||
group: "Services and Load Balancing"
|
||||
required: true
|
||||
subquestions:
|
||||
- variable: ingress.hosts[0]
|
||||
default: "xip.io"
|
||||
description: "Hostname to your artifactory installation"
|
||||
type: hostname
|
||||
required: true
|
||||
label: Hostname
|
||||
|
||||
# Nginx Settings
|
||||
- variable: nginx.enabled
|
||||
default: true
|
||||
description: "Enable nginx server"
|
||||
type: boolean
|
||||
label: Enable Nginx Server
|
||||
group: "Services and Load Balancing"
|
||||
required: true
|
||||
show_if: "ingress.enabled=false"
|
||||
- variable: nginx.service.type
|
||||
default: "LoadBalancer"
|
||||
description: "Nginx service type"
|
||||
type: enum
|
||||
required: true
|
||||
label: Nginx Service Type
|
||||
show_if: "nginx.enabled=true&&ingress.enabled=false"
|
||||
group: "Services and Load Balancing"
|
||||
options:
|
||||
- "ClusterIP"
|
||||
- "NodePort"
|
||||
- "LoadBalancer"
|
||||
- variable: nginx.service.loadBalancerIP
|
||||
default: ""
|
||||
description: "Provide Static IP to configure with Nginx"
|
||||
type: string
|
||||
label: Config Nginx LoadBalancer IP
|
||||
show_if: "nginx.enabled=true&&nginx.service.type=LoadBalancer&&ingress.enabled=false"
|
||||
group: "Services and Load Balancing"
|
||||
- variable: nginx.tlsSecretName
|
||||
default: ""
|
||||
description: "Provide SSL Secret name to configure with Nginx"
|
||||
type: string
|
||||
label: Config Nginx SSL Secret
|
||||
show_if: "nginx.enabled=true&&ingress.enabled=false"
|
||||
group: "Services and Load Balancing"
|
||||
- variable: nginx.customArtifactoryConfigMap
|
||||
default: ""
|
||||
description: "Provide configMap name to configure Nginx with custom `artifactory.conf`"
|
||||
type: string
|
||||
label: ConfigMap for Nginx Artifactory Config
|
||||
show_if: "nginx.enabled=true&&ingress.enabled=false"
|
||||
group: "Services and Load Balancing"
|
||||
|
||||
# Artifactory Storage Settings
|
||||
- variable: artifactory.persistence.size
|
||||
default: "50Gi"
|
||||
description: "Artifactory persistent volume size"
|
||||
type: string
|
||||
label: Artifactory Persistent Volume Size
|
||||
required: true
|
||||
group: "Artifactory Storage"
|
||||
- variable: artifactory.persistence.type
|
||||
default: "file-system"
|
||||
description: "Artifactory persistent volume size"
|
||||
type: enum
|
||||
label: Artifactory Persistent Storage Type
|
||||
required: true
|
||||
options:
|
||||
- "file-system"
|
||||
- "nfs"
|
||||
- "google-storage"
|
||||
- "aws-s3"
|
||||
group: "Artifactory Storage"
|
||||
|
||||
#Storage Type Settings
|
||||
- variable: artifactory.persistence.nfs.ip
|
||||
default: ""
|
||||
type: string
|
||||
group: "Artifactory Storage"
|
||||
label: NFS Server IP
|
||||
description: "NFS server IP"
|
||||
show_if: "artifactory.persistence.type=nfs"
|
||||
- variable: artifactory.persistence.nfs.haDataMount
|
||||
default: "/data"
|
||||
type: string
|
||||
label: NFS Data Directory
|
||||
description: "NFS data directory"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=nfs"
|
||||
- variable: artifactory.persistence.nfs.haBackupMount
|
||||
default: "/backup"
|
||||
type: string
|
||||
label: NFS Backup Directory
|
||||
description: "NFS backup directory"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=nfs"
|
||||
- variable: artifactory.persistence.nfs.dataDir
|
||||
default: "/var/opt/jfrog/artifactory-ha"
|
||||
type: string
|
||||
label: HA Data Directory
|
||||
description: "HA data directory"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=nfs"
|
||||
- variable: artifactory.persistence.nfs.backupDir
|
||||
default: "/var/opt/jfrog/artifactory-backup"
|
||||
type: string
|
||||
label: HA Backup Directory
|
||||
description: "HA backup directory "
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=nfs"
|
||||
- variable: artifactory.persistence.nfs.capacity
|
||||
default: "200Gi"
|
||||
type: string
|
||||
label: NFS PVC Size
|
||||
description: "NFS PVC size "
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=nfs"
|
||||
|
||||
#Google storage settings
|
||||
- variable: artifactory.persistence.googleStorage.bucketName
|
||||
default: "artifactory-ha-gcp"
|
||||
type: string
|
||||
label: Google Storage Bucket Name
|
||||
description: "Google storage bucket name"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=google-storage"
|
||||
- variable: artifactory.persistence.googleStorage.identity
|
||||
default: ""
|
||||
type: string
|
||||
label: Google Storage Service Account ID
|
||||
description: "Google Storage service account id"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=google-storage"
|
||||
- variable: artifactory.persistence.googleStorage.credential
|
||||
default: ""
|
||||
type: string
|
||||
label: Google Storage Service Account Key
|
||||
description: "Google Storage service account key"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=google-storage"
|
||||
- variable: artifactory.persistence.googleStorage.path
|
||||
default: "artifactory-ha/filestore"
|
||||
type: string
|
||||
label: Google Storage Path In Bucket
|
||||
description: "Google Storage path in bucket"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=google-storage"
|
||||
# awsS3 storage settings
|
||||
- variable: artifactory.persistence.awsS3.bucketName
|
||||
default: "artifactory-ha-aws"
|
||||
type: string
|
||||
label: AWS S3 Bucket Name
|
||||
description: "AWS S3 bucket name"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=aws-s3"
|
||||
- variable: artifactory.persistence.awsS3.region
|
||||
default: ""
|
||||
type: string
|
||||
label: AWS S3 Bucket Region
|
||||
description: "AWS S3 bucket region"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=aws-s3"
|
||||
- variable: artifactory.persistence.awsS3.identity
|
||||
default: ""
|
||||
type: string
|
||||
label: AWS S3 AWS_ACCESS_KEY_ID
|
||||
description: "AWS S3 AWS_ACCESS_KEY_ID"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=aws-s3"
|
||||
- variable: artifactory.persistence.awsS3.credential
|
||||
default: ""
|
||||
type: string
|
||||
label: AWS S3 AWS_SECRET_ACCESS_KEY
|
||||
description: "AWS S3 AWS_SECRET_ACCESS_KEY"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=aws-s3"
|
||||
- variable: artifactory.persistence.awsS3.path
|
||||
default: "artifactory-ha/filestore"
|
||||
type: string
|
||||
label: AWS S3 Path In Bucket
|
||||
description: "AWS S3 path in bucket"
|
||||
group: "Artifactory Storage"
|
||||
show_if: "artifactory.persistence.type=aws-s3"
|
||||
|
||||
# Database Settings
|
||||
- variable: postgresql.enabled
|
||||
default: true
|
||||
description: "Enable PostgreSQL"
|
||||
type: boolean
|
||||
required: true
|
||||
label: Enable PostgreSQL
|
||||
group: "Database Settings"
|
||||
show_subquestion_if: true
|
||||
subquestions:
|
||||
- variable: postgresql.postgresqlPassword
|
||||
default: ""
|
||||
description: "PostgreSQL password"
|
||||
type: password
|
||||
required: true
|
||||
label: PostgreSQL Password
|
||||
group: "Database Settings"
|
||||
show_if: "postgresql.enabled=true"
|
||||
- variable: postgresql.persistence.size
|
||||
default: 20Gi
|
||||
description: "PostgreSQL persistent volume size"
|
||||
type: string
|
||||
label: PostgreSQL Persistent Volume Size
|
||||
show_if: "postgresql.enabled=true"
|
||||
- variable: postgresql.persistence.storageClass
|
||||
default: ""
|
||||
description: "If undefined or null, uses the default StorageClass. Default to null"
|
||||
type: storageclass
|
||||
label: Default StorageClass for PostgreSQL
|
||||
show_if: "postgresql.enabled=true"
|
||||
- variable: postgresql.resources.requests.cpu
|
||||
default: "200m"
|
||||
description: "PostgreSQL initial cpu request"
|
||||
type: string
|
||||
label: PostgreSQL Initial CPU Request
|
||||
show_if: "postgresql.enabled=true"
|
||||
- variable: postgresql.resources.requests.memory
|
||||
default: "500Mi"
|
||||
description: "PostgreSQL initial memory request"
|
||||
type: string
|
||||
label: PostgreSQL Initial Memory Request
|
||||
show_if: "postgresql.enabled=true"
|
||||
- variable: postgresql.resources.limits.cpu
|
||||
default: "1"
|
||||
description: "PostgreSQL cpu limit"
|
||||
type: string
|
||||
label: PostgreSQL CPU Limit
|
||||
show_if: "postgresql.enabled=true"
|
||||
- variable: postgresql.resources.limits.memory
|
||||
default: "1Gi"
|
||||
description: "PostgreSQL memory limit"
|
||||
type: string
|
||||
label: PostgreSQL Memory Limit
|
||||
show_if: "postgresql.enabled=true"
|
||||
- variable: database.type
|
||||
default: "postgresql"
|
||||
description: "xternal database type (postgresql, mysql, oracle or mssql)"
|
||||
type: enum
|
||||
required: true
|
||||
label: External Database Type
|
||||
group: "Database Settings"
|
||||
show_if: "postgresql.enabled=false"
|
||||
options:
|
||||
- "postgresql"
|
||||
- "mysql"
|
||||
- "oracle"
|
||||
- "mssql"
|
||||
- variable: database.url
|
||||
default: ""
|
||||
description: "External database URL. If you set the url, leave host and port empty"
|
||||
type: string
|
||||
label: External Database URL
|
||||
group: "Database Settings"
|
||||
show_if: "postgresql.enabled=false"
|
||||
- variable: database.host
|
||||
default: ""
|
||||
description: "External database hostname"
|
||||
type: string
|
||||
label: External Database Hostname
|
||||
group: "Database Settings"
|
||||
show_if: "postgresql.enabled=false"
|
||||
- variable: database.port
|
||||
default: ""
|
||||
description: "External database port"
|
||||
type: string
|
||||
label: External Database Port
|
||||
group: "Database Settings"
|
||||
show_if: "postgresql.enabled=false"
|
||||
- variable: database.user
|
||||
default: ""
|
||||
description: "External database username"
|
||||
type: string
|
||||
label: External Database Username
|
||||
group: "Database Settings"
|
||||
show_if: "postgresql.enabled=false"
|
||||
- variable: database.password
|
||||
default: ""
|
||||
description: "External database password"
|
||||
type: password
|
||||
label: External Database Password
|
||||
group: "Database Settings"
|
||||
show_if: "postgresql.enabled=false"
|
||||
|
||||
# Advance Settings
|
||||
- variable: advancedOptions
|
||||
default: false
|
||||
description: "Show advanced configurations"
|
||||
label: Show Advanced Configurations
|
||||
type: boolean
|
||||
show_subquestion_if: true
|
||||
group: "Advanced Options"
|
||||
subquestions:
|
||||
- variable: artifactory.primary.resources.requests.cpu
|
||||
default: "500m"
|
||||
description: "Artifactory primary node initial cpu request"
|
||||
type: string
|
||||
label: Artifactory Primary Node Initial CPU Request
|
||||
- variable: artifactory.primary.resources.requests.memory
|
||||
default: "1Gi"
|
||||
description: "Artifactory primary node initial memory request"
|
||||
type: string
|
||||
label: Artifactory Primary Node Initial Memory Request
|
||||
- variable: artifactory.primary.javaOpts.xms
|
||||
default: "1g"
|
||||
description: "Artifactory primary node java Xms size"
|
||||
type: string
|
||||
label: Artifactory Primary Node Java Xms Size
|
||||
- variable: artifactory.primary.resources.limits.cpu
|
||||
default: "2"
|
||||
description: "Artifactory primary node cpu limit"
|
||||
type: string
|
||||
label: Artifactory Primary Node CPU Limit
|
||||
- variable: artifactory.primary.resources.limits.memory
|
||||
default: "4Gi"
|
||||
description: "Artifactory primary node memory limit"
|
||||
type: string
|
||||
label: Artifactory Primary Node Memory Limit
|
||||
- variable: artifactory.primary.javaOpts.xmx
|
||||
default: "4g"
|
||||
description: "Artifactory primary node java Xmx size"
|
||||
type: string
|
||||
label: Artifactory Primary Node Java Xmx Size
|
||||
- variable: artifactory.node.resources.requests.cpu
|
||||
default: "500m"
|
||||
description: "Artifactory member node initial cpu request"
|
||||
type: string
|
||||
label: Artifactory Member Node Initial CPU Request
|
||||
- variable: artifactory.node.resources.requests.memory
|
||||
default: "2Gi"
|
||||
description: "Artifactory member node initial memory request"
|
||||
type: string
|
||||
label: Artifactory Member Node Initial Memory Request
|
||||
- variable: artifactory.node.javaOpts.xms
|
||||
default: "1g"
|
||||
description: "Artifactory member node java Xms size"
|
||||
type: string
|
||||
label: Artifactory Member Node Java Xms Size
|
||||
- variable: artifactory.node.resources.limits.cpu
|
||||
default: "2"
|
||||
description: "Artifactory member node cpu limit"
|
||||
type: string
|
||||
label: Artifactory Member Node CPU Limit
|
||||
- variable: artifactory.node.resources.limits.memory
|
||||
default: "4Gi"
|
||||
description: "Artifactory member node memory limit"
|
||||
type: string
|
||||
label: Artifactory Member Node Memory Limit
|
||||
- variable: artifactory.node.javaOpts.xmx
|
||||
default: "4g"
|
||||
description: "Artifactory member node java Xmx size"
|
||||
type: string
|
||||
label: Artifactory Member Node Java Xmx Size
|
||||
|
||||
# Internal Settings
|
||||
- variable: installerInfo
|
||||
default: '\{\"productId\": \"RancherHelm_artifactory-ha/7.17.5\", \"features\": \[\{\"featureId\": \"Partner/ACC-007246\"\}\]\}'
|
||||
type: string
|
||||
group: "Internal Settings (Do not modify)"
|
|
@ -0,0 +1,6 @@
|
|||
dependencies:
|
||||
- name: postgresql
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 9.3.4
|
||||
digest: sha256:6c6c7ebc7f0c35a6df917879cd7c51e226f31a4d320e053b3620c5476287e9b8
|
||||
generated: "2020-09-02T09:49:07.304103+05:30"
|
|
@ -0,0 +1,4 @@
|
|||
dependencies:
|
||||
- condition: postgresql.enabled
|
||||
name: postgresql
|
||||
repository: file://./charts/postgresql
|
|
@ -0,0 +1,20 @@
|
|||
## Apache License Version 2.0
|
||||
## http://www.apache.org/licenses/LICENSE-2.0.txt
|
||||
|
||||
## Schema version of this YAML file
|
||||
schemaVersion: v1
|
||||
|
||||
## Overall mitigation summary
|
||||
summary: Security mitigation information for this application is tracked by the security-mitigation.yaml file that's part of this helm chart.
|
||||
|
||||
## Mitigation notes for individual CVEs
|
||||
mitigations:
|
||||
- cves:
|
||||
- CVE-2017-8399
|
||||
## Indicates package Uri for which the security mitigation is provided. helm://… || docker://…
|
||||
affectedPackageUri: helm://jfrog/artifactory-ha
|
||||
## Which chart versions this cve note belongs to
|
||||
affectedVersions: ">= 3.1.0"
|
||||
## Description / note
|
||||
description: This CVE needs to be fixed in the alpine base image of nginx container.
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
Congratulations. You have just deployed JFrog Artifactory HA!
|
||||
|
||||
{{- if .Values.artifactory.masterKey }}
|
||||
{{- if and (not .Values.artifactory.masterKeySecretName) (eq .Values.artifactory.masterKey "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") }}
|
||||
|
||||
|
||||
***************************************** WARNING ******************************************
|
||||
* Your Artifactory master key is still set to the provided example: *
|
||||
* artifactory.masterKey=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF *
|
||||
* *
|
||||
* You should change this to your own generated key: *
|
||||
* $ export MASTER_KEY=$(openssl rand -hex 32) *
|
||||
* $ echo ${MASTER_KEY} *
|
||||
* *
|
||||
* Pass the created master key to helm with '--set artifactory.masterKey=${MASTER_KEY}' *
|
||||
* *
|
||||
* Alternatively, you can use a pre-existing secret with a key called master-key with *
|
||||
* '--set artifactory.masterKeySecretName=${SECRET_NAME}' *
|
||||
********************************************************************************************
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.artifactory.joinKey }}
|
||||
{{- if eq .Values.artifactory.joinKey "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE" }}
|
||||
|
||||
|
||||
***************************************** WARNING ******************************************
|
||||
* Your Artifactory join key is still set to the provided example: *
|
||||
* artifactory.joinKey=EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE *
|
||||
* *
|
||||
* You should change this to your own generated key: *
|
||||
* $ export JOIN_KEY=$(openssl rand -hex 32) *
|
||||
* $ echo ${JOIN_KEY} *
|
||||
* *
|
||||
* Pass the created master key to helm with '--set artifactory.joinKey=${JOIN_KEY}' *
|
||||
* *
|
||||
********************************************************************************************
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
|
||||
DATABASE:
|
||||
To extract the database password, run the following
|
||||
export DB_PASSWORD=$(kubectl get --namespace {{ .Release.Namespace }} $(kubectl get secret --namespace {{ .Release.Namespace }} -o name | grep postgresql) -o jsonpath="{.data.postgresql-password}" | base64 --decode)
|
||||
echo ${DB_PASSWORD}
|
||||
{{- end }}
|
||||
|
||||
SETUP:
|
||||
1. Get the Artifactory IP and URL
|
||||
|
||||
{{- if contains "NodePort" .Values.nginx.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "artifactory-ha.nginx.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT/
|
||||
|
||||
{{- else if contains "LoadBalancer" .Values.nginx.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer public IP to be available!
|
||||
|
||||
You can watch the status of the service by running 'kubectl get svc -w {{ template "artifactory-ha.nginx.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "artifactory-ha.nginx.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP/
|
||||
|
||||
{{- else if contains "ClusterIP" .Values.nginx.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "component={{ .Values.nginx.name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME 8080:80
|
||||
echo http://127.0.0.1:8080
|
||||
|
||||
{{- end }}
|
||||
|
||||
2. Open Artifactory in your browser
|
||||
Default credential for Artifactory:
|
||||
user: admin
|
||||
password: password
|
||||
|
||||
{{- if .Values.artifactory.license.secret }}
|
||||
|
||||
3. Artifactory license(s) is deployed as a Kubernetes secret. This method is relevant for initial deployment only!
|
||||
Updating the license should be done via Artifactory UI or REST API. If you want to keep managing the artifactory license using the same method, you can use artifactory.copyOnEveryStartup in values.yaml.
|
||||
|
||||
{{- else }}
|
||||
|
||||
3. Add HA licenses to activate Artifactory HA through the Artifactory UI
|
||||
NOTE: Each Artifactory node requires a valid license. See https://www.jfrog.com/confluence/display/RTF/HA+Installation+and+Setup for more details.
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{ if or .Values.artifactory.primary.javaOpts.jmx.enabled .Values.artifactory.node.javaOpts.jmx.enabled }}
|
||||
JMX configuration:
|
||||
{{- if not (contains "LoadBalancer" .Values.artifactory.service.type) }}
|
||||
If you want to access JMX from you computer with jconsole, you should set ".Values.artifactory.service.type=LoadBalancer" !!!
|
||||
{{ end }}
|
||||
|
||||
1. Get the Artifactory service IP:
|
||||
{{- if .Values.artifactory.primary.javaOpts.jmx.enabled }}
|
||||
export PRIMARY_SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "artifactory-ha.primary.name" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.node.javaOpts.jmx.enabled }}
|
||||
export MEMBER_SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "artifactory-ha.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
{{- end }}
|
||||
|
||||
2. Map the service name to the service IP in /etc/hosts:
|
||||
{{- if .Values.artifactory.primary.javaOpts.jmx.enabled }}
|
||||
sudo sh -c "echo \"${PRIMARY_SERVICE_IP} {{ template "artifactory-ha.primary.name" . }}\" >> /etc/hosts"
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.node.javaOpts.jmx.enabled }}
|
||||
sudo sh -c "echo \"${MEMBER_SERVICE_IP} {{ template "artifactory-ha.fullname" . }}\" >> /etc/hosts"
|
||||
{{- end }}
|
||||
|
||||
3. Launch jconsole:
|
||||
{{- if .Values.artifactory.primary.javaOpts.jmx.enabled }}
|
||||
jconsole {{ template "artifactory-ha.primary.name" . }}:{{ .Values.artifactory.primary.javaOpts.jmx.port }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.node.javaOpts.jmx.enabled }}
|
||||
jconsole {{ template "artifactory-ha.fullname" . }}:{{ .Values.artifactory.node.javaOpts.jmx.port }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,302 @@
|
|||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "artifactory-ha.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
The primary node name
|
||||
*/}}
|
||||
{{- define "artifactory-ha.primary.name" -}}
|
||||
{{- if .Values.nameOverride -}}
|
||||
{{- printf "%s-primary" .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := .Release.Name | trunc 29 -}}
|
||||
{{- printf "%s-%s-primary" $name .Chart.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
The member node name
|
||||
*/}}
|
||||
{{- define "artifactory-ha.node.name" -}}
|
||||
{{- if .Values.nameOverride -}}
|
||||
{{- printf "%s-member" .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := .Release.Name | trunc 29 -}}
|
||||
{{- printf "%s-%s-member" $name .Chart.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Expand the name nginx service.
|
||||
*/}}
|
||||
{{- define "artifactory-ha.nginx.name" -}}
|
||||
{{- default .Values.nginx.name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "artifactory-ha.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified Replicator app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "artifactory-ha.replicator.fullname" -}}
|
||||
{{- if .Values.artifactory.replicator.ingress.name -}}
|
||||
{{- .Values.artifactory.replicator.ingress.name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-replication" .Chart.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified replicator tracker ingress name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "artifactory-ha.replicator.tracker.fullname" -}}
|
||||
{{- if .Values.artifactory.replicator.trackerIngress.name -}}
|
||||
{{- .Values.artifactory.replicator.trackerIngress.name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-replication-tracker" .Chart.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "artifactory-ha.nginx.fullname" -}}
|
||||
{{- if .Values.nginx.fullnameOverride -}}
|
||||
{{- .Values.nginx.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nginx.name -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "artifactory-ha.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{ default (include "artifactory-ha.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{ default "default" .Values.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "artifactory-ha.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Generate SSL certificates
|
||||
*/}}
|
||||
{{- define "artifactory-ha.gen-certs" -}}
|
||||
{{- $altNames := list ( printf "%s.%s" (include "artifactory-ha.name" .) .Release.Namespace ) ( printf "%s.%s.svc" (include "artifactory-ha.name" .) .Release.Namespace ) -}}
|
||||
{{- $ca := genCA "artifactory-ca" 365 -}}
|
||||
{{- $cert := genSignedCert ( include "artifactory-ha.name" . ) nil $altNames 365 $ca -}}
|
||||
tls.crt: {{ $cert.Cert | b64enc }}
|
||||
tls.key: {{ $cert.Key | b64enc }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Scheme (http/https) based on Access TLS enabled/disabled
|
||||
*/}}
|
||||
{{- define "artifactory-ha.scheme" -}}
|
||||
{{- if .Values.access.accessConfig.security.tls -}}
|
||||
{{- printf "%s" "https" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s" "http" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Resolve joinKey value
|
||||
*/}}
|
||||
{{- define "artifactory-ha.joinKey" -}}
|
||||
{{- if .Values.global.joinKey -}}
|
||||
{{- .Values.global.joinKey -}}
|
||||
{{- else if .Values.artifactory.joinKey -}}
|
||||
{{- .Values.artifactory.joinKey -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Resolve masterKey value
|
||||
*/}}
|
||||
{{- define "artifactory-ha.masterKey" -}}
|
||||
{{- if .Values.global.masterKey -}}
|
||||
{{- .Values.global.masterKey -}}
|
||||
{{- else if .Values.artifactory.masterKey -}}
|
||||
{{- .Values.artifactory.masterKey -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Resolve joinKeySecretName value
|
||||
*/}}
|
||||
{{- define "artifactory-ha.joinKeySecretName" -}}
|
||||
{{- if .Values.global.joinKeySecretName -}}
|
||||
{{- .Values.global.joinKeySecretName -}}
|
||||
{{- else if .Values.artifactory.joinKeySecretName -}}
|
||||
{{- .Values.artifactory.joinKeySecretName -}}
|
||||
{{- else -}}
|
||||
{{ include "artifactory-ha.fullname" . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Resolve masterKeySecretName value
|
||||
*/}}
|
||||
{{- define "artifactory-ha.masterKeySecretName" -}}
|
||||
{{- if .Values.global.masterKeySecretName -}}
|
||||
{{- .Values.global.masterKeySecretName -}}
|
||||
{{- else if .Values.artifactory.masterKeySecretName -}}
|
||||
{{- .Values.artifactory.masterKeySecretName -}}
|
||||
{{- else -}}
|
||||
{{ include "artifactory-ha.fullname" . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Resolve imagePullSecrets value
|
||||
*/}}
|
||||
{{- define "artifactory-ha.imagePullSecrets" -}}
|
||||
{{- if .Values.global.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.global.imagePullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- else if .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- range .Values.imagePullSecrets }}
|
||||
- name: {{ . }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Resolve customInitContainersBegin value
|
||||
*/}}
|
||||
{{- define "artifactory-ha.customInitContainersBegin" -}}
|
||||
{{- if .Values.global.customInitContainersBegin -}}
|
||||
{{- .Values.global.customInitContainersBegin -}}
|
||||
{{- else if .Values.artifactory.customInitContainersBegin -}}
|
||||
{{- .Values.artifactory.customInitContainersBegin -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Resolve customInitContainers value
|
||||
*/}}
|
||||
{{- define "artifactory-ha.customInitContainers" -}}
|
||||
{{- if .Values.global.customInitContainers -}}
|
||||
{{- .Values.global.customInitContainers -}}
|
||||
{{- else if .Values.artifactory.customInitContainers -}}
|
||||
{{- .Values.artifactory.customInitContainers -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Resolve customVolumes value
|
||||
*/}}
|
||||
{{- define "artifactory-ha.customVolumes" -}}
|
||||
{{- if .Values.global.customVolumes -}}
|
||||
{{- .Values.global.customVolumes -}}
|
||||
{{- else if .Values.artifactory.customVolumes -}}
|
||||
{{- .Values.artifactory.customVolumes -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Resolve customVolumeMounts value
|
||||
*/}}
|
||||
{{- define "artifactory-ha.customVolumeMounts" -}}
|
||||
{{- if .Values.global.customVolumeMounts -}}
|
||||
{{- .Values.global.customVolumeMounts -}}
|
||||
{{- else if .Values.artifactory.customVolumeMounts -}}
|
||||
{{- .Values.artifactory.customVolumeMounts -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Resolve customSidecarContainers value
|
||||
*/}}
|
||||
{{- define "artifactory-ha.customSidecarContainers" -}}
|
||||
{{- if .Values.global.customSidecarContainers -}}
|
||||
{{- .Values.global.customSidecarContainers -}}
|
||||
{{- else if .Values.artifactory.customSidecarContainers -}}
|
||||
{{- .Values.artifactory.customSidecarContainers -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper artifactory chart image names
|
||||
*/}}
|
||||
{{- define "artifactory-ha.getImageInfoByValue" -}}
|
||||
{{- $dot := index . 0 }}
|
||||
{{- $indexReference := index . 1 }}
|
||||
{{- $registryName := index $dot.Values $indexReference "image" "registry" -}}
|
||||
{{- $repositoryName := index $dot.Values $indexReference "image" "repository" -}}
|
||||
{{- $tag := default $dot.Chart.AppVersion (index $dot.Values $indexReference "image" "tag") | toString -}}
|
||||
{{- if $dot.Values.global }}
|
||||
{{- if and $dot.Values.global.versions.artifactory (or (eq $indexReference "artifactory") (eq $indexReference "nginx") ) }}
|
||||
{{- $tag = $dot.Values.global.versions.artifactory | toString -}}
|
||||
{{- end -}}
|
||||
{{- if $dot.Values.global.imageRegistry }}
|
||||
{{- printf "%s/%s:%s" $dot.Values.global.imageRegistry $repositoryName $tag -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper artifactory app version
|
||||
*/}}
|
||||
{{- define "artifactory-ha.app.version" -}}
|
||||
{{- $image := split ":" ((include "artifactory-ha.getImageInfoByValue" (list . "artifactory")) | toString) -}}
|
||||
{{- $tag := $image._1 -}}
|
||||
{{- printf "%s" $tag -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Custom certificate copy command
|
||||
*/}}
|
||||
{{- define "artifactory-ha.copyCustomCerts" -}}
|
||||
echo "Copy custom certificates to {{ .Values.artifactory.persistence.mountPath }}/etc/security/keys/trusted";
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/etc/security/keys/trusted;
|
||||
find /tmp/certs -type f -not -name "*.key" -exec cp -v {} {{ .Values.artifactory.persistence.mountPath }}/etc/security/keys/trusted \;;
|
||||
find {{ .Values.artifactory.persistence.mountPath }}/etc/security/keys/trusted/ -type f -name "tls.crt" -exec mv -v {} {{ .Values.artifactory.persistence.mountPath }}/etc/security/keys/trusted/ca.crt \;;
|
||||
{{- end -}}
|
|
@ -0,0 +1,3 @@
|
|||
{{ if .Values.additionalResources }}
|
||||
{{ tpl .Values.additionalResources . }}
|
||||
{{- end -}}
|
|
@ -0,0 +1,15 @@
|
|||
{{- if not (and .Values.artifactory.admin.secret .Values.artifactory.admin.dataKey) }}
|
||||
{{- if .Values.artifactory.admin.password }}
|
||||
kind: Secret
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-bootstrap-creds
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
data:
|
||||
bootstrap.creds: {{ (printf "%s@%s=%s" .Values.artifactory.admin.username .Values.artifactory.admin.ip .Values.artifactory.admin.password) | b64enc }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,15 @@
|
|||
{{- if .Values.access.accessConfig }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-access-config
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
access.config.patch.yml: |
|
||||
{{ tpl (toYaml .Values.access.accessConfig) . | indent 4 }}
|
||||
{{- end }}
|
|
@ -0,0 +1,14 @@
|
|||
{{- if not .Values.artifactory.persistence.customBinarystoreXmlSecret }}
|
||||
kind: Secret
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-binarystore
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
stringData:
|
||||
binarystore.xml: |-
|
||||
{{ tpl .Values.artifactory.persistence.binarystoreXml . | indent 4 }}
|
||||
{{- end }}
|
|
@ -0,0 +1,13 @@
|
|||
{{ if .Values.artifactory.configMaps }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-configmaps
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.fullname" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
data:
|
||||
{{ tpl .Values.artifactory.configMaps . | indent 2 }}
|
||||
{{ end -}}
|
|
@ -0,0 +1,19 @@
|
|||
{{- if .Values.artifactory.customSecrets }}
|
||||
{{- range .Values.artifactory.customSecrets }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" $ }}-{{ .name }}
|
||||
labels:
|
||||
app: "{{ template "artifactory-ha.name" $ }}"
|
||||
chart: "{{ template "artifactory-ha.chart" $ }}"
|
||||
component: "{{ $.Values.artifactory.name }}"
|
||||
heritage: {{ $.Release.Service | quote }}
|
||||
release: {{ $.Release.Name | quote }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
{{ .key }}: |
|
||||
{{ .data | indent 4 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -0,0 +1,22 @@
|
|||
{{- if and (not .Values.database.secrets) (not .Values.postgresql.enabled) }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
type: Opaque
|
||||
data:
|
||||
{{- with .Values.database.url }}
|
||||
db-url: {{ tpl . $ | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.database.user }}
|
||||
db-user: {{ tpl . $ | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.database.password }}
|
||||
db-password: {{ tpl . $ | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,16 @@
|
|||
{{- if not .Values.artifactory.persistence.googleStorage.gcpServiceAccount.customSecretName }}
|
||||
{{- if .Values.artifactory.persistence.googleStorage.gcpServiceAccount.enabled }}
|
||||
kind: Secret
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-gcpcreds
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
stringData:
|
||||
gcp.credentials.json: |-
|
||||
{{ tpl .Values.artifactory.persistence.googleStorage.gcpServiceAccount.config . | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,12 @@
|
|||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-installer-info
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
data:
|
||||
installer-info.json: |
|
||||
{{ tpl .Values.installerInfo . }}
|
|
@ -0,0 +1,14 @@
|
|||
{{- with .Values.artifactory.license.licenseKey }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" $ }}-license
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" $ }}
|
||||
chart: {{ template "artifactory-ha.chart" $ }}
|
||||
heritage: {{ $.Release.Service }}
|
||||
release: {{ $.Release.Name }}
|
||||
type: Opaque
|
||||
data:
|
||||
artifactory.lic: {{ . | b64enc | quote }}
|
||||
{{- end }}
|
|
@ -0,0 +1,18 @@
|
|||
{{- if .Values.artifactory.migration.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-migration-scripts
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
data:
|
||||
migrate.sh: |
|
||||
{{ .Files.Get "files/migrate.sh" | indent 4 }}
|
||||
migrationHelmInfo.yaml: |
|
||||
{{ .Files.Get "files/migrationHelmInfo.yaml" | indent 4 }}
|
||||
migrationStatus.sh: |
|
||||
{{ .Files.Get "files/migrationStatus.sh" | indent 4 }}
|
||||
{{- end }}
|
|
@ -0,0 +1,34 @@
|
|||
{{- range .Values.networkpolicy }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" $ }}-{{ .name }}-networkpolicy
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" $ }}
|
||||
chart: {{ template "artifactory-ha.chart" $ }}
|
||||
release: {{ $.Release.Name }}
|
||||
heritage: {{ $.Release.Service }}
|
||||
spec:
|
||||
{{- if .podSelector }}
|
||||
podSelector:
|
||||
{{ .podSelector | toYaml | trimSuffix "\n" | indent 4 -}}
|
||||
{{ else }}
|
||||
podSelector: {}
|
||||
{{- end }}
|
||||
policyTypes:
|
||||
{{- if .ingress }}
|
||||
- Ingress
|
||||
{{- end }}
|
||||
{{- if .egress }}
|
||||
- Egress
|
||||
{{- end }}
|
||||
{{- if .ingress }}
|
||||
ingress:
|
||||
{{ .ingress | toYaml | trimSuffix "\n" | indent 2 -}}
|
||||
{{- end }}
|
||||
{{- if .egress }}
|
||||
egress:
|
||||
{{ .egress | toYaml | trimSuffix "\n" | indent 2 -}}
|
||||
{{- end }}
|
||||
---
|
||||
{{- end -}}
|
|
@ -0,0 +1,101 @@
|
|||
{{- if eq .Values.artifactory.persistence.type "nfs" }}
|
||||
### Artifactory HA data
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-data-pv
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
id: {{ template "artifactory-ha.name" . }}-data-pv
|
||||
type: nfs-volume
|
||||
spec:
|
||||
{{- if .Values.artifactory.persistence.nfs.mountOptions }}
|
||||
mountOptions:
|
||||
{{ toYaml .Values.artifactory.persistence.nfs.mountOptions | indent 4 }}
|
||||
{{- end }}
|
||||
capacity:
|
||||
storage: {{ .Values.artifactory.persistence.nfs.capacity }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
nfs:
|
||||
server: {{ .Values.artifactory.persistence.nfs.ip }}
|
||||
path: "{{ .Values.artifactory.persistence.nfs.haDataMount }}"
|
||||
readOnly: false
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-data-pvc
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
type: nfs-volume
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: ""
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.artifactory.persistence.nfs.capacity }}
|
||||
selector:
|
||||
matchLabels:
|
||||
id: {{ template "artifactory-ha.name" . }}-data-pv
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
---
|
||||
### Artifactory HA backup
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-backup-pv
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
id: {{ template "artifactory-ha.name" . }}-backup-pv
|
||||
type: nfs-volume
|
||||
spec:
|
||||
{{- if .Values.artifactory.persistence.nfs.mountOptions }}
|
||||
mountOptions:
|
||||
{{ toYaml .Values.artifactory.persistence.nfs.mountOptions | indent 4 }}
|
||||
{{- end }}
|
||||
capacity:
|
||||
storage: {{ .Values.artifactory.persistence.nfs.capacity }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
nfs:
|
||||
server: {{ .Values.artifactory.persistence.nfs.ip }}
|
||||
path: "{{ .Values.artifactory.persistence.nfs.haBackupMount }}"
|
||||
readOnly: false
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-backup-pvc
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
type: nfs-volume
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: ""
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.artifactory.persistence.nfs.capacity }}
|
||||
selector:
|
||||
matchLabels:
|
||||
id: {{ template "artifactory-ha.name" . }}-backup-pv
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- end }}
|
|
@ -0,0 +1,20 @@
|
|||
{{- if .Values.artifactory.node.minAvailable -}}
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-node
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
component: {{ .Values.artifactory.name }}
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
role: {{ template "artifactory-ha.node.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
minAvailable: {{ .Values.artifactory.node.minAvailable }}
|
||||
{{- end }}
|
|
@ -0,0 +1,777 @@
|
|||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.node.name" . }}
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- with .Values.artifactory.node.labels }}
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
serviceName: {{ template "artifactory-ha.node.name" . }}
|
||||
replicas: {{ .Values.artifactory.node.replicaCount }}
|
||||
updateStrategy: {{- toYaml .Values.artifactory.node.updateStrategy | nindent 4}}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
role: {{ template "artifactory-ha.node.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
role: {{ template "artifactory-ha.node.name" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- with .Values.artifactory.node.labels }}
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
checksum/database-secrets: {{ include (print $.Template.BasePath "/artifactory-database-secrets.yaml") . | sha256sum }}
|
||||
checksum/binarystore: {{ include (print $.Template.BasePath "/artifactory-binarystore-secret.yaml") . | sha256sum }}
|
||||
checksum/systemyaml: {{ include (print $.Template.BasePath "/artifactory-system-yaml.yaml") . | sha256sum }}
|
||||
{{- if .Values.artifactory.persistence.googleStorage.gcpServiceAccount.enabled }}
|
||||
checksum/gcpcredentials: {{ include (print $.Template.BasePath "/artifactory-gcp-credentials-secret.yaml") . | sha256sum }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.artifactory.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.artifactory.priorityClass.existingPriorityClass }}
|
||||
priorityClassName: {{ .Values.artifactory.priorityClass.existingPriorityClass }}
|
||||
{{- else -}}
|
||||
{{- if .Values.artifactory.priorityClass.create }}
|
||||
priorityClassName: {{ default (include "artifactory-ha.fullname" .) .Values.artifactory.priorityClass.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ template "artifactory-ha.serviceAccountName" . }}
|
||||
terminationGracePeriodSeconds: {{ .Values.artifactory.terminationGracePeriodSeconds }}
|
||||
{{- if or .Values.imagePullSecrets .Values.global.imagePullSecrets }}
|
||||
{{- include "artifactory-ha.imagePullSecrets" . | indent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.setSecurityContext }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.artifactory.uid }}
|
||||
fsGroup: {{ .Values.artifactory.gid }}
|
||||
{{- end }}
|
||||
initContainers:
|
||||
{{- if or .Values.artifactory.customInitContainersBegin .Values.global.customInitContainersBegin }}
|
||||
{{ tpl (include "artifactory-ha.customInitContainersBegin" .) . | indent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.persistence.enabled }}
|
||||
{{- if eq .Values.artifactory.persistence.type "file-system" }}
|
||||
{{- if .Values.artifactory.persistence.fileSystem.existingSharedClaim.enabled }}
|
||||
- name: "create-artifactory-data-dir"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- >
|
||||
mkdir -p {{ tpl .Values.artifactory.persistence.fileSystem.existingSharedClaim.dataDir . }};
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
volumeMounts:
|
||||
- mountPath: {{ .Values.artifactory.persistence.mountPath | quote }}
|
||||
name: volume
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.deleteDBPropertiesOnStartup }}
|
||||
- name: "delete-db-properties"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- 'rm -fv {{ .Values.artifactory.persistence.mountPath }}/etc/db.properties'
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
volumeMounts:
|
||||
- mountPath: {{ .Values.artifactory.persistence.mountPath | quote }}
|
||||
name: volume
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and .Values.artifactory.node.waitForPrimaryStartup.enabled }}
|
||||
- name: "wait-for-primary"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- >
|
||||
echo "Waiting for primary node to be ready...";
|
||||
{{- if and .Values.artifactory.node.waitForPrimaryStartup.enabled .Values.artifactory.node.waitForPrimaryStartup.time }}
|
||||
echo "Sleeping to allow time for primary node to come up";
|
||||
sleep {{ .Values.artifactory.node.waitForPrimaryStartup.time }};
|
||||
{{- else }}
|
||||
while [ "$(wget --spider --no-check-certificate -S -T 3 {{ include "artifactory-ha.scheme" . }}://{{ template "artifactory-ha.primary.name" . }}:{{ .Values.artifactory.externalPort }}/ 2>&1 | grep '^ HTTP/' | awk '{print $2}')" != "200" ];
|
||||
do echo "Primary not ready. Waiting..."; sleep 3;
|
||||
done;
|
||||
echo "Primary node ready!";
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
{{- end }}
|
||||
- name: 'copy-system-yaml'
|
||||
image: '{{ .Values.initContainerImage }}'
|
||||
command:
|
||||
- '/bin/sh'
|
||||
- '-c'
|
||||
- >
|
||||
echo "Copy system.yaml to {{ .Values.artifactory.persistence.mountPath }}/etc";
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/etc;
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/etc/access/keys/trusted;
|
||||
{{- if .Values.systemYamlOverride.existingSecret }}
|
||||
cp -fv /tmp/etc/{{ .Values.systemYamlOverride.dataKey }} {{ .Values.artifactory.persistence.mountPath }}/etc/system.yaml;
|
||||
{{- else }}
|
||||
cp -fv /tmp/etc/system.yaml {{ .Values.artifactory.persistence.mountPath }}/etc/system.yaml;
|
||||
{{- end }}
|
||||
echo "Remove {{ .Values.artifactory.persistence.mountPath }}/lost+found folder if exists";
|
||||
rm -rfv {{ .Values.artifactory.persistence.mountPath }}/lost+found;
|
||||
echo "Removing join.key file";
|
||||
rm -fv {{ .Values.artifactory.persistence.mountPath }}/etc/security/join.key;
|
||||
{{- if .Values.access.resetAccessCAKeys }}
|
||||
echo "Resetting Access CA Keys - load from database";
|
||||
{{- end }}
|
||||
{{- if .Values.access.customCertificatesSecretName }}
|
||||
echo "Load custom certificates from database";
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.masterKey .Values.global.masterKey .Values.artifactory.masterKeySecretName .Values.global.masterKeySecretName }}
|
||||
echo "Copy masterKey to {{ .Values.artifactory.persistence.mountPath }}/etc/security";
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/etc/security;
|
||||
echo -n ${ARTIFACTORY_MASTER_KEY} > {{ .Values.artifactory.persistence.mountPath }}/etc/security/master.key;
|
||||
env:
|
||||
- name: ARTIFACTORY_MASTER_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "artifactory-ha.masterKeySecretName" . }}
|
||||
key: master-key
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
volumeMounts:
|
||||
- name: volume
|
||||
mountPath: {{ .Values.artifactory.persistence.mountPath | quote }}
|
||||
{{- if or .Values.systemYamlOverride.existingSecret .Values.artifactory.systemYaml }}
|
||||
- name: systemyaml
|
||||
{{- if .Values.systemYamlOverride.existingSecret }}
|
||||
mountPath: "/tmp/etc/{{.Values.systemYamlOverride.dataKey}}"
|
||||
subPath: {{ .Values.systemYamlOverride.dataKey }}
|
||||
{{- else if .Values.artifactory.systemYaml }}
|
||||
mountPath: "/tmp/etc/system.yaml"
|
||||
subPath: system.yaml
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and .Values.artifactory.customPersistentPodVolumeClaim (not .Values.artifactory.customPersistentPodVolumeClaim.skipPrepareContainer) }}
|
||||
- name: "prepare-custom-persistent-volume"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- >
|
||||
chown -Rv {{ .Values.artifactory.uid }}:{{ .Values.artifactory.gid }} {{ .Values.artifactory.customPersistentPodVolumeClaim.mountPath }}
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
volumeMounts:
|
||||
- name: {{ .Values.artifactory.customPersistentPodVolumeClaim.name }}
|
||||
mountPath: {{ .Values.artifactory.customPersistentPodVolumeClaim.mountPath }}
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.customCertificates.enabled .Values.global.customCertificates.enabled }}
|
||||
- name: copy-custom-certificates
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- >
|
||||
{{ include "artifactory-ha.copyCustomCerts" . | indent 10 }}
|
||||
volumeMounts:
|
||||
- name: volume
|
||||
mountPath: {{ .Values.artifactory.persistence.mountPath }}
|
||||
- name: ca-certs
|
||||
mountPath: "/tmp/certs"
|
||||
{{- end }}
|
||||
{{- if .Values.waitForDatabase }}
|
||||
{{- if or .Values.postgresql.enabled }}
|
||||
- name: "wait-for-db"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- >
|
||||
until nc -z -w 2 {{ .Release.Name }}-postgresql {{ .Values.postgresql.service.port }} && echo database ok; do
|
||||
sleep 2;
|
||||
done;
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.customInitContainers .Values.global.customInitContainers }}
|
||||
{{ tpl (include "artifactory-ha.customInitContainers" .) . | indent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.migration.enabled }}
|
||||
- name: 'migration-artifactory-ha'
|
||||
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
|
||||
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
command:
|
||||
- '/bin/bash'
|
||||
- '-c'
|
||||
- >
|
||||
{{- if .Values.artifactory.migration.preStartCommand }}
|
||||
echo "Running custom preStartCommand command";
|
||||
{{ tpl .Values.artifactory.migration.preStartCommand . }};
|
||||
{{- end }}
|
||||
scriptsPath="/opt/jfrog/artifactory/app/bin";
|
||||
mkdir -p $scriptsPath;
|
||||
echo "Copy migration scripts and Run migration";
|
||||
cp -fv /tmp/migrate.sh $scriptsPath/migrate.sh;
|
||||
cp -fv /tmp/migrationHelmInfo.yaml $scriptsPath/migrationHelmInfo.yaml;
|
||||
cp -fv /tmp/migrationStatus.sh $scriptsPath/migrationStatus.sh;
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/log;
|
||||
bash $scriptsPath/migrationStatus.sh {{ include "artifactory-ha.app.version" . }} {{ .Values.artifactory.migration.timeoutSeconds }} > >(tee {{ .Values.artifactory.persistence.mountPath }}/log/helm-migration.log) 2>&1;
|
||||
resources:
|
||||
{{ toYaml .Values.artifactory.node.resources | indent 10 }}
|
||||
env:
|
||||
{{- if and (not .Values.waitForDatabase) (not .Values.postgresql.enabled) }}
|
||||
- name: SKIP_WAIT_FOR_EXTERNAL_DB
|
||||
value: "true"
|
||||
{{- end }}
|
||||
{{- if or .Values.database.secrets.user .Values.database.user }}
|
||||
- name: JF_SHARED_DATABASE_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.user }}
|
||||
name: {{ tpl .Values.database.secrets.user.name . }}
|
||||
key: {{ tpl .Values.database.secrets.user.key . }}
|
||||
{{- else if .Values.database.user }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-user
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{ if or .Values.database.secrets.password .Values.database.password .Values.postgresql.enabled }}
|
||||
- name: JF_SHARED_DATABASE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.password }}
|
||||
name: {{ tpl .Values.database.secrets.password.name . }}
|
||||
key: {{ tpl .Values.database.secrets.password.key . }}
|
||||
{{- else if .Values.database.password }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-password
|
||||
{{- else if .Values.postgresql.enabled }}
|
||||
name: {{ .Release.Name }}-postgresql
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.database.secrets.url .Values.database.url }}
|
||||
- name: JF_SHARED_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.url }}
|
||||
name: {{ tpl .Values.database.secrets.url.name . }}
|
||||
key: {{ tpl .Values.database.secrets.url.key . }}
|
||||
{{- else if .Values.database.url }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-url
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: JF_SHARED_NODE_PRIMARY
|
||||
value: "false"
|
||||
- name: JF_SHARED_NODE_HAENABLED
|
||||
value: "true"
|
||||
{{- with .Values.artifactory.extraEnvironmentVariables }}
|
||||
{{ tpl (toYaml .) $ | indent 8 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: migration-scripts
|
||||
mountPath: "/tmp/migrate.sh"
|
||||
subPath: migrate.sh
|
||||
- name: migration-scripts
|
||||
mountPath: "/tmp/migrationHelmInfo.yaml"
|
||||
subPath: migrationHelmInfo.yaml
|
||||
- name: migration-scripts
|
||||
mountPath: "/tmp/migrationStatus.sh"
|
||||
subPath: migrationStatus.sh
|
||||
- name: volume
|
||||
mountPath: "{{ .Values.artifactory.persistence.mountPath }}"
|
||||
{{- if eq .Values.artifactory.persistence.type "file-system" }}
|
||||
{{- if .Values.artifactory.persistence.fileSystem.existingSharedClaim.enabled }}
|
||||
{{- range $sharedClaimNumber, $e := until (.Values.artifactory.persistence.fileSystem.existingSharedClaim.numberOfExistingClaims|int) }}
|
||||
- name: artifactory-ha-data-{{ $sharedClaimNumber }}
|
||||
mountPath: "{{ tpl $.Values.artifactory.persistence.fileSystem.existingSharedClaim.dataDir $ }}/filestore{{ $sharedClaimNumber }}"
|
||||
{{- end }}
|
||||
- name: artifactory-ha-backup
|
||||
mountPath: "{{ $.Values.artifactory.persistence.fileSystem.existingSharedClaim.backupDir }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.customVolumeMounts .Values.global.customVolumeMounts }}
|
||||
{{ tpl (include "artifactory-ha.customVolumeMounts" .) . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.artifactory.persistence.type "nfs" }}
|
||||
- name: artifactory-ha-data
|
||||
mountPath: "{{ .Values.artifactory.persistence.nfs.dataDir }}"
|
||||
- name: artifactory-ha-backup
|
||||
mountPath: "{{ .Values.artifactory.persistence.nfs.backupDir }}"
|
||||
{{- else }}
|
||||
{{- if .Values.artifactory.binarystore.enabled }}
|
||||
- name: binarystore-xml
|
||||
mountPath: "/artifactory_bootstrap/binarystore.xml"
|
||||
subPath: binarystore.xml
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.persistence.googleStorage.gcpServiceAccount.enabled }}
|
||||
- name: gcpcreds-json
|
||||
mountPath: "/artifactory_bootstrap/gcp.credentials.json"
|
||||
subPath: gcp.credentials.json
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.hostAliases }}
|
||||
hostAliases:
|
||||
{{ toYaml .Values.hostAliases | indent 6 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Values.artifactory.name }}
|
||||
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
|
||||
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
command:
|
||||
- '/bin/bash'
|
||||
- '-c'
|
||||
- >
|
||||
set -e;
|
||||
{{- range .Values.artifactory.copyOnEveryStartup }}
|
||||
{{- $targetPath := printf "%s/%s" $.Values.artifactory.persistence.mountPath .target }}
|
||||
{{- $baseDirectory := regexFind ".*/" $targetPath }}
|
||||
mkdir -p {{ $baseDirectory }};
|
||||
cp -Lrf {{ .source }} {{ $.Values.artifactory.persistence.mountPath }}/{{ .target }};
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.preStartCommand }}
|
||||
echo "Running custom preStartCommand command";
|
||||
{{ tpl .Values.artifactory.preStartCommand . }};
|
||||
{{- end }}
|
||||
{{- with .Values.artifactory.node.preStartCommand }}
|
||||
echo "Running member node specific custom preStartCommand command";
|
||||
{{ tpl . $ }};
|
||||
{{- end }}
|
||||
exec /entrypoint-artifactory.sh
|
||||
{{- with .Values.artifactory.postStartCommand }}
|
||||
lifecycle:
|
||||
postStart:
|
||||
exec:
|
||||
command:
|
||||
- '/bin/bash'
|
||||
- '-c'
|
||||
- >
|
||||
echo "Running custom postStartCommand command";
|
||||
{{ tpl . $ }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if and (not .Values.waitForDatabase) (not .Values.postgresql.enabled) }}
|
||||
- name: SKIP_WAIT_FOR_EXTERNAL_DB
|
||||
value: "true"
|
||||
{{- end }}
|
||||
{{- if or .Values.database.secrets.user .Values.database.user }}
|
||||
- name: JF_SHARED_DATABASE_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.user }}
|
||||
name: {{ tpl .Values.database.secrets.user.name . }}
|
||||
key: {{ tpl .Values.database.secrets.user.key . }}
|
||||
{{- else if .Values.database.user }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-user
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{ if or .Values.database.secrets.password .Values.database.password .Values.postgresql.enabled }}
|
||||
- name: JF_SHARED_DATABASE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.password }}
|
||||
name: {{ tpl .Values.database.secrets.password.name . }}
|
||||
key: {{ tpl .Values.database.secrets.password.key . }}
|
||||
{{- else if .Values.database.password }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-password
|
||||
{{- else if .Values.postgresql.enabled }}
|
||||
name: {{ .Release.Name }}-postgresql
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.database.secrets.url .Values.database.url }}
|
||||
- name: JF_SHARED_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.url }}
|
||||
name: {{ tpl .Values.database.secrets.url.name . }}
|
||||
key: {{ tpl .Values.database.secrets.url.key . }}
|
||||
{{- else if .Values.database.url }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-url
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: JF_SHARED_NODE_PRIMARY
|
||||
value: "false"
|
||||
- name: JF_SHARED_NODE_HAENABLED
|
||||
value: "true"
|
||||
{{- with .Values.artifactory.extraEnvironmentVariables }}
|
||||
{{ tpl (toYaml .) $ | indent 8 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.artifactory.internalPort }}
|
||||
name: http
|
||||
- containerPort: {{ .Values.artifactory.internalArtifactoryPort }}
|
||||
name: http-internal
|
||||
{{- if .Values.artifactory.node.javaOpts.jmx.enabled }}
|
||||
- containerPort: {{ .Values.artifactory.node.javaOpts.jmx.port }}
|
||||
name: tcp-jmx
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.ssh.enabled }}
|
||||
- containerPort: {{ .Values.artifactory.ssh.internalPort }}
|
||||
name: tcp-ssh
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.artifactory.customPersistentVolumeClaim }}
|
||||
- name: {{ .Values.artifactory.customPersistentVolumeClaim.name }}
|
||||
mountPath: {{ .Values.artifactory.customPersistentVolumeClaim.mountPath }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.customPersistentPodVolumeClaim }}
|
||||
- name: {{ .Values.artifactory.customPersistentPodVolumeClaim.name }}
|
||||
mountPath: {{ .Values.artifactory.customPersistentPodVolumeClaim.mountPath }}
|
||||
{{- end }}
|
||||
- name: volume
|
||||
mountPath: "{{ .Values.artifactory.persistence.mountPath }}"
|
||||
{{- if eq .Values.artifactory.persistence.type "file-system" }}
|
||||
{{- if .Values.artifactory.persistence.fileSystem.existingSharedClaim.enabled }}
|
||||
{{- range $sharedClaimNumber, $e := until (.Values.artifactory.persistence.fileSystem.existingSharedClaim.numberOfExistingClaims|int) }}
|
||||
- name: artifactory-ha-data-{{ $sharedClaimNumber }}
|
||||
mountPath: "{{ tpl $.Values.artifactory.persistence.fileSystem.existingSharedClaim.dataDir $ }}/filestore{{ $sharedClaimNumber }}"
|
||||
{{- end }}
|
||||
- name: artifactory-ha-backup
|
||||
mountPath: "{{ $.Values.artifactory.persistence.fileSystem.existingSharedClaim.backupDir }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.artifactory.persistence.type "nfs" }}
|
||||
- name: artifactory-ha-data
|
||||
mountPath: "{{ .Values.artifactory.persistence.nfs.dataDir }}"
|
||||
- name: artifactory-ha-backup
|
||||
mountPath: "{{ .Values.artifactory.persistence.nfs.backupDir }}"
|
||||
{{- else }}
|
||||
{{- if .Values.artifactory.binarystore.enabled }}
|
||||
- name: binarystore-xml
|
||||
mountPath: "/artifactory_bootstrap/binarystore.xml"
|
||||
subPath: binarystore.xml
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.persistence.googleStorage.gcpServiceAccount.enabled }}
|
||||
- name: gcpcreds-json
|
||||
mountPath: "/artifactory_bootstrap/gcp.credentials.json"
|
||||
subPath: gcp.credentials.json
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.configMapName }}
|
||||
- name: bootstrap-config
|
||||
mountPath: "/bootstrap/"
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.license.secret .Values.artifactory.license.licenseKey }}
|
||||
- name: artifactory-license
|
||||
mountPath: "/artifactory_bootstrap/artifactory.cluster.license"
|
||||
{{- if .Values.artifactory.license.secret }}
|
||||
subPath: {{ .Values.artifactory.license.dataKey }}
|
||||
{{- else if .Values.artifactory.license.licenseKey }}
|
||||
subPath: artifactory.lic
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: installer-info
|
||||
mountPath: "/artifactory_bootstrap/info/installer-info.json"
|
||||
subPath: installer-info.json
|
||||
{{- if or .Values.artifactory.customVolumeMounts .Values.global.customVolumeMounts }}
|
||||
{{ tpl (include "artifactory-ha.customVolumeMounts" .) . | indent 8 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.artifactory.node.resources | indent 10 }}
|
||||
{{- if .Values.artifactory.startupProbe.enabled }}
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: {{ .Values.artifactory.startupProbe.path }}
|
||||
scheme: {{ include "artifactory-ha.scheme" . | upper }}
|
||||
port: {{ .Values.artifactory.internalPort }}
|
||||
initialDelaySeconds: {{ .Values.artifactory.startupProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.artifactory.startupProbe.periodSeconds }}
|
||||
failureThreshold: {{ .Values.artifactory.startupProbe.failureThreshold }}
|
||||
timeoutSeconds: {{ .Values.artifactory.startupProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: {{ .Values.artifactory.readinessProbe.path }}
|
||||
scheme: {{ include "artifactory-ha.scheme" . | upper }}
|
||||
port: {{ .Values.artifactory.internalPort }}
|
||||
initialDelaySeconds: {{ .Values.artifactory.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.artifactory.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.artifactory.readinessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.artifactory.readinessProbe.failureThreshold }}
|
||||
successThreshold: {{ .Values.artifactory.readinessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: {{ .Values.artifactory.livenessProbe.path }}
|
||||
scheme: {{ include "artifactory-ha.scheme" . | upper }}
|
||||
port: {{ .Values.artifactory.internalPort }}
|
||||
initialDelaySeconds: {{ .Values.artifactory.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.artifactory.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.artifactory.livenessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.artifactory.livenessProbe.failureThreshold }}
|
||||
successThreshold: {{ .Values.artifactory.livenessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- $mountPath := .Values.artifactory.persistence.mountPath }}
|
||||
{{- range .Values.artifactory.loggers }}
|
||||
- name: {{ . | replace "_" "-" | replace "." "-" }}
|
||||
image: {{ include "artifactory-ha.getImageInfoByValue" (list $ "logger") }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- 'sh /scripts/tail-log.sh {{ $mountPath }}/log {{ . }}'
|
||||
volumeMounts:
|
||||
- name: volume
|
||||
mountPath: {{ $mountPath }}
|
||||
- name: tail-logger-script
|
||||
mountPath: /scripts/tail-log.sh
|
||||
subPath: tail-log.sh
|
||||
resources:
|
||||
{{ toYaml $.Values.artifactory.loggersResources | indent 10 }}
|
||||
{{- end }}
|
||||
{{ if .Values.artifactory.catalinaLoggers }}
|
||||
{{- range .Values.artifactory.catalinaLoggers }}
|
||||
- name: {{ . | replace "_" "-" | replace "." "-" }}
|
||||
image: {{ include "artifactory-ha.getImageInfoByValue" (list $ "logger") }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- 'sh /scripts/tail-log.sh {{ $mountPath }}/log/tomcat {{ . }}'
|
||||
volumeMounts:
|
||||
- name: volume
|
||||
mountPath: {{ $mountPath }}
|
||||
- name: tail-logger-script
|
||||
mountPath: /scripts/tail-log.sh
|
||||
subPath: tail-log.sh
|
||||
resources:
|
||||
{{ toYaml $.Values.artifactory.catalinaLoggersResources | indent 10 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.filebeat.enabled }}
|
||||
- name: {{ .Values.filebeat.name }}
|
||||
image: "{{ .Values.filebeat.image.repository }}:{{ .Values.filebeat.image.version }}"
|
||||
imagePullPolicy: {{ .Values.filebeat.image.pullPolicy }}
|
||||
args:
|
||||
- "-e"
|
||||
- "-E"
|
||||
- "http.enabled=true"
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
volumeMounts:
|
||||
- name: filebeat-config
|
||||
mountPath: /usr/share/filebeat/filebeat.yml
|
||||
readOnly: true
|
||||
subPath: filebeat.yml
|
||||
- name: volume
|
||||
mountPath: "{{ .Values.artifactory.persistence.mountPath }}"
|
||||
livenessProbe:
|
||||
{{ toYaml .Values.filebeat.livenessProbe | indent 10 }}
|
||||
readinessProbe:
|
||||
{{ toYaml .Values.filebeat.readinessProbe | indent 10 }}
|
||||
resources:
|
||||
{{ toYaml .Values.filebeat.resources | indent 10 }}
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriod }}
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.customSidecarContainers .Values.global.customSidecarContainers }}
|
||||
{{ tpl (include "artifactory-ha.customSidecarContainers" .) . | indent 6 }}
|
||||
{{- end }}
|
||||
{{- with .Values.artifactory.node.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.node.affinity }}
|
||||
{{- with .Values.artifactory.node.affinity }}
|
||||
affinity:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- else if eq .Values.artifactory.node.podAntiAffinity.type "soft" }}
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
topologyKey: {{ .Values.artifactory.node.podAntiAffinity.topologyKey }}
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- if eq .Values.artifactory.service.pool "members" }}
|
||||
role: {{ template "artifactory-ha.node.name" . }}
|
||||
{{- end }}
|
||||
{{- else if eq .Values.artifactory.node.podAntiAffinity.type "hard" }}
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- topologyKey: {{ .Values.artifactory.node.podAntiAffinity.topologyKey }}
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- if eq .Values.artifactory.service.pool "members" }}
|
||||
role: {{ template "artifactory-ha.node.name" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.artifactory.node.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if or .Values.artifactory.customCertificates.enabled .Values.global.customCertificates.enabled }}
|
||||
- name: ca-certs
|
||||
secret:
|
||||
secretName: {{ default .Values.global.customCertificates.certificateSecretName .Values.artifactory.customCertificates.certificateSecretName }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.binarystore.enabled }}
|
||||
- name: binarystore-xml
|
||||
secret:
|
||||
{{- if .Values.artifactory.persistence.customBinarystoreXmlSecret }}
|
||||
secretName: {{ .Values.artifactory.persistence.customBinarystoreXmlSecret }}
|
||||
{{- else }}
|
||||
secretName: {{ template "artifactory-ha.fullname" . }}-binarystore
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.persistence.googleStorage.gcpServiceAccount.enabled }}
|
||||
- name: gcpcreds-json
|
||||
secret:
|
||||
{{- if .Values.artifactory.persistence.googleStorage.gcpServiceAccount.customSecretName }}
|
||||
secretName: {{ .Values.artifactory.persistence.googleStorage.gcpServiceAccount.customSecretName }}
|
||||
{{- else }}
|
||||
secretName: {{ template "artifactory-ha.fullname" . }}-gcpcreds
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.license.secret .Values.artifactory.license.licenseKey }}
|
||||
- name: artifactory-license
|
||||
secret:
|
||||
{{- if .Values.artifactory.license.secret }}
|
||||
secretName: {{ .Values.artifactory.license.secret }}
|
||||
{{- else if .Values.artifactory.license.licenseKey }}
|
||||
secretName: {{ template "artifactory-ha.fullname" . }}-license
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.migration.enabled }}
|
||||
- name: migration-scripts
|
||||
configMap:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-migration-scripts
|
||||
{{- end }}
|
||||
- name: installer-info
|
||||
configMap:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-installer-info
|
||||
{{- if .Values.artifactory.configMapName }}
|
||||
- name: bootstrap-config
|
||||
configMap:
|
||||
name: {{ .Values.artifactory.configMapName }}
|
||||
{{- end}}
|
||||
{{- if or .Values.artifactory.loggers .Values.artifactory.catalinaLoggers }}
|
||||
- name: tail-logger-script
|
||||
configMap:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-logger
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.configMaps }}
|
||||
- name: artifactory-configmaps
|
||||
configMap:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-configmaps
|
||||
{{- end }}
|
||||
{{- if eq .Values.artifactory.persistence.type "file-system" }}
|
||||
{{- if .Values.artifactory.persistence.fileSystem.existingSharedClaim.enabled }}
|
||||
{{- range $sharedClaimNumber, $e := until (.Values.artifactory.persistence.fileSystem.existingSharedClaim.numberOfExistingClaims|int) }}
|
||||
- name: artifactory-ha-data-{{ $sharedClaimNumber }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "artifactory-ha.fullname" $ }}-data-pvc-{{ $sharedClaimNumber }}
|
||||
{{- end }}
|
||||
- name: artifactory-ha-backup
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "artifactory-ha.fullname" $ }}-backup-pvc
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.artifactory.persistence.type "nfs" }}
|
||||
- name: artifactory-ha-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "artifactory-ha.fullname" . }}-data-pvc
|
||||
- name: artifactory-ha-backup
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "artifactory-ha.fullname" . }}-backup-pvc
|
||||
{{- end }}
|
||||
{{- if or .Values.systemYamlOverride.existingSecret .Values.artifactory.systemYaml }}
|
||||
- name: systemyaml
|
||||
secret:
|
||||
secretName: {{ default (printf "%s-%s" (include "artifactory-ha.primary.name" .) "system-yaml") .Values.systemYamlOverride.existingSecret }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.customPersistentVolumeClaim }}
|
||||
- name: {{ .Values.artifactory.customPersistentVolumeClaim.name }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Values.artifactory.customPersistentVolumeClaim.name }}
|
||||
{{- end }}
|
||||
{{- if .Values.filebeat.enabled }}
|
||||
- name: filebeat-config
|
||||
configMap:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-filebeat-config
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.customVolumes .Values.global.customVolumes }}
|
||||
{{ tpl (include "artifactory-ha.customVolumes" .) . | indent 6 }}
|
||||
{{- end }}
|
||||
{{- if not .Values.artifactory.persistence.enabled }}
|
||||
- name: volume
|
||||
emptyDir:
|
||||
sizeLimit: {{ .Values.artifactory.persistence.size }}
|
||||
{{- end }}
|
||||
volumeClaimTemplates:
|
||||
{{- if .Values.artifactory.persistence.enabled }}
|
||||
- metadata:
|
||||
name: volume
|
||||
{{- if not .Values.artifactory.node.persistence.existingClaim }}
|
||||
spec:
|
||||
{{- if .Values.artifactory.persistence.storageClassName }}
|
||||
{{- if (eq "-" .Values.artifactory.persistence.storageClassName) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.artifactory.persistence.storageClassName }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
accessModes: [ "{{ .Values.artifactory.persistence.accessMode }}" ]
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.artifactory.persistence.size }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.customPersistentPodVolumeClaim }}
|
||||
- metadata:
|
||||
name: {{ .Values.artifactory.customPersistentPodVolumeClaim.name }}
|
||||
spec:
|
||||
{{- if .Values.artifactory.customPersistentPodVolumeClaim.storageClassName }}
|
||||
{{- if (eq "-" .Values.artifactory.customPersistentPodVolumeClaim.storageClassName) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.artifactory.customPersistentPodVolumeClaim.storageClassName }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
{{- range .Values.artifactory.customPersistentPodVolumeClaim.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.artifactory.customPersistentPodVolumeClaim.size }}
|
||||
{{- end }}
|
|
@ -0,0 +1,20 @@
|
|||
{{- if .Values.artifactory.primary.minAvailable -}}
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-primary
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
component: {{ .Values.artifactory.name }}
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
role: {{ template "artifactory-ha.primary.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
minAvailable: {{ .Values.artifactory.primary.minAvailable }}
|
||||
{{- end }}
|
|
@ -0,0 +1,897 @@
|
|||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.primary.name" . }}
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
version: {{ include "artifactory-ha.app.version" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- with .Values.artifactory.primary.labels }}
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if and .Release.IsUpgrade .Values.postgresql.enabled }}
|
||||
databaseUpgradeReady: {{ required "\n\n*********\nIMPORTANT: UPGRADE STOPPED to prevent data loss!\nReview CHANGELOG.md (https://github.com/jfrog/charts/blob/master/stable/artifactory-ha/CHANGELOG.md) \nNote: This applies only when you are using bundled postgresql (postgresql.enabled=true) \nIf you are upgrading from a chart version (< 4.x) that has postgresql.image.tag of 9.x or 10.x, make sure to pass the current postgresql.image.tag and set databaseUpgradeReady=true \nOR \nIf you are upgrading from a chart version (>= 4.x), just set databaseUpgradeReady=true \n" .Values.databaseUpgradeReady | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
serviceName: {{ template "artifactory-ha.primary.name" . }}
|
||||
replicas: {{ .Values.artifactory.primary.replicaCount }}
|
||||
updateStrategy: {{- toYaml .Values.artifactory.primary.updateStrategy | nindent 4}}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
role: {{ template "artifactory-ha.primary.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
role: {{ template "artifactory-ha.primary.name" . }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- with .Values.artifactory.primary.labels }}
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
checksum/database-secrets: {{ include (print $.Template.BasePath "/artifactory-database-secrets.yaml") . | sha256sum }}
|
||||
checksum/binarystore: {{ include (print $.Template.BasePath "/artifactory-binarystore-secret.yaml") . | sha256sum }}
|
||||
checksum/systemyaml: {{ include (print $.Template.BasePath "/artifactory-system-yaml.yaml") . | sha256sum }}
|
||||
{{- if .Values.access.accessConfig }}
|
||||
checksum/access-config: {{ include (print $.Template.BasePath "/artifactory-access-config.yaml") . | sha256sum }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.persistence.googleStorage.gcpServiceAccount.enabled }}
|
||||
checksum/gcpcredentials: {{ include (print $.Template.BasePath "/artifactory-gcp-credentials-secret.yaml") . | sha256sum }}
|
||||
{{- end }}
|
||||
{{- if not (and .Values.artifactory.admin.secret .Values.artifactory.admin.dataKey) }}
|
||||
checksum/admin-creds: {{ include (print $.Template.BasePath "/admin-bootstrap-creds.yaml") . | sha256sum }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.artifactory.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.artifactory.priorityClass.existingPriorityClass }}
|
||||
priorityClassName: {{ .Values.artifactory.priorityClass.existingPriorityClass }}
|
||||
{{- else -}}
|
||||
{{- if .Values.artifactory.priorityClass.create }}
|
||||
priorityClassName: {{ default (include "artifactory-ha.fullname" .) .Values.artifactory.priorityClass.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ template "artifactory-ha.serviceAccountName" . }}
|
||||
terminationGracePeriodSeconds: {{ .Values.artifactory.terminationGracePeriodSeconds }}
|
||||
{{- if or .Values.imagePullSecrets .Values.global.imagePullSecrets }}
|
||||
{{- include "artifactory-ha.imagePullSecrets" . | indent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.setSecurityContext }}
|
||||
securityContext:
|
||||
runAsUser: {{ .Values.artifactory.uid }}
|
||||
fsGroup: {{ .Values.artifactory.gid }}
|
||||
{{- end }}
|
||||
initContainers:
|
||||
{{- if or .Values.artifactory.customInitContainersBegin .Values.global.customInitContainersBegin }}
|
||||
{{ tpl (include "artifactory-ha.customInitContainersBegin" .) . | indent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.persistence.enabled }}
|
||||
{{- if eq .Values.artifactory.persistence.type "file-system" }}
|
||||
{{- if .Values.artifactory.persistence.fileSystem.existingSharedClaim.enabled }}
|
||||
- name: "create-artifactory-data-dir"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- >
|
||||
mkdir -p {{ tpl .Values.artifactory.persistence.fileSystem.existingSharedClaim.dataDir . }};
|
||||
volumeMounts:
|
||||
- mountPath: {{ .Values.artifactory.persistence.mountPath | quote }}
|
||||
name: volume
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.deleteDBPropertiesOnStartup }}
|
||||
- name: "delete-db-properties"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- 'rm -fv {{ .Values.artifactory.persistence.mountPath }}/etc/db.properties'
|
||||
volumeMounts:
|
||||
- mountPath: {{ .Values.artifactory.persistence.mountPath | quote }}
|
||||
name: volume
|
||||
{{- end }}
|
||||
- name: "remove-lost-found"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- >
|
||||
rm -rfv {{ .Values.artifactory.persistence.mountPath }}/lost+found;
|
||||
rm -rfv {{ tpl .Values.artifactory.persistence.fileSystem.existingSharedClaim.dataDir . }}/lost+found;
|
||||
rm -rfv {{ .Values.artifactory.persistence.fileSystem.existingSharedClaim.backupDir }}/lost+found;
|
||||
volumeMounts:
|
||||
- name: volume
|
||||
mountPath: "{{ .Values.artifactory.persistence.mountPath }}"
|
||||
{{- if eq .Values.artifactory.persistence.type "file-system" }}
|
||||
{{- if .Values.artifactory.persistence.fileSystem.existingSharedClaim.enabled }}
|
||||
{{- range $sharedClaimNumber, $e := until (.Values.artifactory.persistence.fileSystem.existingSharedClaim.numberOfExistingClaims|int) }}
|
||||
- name: artifactory-ha-data-{{ $sharedClaimNumber }}
|
||||
mountPath: "{{ tpl $.Values.artifactory.persistence.fileSystem.existingSharedClaim.dataDir $ }}/filestore{{ $sharedClaimNumber }}"
|
||||
{{- end }}
|
||||
- name: artifactory-ha-backup
|
||||
mountPath: "{{ $.Values.artifactory.persistence.fileSystem.existingSharedClaim.backupDir }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or (and .Values.artifactory.admin.secret .Values.artifactory.admin.dataKey) .Values.artifactory.admin.password }}
|
||||
- name: "access-bootstrap-creds"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- >
|
||||
echo "Preparing {{ .Values.artifactory.persistence.mountPath }}/etc/access/bootstrap.creds";
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/etc/access;
|
||||
cp -Lrf /tmp/access/bootstrap.creds {{ .Values.artifactory.persistence.mountPath }}/etc/access/bootstrap.creds;
|
||||
chmod 600 {{ .Values.artifactory.persistence.mountPath }}/etc/access/bootstrap.creds;
|
||||
volumeMounts:
|
||||
- name: volume
|
||||
mountPath: "{{ .Values.artifactory.persistence.mountPath }}"
|
||||
- name: access-bootstrap-creds
|
||||
mountPath: "/tmp/access/bootstrap.creds"
|
||||
{{- if and .Values.artifactory.admin.secret .Values.artifactory.admin.dataKey }}
|
||||
subPath: {{ .Values.artifactory.admin.dataKey }}
|
||||
{{- else }}
|
||||
subPath: bootstrap.creds
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: 'copy-system-yaml'
|
||||
image: '{{ .Values.initContainerImage }}'
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
command:
|
||||
- '/bin/sh'
|
||||
- '-c'
|
||||
- >
|
||||
echo "Copy system.yaml to {{ .Values.artifactory.persistence.mountPath }}/etc";
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/etc;
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/etc/access/keys/trusted;
|
||||
{{- if .Values.systemYamlOverride.existingSecret }}
|
||||
cp -fv /tmp/etc/{{ .Values.systemYamlOverride.dataKey }} {{ .Values.artifactory.persistence.mountPath }}/etc/system.yaml;
|
||||
{{- else }}
|
||||
cp -fv /tmp/etc/system.yaml {{ .Values.artifactory.persistence.mountPath }}/etc/system.yaml;
|
||||
{{- end }}
|
||||
echo "Remove {{ .Values.artifactory.persistence.mountPath }}/lost+found folder if exists";
|
||||
rm -rfv {{ .Values.artifactory.persistence.mountPath }}/lost+found;
|
||||
{{- if .Values.access.accessConfig }}
|
||||
echo "Copy access.config.patch.yml to {{ .Values.artifactory.persistence.mountPath }}/etc/access";
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/etc/access;
|
||||
cp -fv /tmp/etc/access.config.patch.yml {{ .Values.artifactory.persistence.mountPath }}/etc/access/access.config.patch.yml;
|
||||
{{- end }}
|
||||
{{- if .Values.access.resetAccessCAKeys }}
|
||||
echo "Resetting Access CA Keys";
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/bootstrap/etc/access/keys;
|
||||
touch {{ .Values.artifactory.persistence.mountPath }}/bootstrap/etc/access/keys/reset_ca_keys;
|
||||
{{- end }}
|
||||
{{- if .Values.access.customCertificatesSecretName }}
|
||||
echo "Copying custom certificates to {{ .Values.artifactory.persistence.mountPath }}/bootstrap/etc/access/keys";
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/bootstrap/etc/access/keys;
|
||||
cp -fv /tmp/etc/tls.crt {{ .Values.artifactory.persistence.mountPath }}/bootstrap/etc/access/keys/ca.crt;
|
||||
cp -fv /tmp/etc/tls.key {{ .Values.artifactory.persistence.mountPath }}/bootstrap/etc/access/keys/ca.private.key;
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.joinKey .Values.global.joinKey .Values.artifactory.joinKeySecretName .Values.global.joinKeySecretName }}
|
||||
echo "Copy joinKey to {{ .Values.artifactory.persistence.mountPath }}/bootstrap/access/etc/security";
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/bootstrap/access/etc/security;
|
||||
echo -n ${ARTIFACTORY_JOIN_KEY} > {{ .Values.artifactory.persistence.mountPath }}/bootstrap/access/etc/security/join.key;
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.masterKey .Values.global.masterKey .Values.artifactory.masterKeySecretName .Values.global.masterKeySecretName }}
|
||||
echo "Copy masterKey to {{ .Values.artifactory.persistence.mountPath }}/etc/security";
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/etc/security;
|
||||
echo -n ${ARTIFACTORY_MASTER_KEY} > {{ .Values.artifactory.persistence.mountPath }}/etc/security/master.key;
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if or .Values.artifactory.joinKey .Values.global.joinKey .Values.artifactory.joinKeySecretName .Values.global.joinKeySecretName }}
|
||||
- name: ARTIFACTORY_JOIN_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "artifactory-ha.joinKeySecretName" . }}
|
||||
key: join-key
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.masterKey .Values.global.masterKey .Values.artifactory.masterKeySecretName .Values.global.masterKeySecretName }}
|
||||
- name: ARTIFACTORY_MASTER_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "artifactory-ha.masterKeySecretName" . }}
|
||||
key: master-key
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: volume
|
||||
mountPath: {{ .Values.artifactory.persistence.mountPath | quote }}
|
||||
{{- if or .Values.systemYamlOverride.existingSecret .Values.artifactory.systemYaml }}
|
||||
- name: systemyaml
|
||||
{{- if .Values.systemYamlOverride.existingSecret }}
|
||||
mountPath: "/tmp/etc/{{.Values.systemYamlOverride.dataKey}}"
|
||||
subPath: {{ .Values.systemYamlOverride.dataKey }}
|
||||
{{- else if .Values.artifactory.systemYaml }}
|
||||
mountPath: "/tmp/etc/system.yaml"
|
||||
subPath: system.yaml
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.access.accessConfig }}
|
||||
- name: access-config
|
||||
mountPath: "/tmp/etc/access.config.patch.yml"
|
||||
subPath: access.config.patch.yml
|
||||
{{- end }}
|
||||
{{- if .Values.access.customCertificatesSecretName }}
|
||||
- name: access-certs
|
||||
mountPath: "/tmp/etc/tls.crt"
|
||||
subPath: tls.crt
|
||||
- name: access-certs
|
||||
mountPath: "/tmp/etc/tls.key"
|
||||
subPath: tls.key
|
||||
{{- end }}
|
||||
{{- if and .Values.artifactory.customPersistentPodVolumeClaim (not .Values.artifactory.customPersistentPodVolumeClaim.skipPrepareContainer) }}
|
||||
- name: "prepare-custom-persistent-volume"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- >
|
||||
chown -Rv {{ .Values.artifactory.uid }}:{{ .Values.artifactory.gid }} {{ .Values.artifactory.customPersistentPodVolumeClaim.mountPath }}
|
||||
securityContext:
|
||||
capabilities:
|
||||
add:
|
||||
- CHOWN
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
volumeMounts:
|
||||
- name: {{ .Values.artifactory.customPersistentPodVolumeClaim.name }}
|
||||
mountPath: {{ .Values.artifactory.customPersistentPodVolumeClaim.mountPath }}
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.customCertificates.enabled .Values.global.customCertificates.enabled }}
|
||||
- name: copy-custom-certificates
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- >
|
||||
{{ include "artifactory-ha.copyCustomCerts" . | indent 10 }}
|
||||
volumeMounts:
|
||||
- name: volume
|
||||
mountPath: {{ .Values.artifactory.persistence.mountPath }}
|
||||
- name: ca-certs
|
||||
mountPath: "/tmp/certs"
|
||||
{{- end }}
|
||||
{{- if .Values.waitForDatabase }}
|
||||
{{- if or .Values.postgresql.enabled }}
|
||||
- name: "wait-for-db"
|
||||
image: "{{ .Values.initContainerImage }}"
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- >
|
||||
until nc -z -w 2 {{ .Release.Name }}-postgresql {{ .Values.postgresql.service.port }} && echo database ok; do
|
||||
sleep 2;
|
||||
done;
|
||||
resources:
|
||||
{{ toYaml .Values.initContainers.resources | indent 10 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.customInitContainers .Values.global.customInitContainers }}
|
||||
{{ tpl (include "artifactory-ha.customInitContainers" .) . | indent 6 }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.migration.enabled }}
|
||||
- name: 'migration-artifactory-ha'
|
||||
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
|
||||
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
|
||||
resources:
|
||||
{{ toYaml .Values.artifactory.primary.resources | indent 10 }}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
command:
|
||||
- '/bin/bash'
|
||||
- '-c'
|
||||
- >
|
||||
{{- if .Values.artifactory.migration.preStartCommand }}
|
||||
echo "Running custom preStartCommand command";
|
||||
{{ tpl .Values.artifactory.migration.preStartCommand . }};
|
||||
{{- end }}
|
||||
scriptsPath="/opt/jfrog/artifactory/app/bin";
|
||||
mkdir -p $scriptsPath;
|
||||
echo "Copy migration scripts and Run migration";
|
||||
cp -fv /tmp/migrate.sh $scriptsPath/migrate.sh;
|
||||
cp -fv /tmp/migrationHelmInfo.yaml $scriptsPath/migrationHelmInfo.yaml;
|
||||
cp -fv /tmp/migrationStatus.sh $scriptsPath/migrationStatus.sh;
|
||||
mkdir -p {{ .Values.artifactory.persistence.mountPath }}/log;
|
||||
bash $scriptsPath/migrationStatus.sh {{ include "artifactory-ha.app.version" . }} {{ .Values.artifactory.migration.timeoutSeconds }} > >(tee {{ .Values.artifactory.persistence.mountPath }}/log/helm-migration.log) 2>&1;
|
||||
env:
|
||||
{{- if and (not .Values.waitForDatabase) (not .Values.postgresql.enabled) }}
|
||||
- name: SKIP_WAIT_FOR_EXTERNAL_DB
|
||||
value: "true"
|
||||
{{- end }}
|
||||
{{- if or .Values.database.secrets.user .Values.database.user }}
|
||||
- name: JF_SHARED_DATABASE_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.user }}
|
||||
name: {{ tpl .Values.database.secrets.user.name . }}
|
||||
key: {{ tpl .Values.database.secrets.user.key . }}
|
||||
{{- else if .Values.database.user }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-user
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{ if or .Values.database.secrets.password .Values.database.password .Values.postgresql.enabled }}
|
||||
- name: JF_SHARED_DATABASE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.password }}
|
||||
name: {{ tpl .Values.database.secrets.password.name . }}
|
||||
key: {{ tpl .Values.database.secrets.password.key . }}
|
||||
{{- else if .Values.database.password }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-password
|
||||
{{- else if .Values.postgresql.enabled }}
|
||||
name: {{ .Release.Name }}-postgresql
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.database.secrets.url .Values.database.url }}
|
||||
- name: JF_SHARED_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.url }}
|
||||
name: {{ tpl .Values.database.secrets.url.name . }}
|
||||
key: {{ tpl .Values.database.secrets.url.key . }}
|
||||
{{- else if .Values.database.url }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-url
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: JF_SHARED_NODE_PRIMARY
|
||||
value: "true"
|
||||
- name: JF_SHARED_NODE_HAENABLED
|
||||
value: "true"
|
||||
{{- with .Values.artifactory.extraEnvironmentVariables }}
|
||||
{{ tpl (toYaml .) $ | indent 8 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: migration-scripts
|
||||
mountPath: "/tmp/migrate.sh"
|
||||
subPath: migrate.sh
|
||||
- name: migration-scripts
|
||||
mountPath: "/tmp/migrationHelmInfo.yaml"
|
||||
subPath: migrationHelmInfo.yaml
|
||||
- name: migration-scripts
|
||||
mountPath: "/tmp/migrationStatus.sh"
|
||||
subPath: migrationStatus.sh
|
||||
- name: volume
|
||||
mountPath: "{{ .Values.artifactory.persistence.mountPath }}"
|
||||
{{- if eq .Values.artifactory.persistence.type "file-system" }}
|
||||
{{- if .Values.artifactory.persistence.fileSystem.existingSharedClaim.enabled }}
|
||||
{{- range $sharedClaimNumber, $e := until (.Values.artifactory.persistence.fileSystem.existingSharedClaim.numberOfExistingClaims|int) }}
|
||||
- name: artifactory-ha-data-{{ $sharedClaimNumber }}
|
||||
mountPath: "{{ tpl $.Values.artifactory.persistence.fileSystem.existingSharedClaim.dataDir $ }}/filestore{{ $sharedClaimNumber }}"
|
||||
{{- end }}
|
||||
- name: artifactory-ha-backup
|
||||
mountPath: "{{ $.Values.artifactory.persistence.fileSystem.existingSharedClaim.backupDir }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.customVolumeMounts .Values.global.customVolumeMounts }}
|
||||
{{ tpl (include "artifactory-ha.customVolumeMounts" .) . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.artifactory.persistence.type "nfs" }}
|
||||
- name: artifactory-ha-data
|
||||
mountPath: "{{ .Values.artifactory.persistence.nfs.dataDir }}"
|
||||
- name: artifactory-ha-backup
|
||||
mountPath: "{{ .Values.artifactory.persistence.nfs.backupDir }}"
|
||||
{{- else }}
|
||||
{{- if .Values.artifactory.binarystore.enabled }}
|
||||
- name: binarystore-xml
|
||||
mountPath: "/artifactory_bootstrap/binarystore.xml"
|
||||
subPath: binarystore.xml
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.persistence.googleStorage.gcpServiceAccount.enabled }}
|
||||
- name: gcpcreds-json
|
||||
mountPath: "/artifactory_bootstrap/gcp.credentials.json"
|
||||
subPath: gcp.credentials.json
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.hostAliases }}
|
||||
hostAliases:
|
||||
{{ toYaml .Values.hostAliases | indent 6 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Values.artifactory.name }}
|
||||
image: {{ include "artifactory-ha.getImageInfoByValue" (list . "artifactory") }}
|
||||
imagePullPolicy: {{ .Values.artifactory.image.pullPolicy }}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
command:
|
||||
- '/bin/bash'
|
||||
- '-c'
|
||||
- >
|
||||
set -e;
|
||||
if [ -d /artifactory_extra_conf ] && [ -d /artifactory_bootstrap ]; then
|
||||
echo "Copying bootstrap config from /artifactory_extra_conf to /artifactory_bootstrap";
|
||||
cp -Lrfv /artifactory_extra_conf/ /artifactory_bootstrap/;
|
||||
fi;
|
||||
{{- if .Values.artifactory.configMapName }}
|
||||
echo "Copying bootstrap configs";
|
||||
cp -Lrf /bootstrap/* /artifactory_bootstrap/;
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.userPluginSecrets }}
|
||||
echo "Copying plugins";
|
||||
cp -Lrf /tmp/plugin/*/* /artifactory_bootstrap/plugins;
|
||||
{{- end }}
|
||||
{{- range .Values.artifactory.copyOnEveryStartup }}
|
||||
{{- $targetPath := printf "%s/%s" $.Values.artifactory.persistence.mountPath .target }}
|
||||
{{- $baseDirectory := regexFind ".*/" $targetPath }}
|
||||
mkdir -p {{ $baseDirectory }};
|
||||
cp -Lrf {{ .source }} {{ $.Values.artifactory.persistence.mountPath }}/{{ .target }};
|
||||
{{- end }}
|
||||
{{- with .Values.artifactory.preStartCommand }}
|
||||
echo "Running custom preStartCommand command";
|
||||
{{ tpl . $ }};
|
||||
{{- end }}
|
||||
{{- with .Values.artifactory.primary.preStartCommand }}
|
||||
echo "Running primary specific custom preStartCommand command";
|
||||
{{ tpl . $ }};
|
||||
{{- end }}
|
||||
exec /entrypoint-artifactory.sh
|
||||
{{- with .Values.artifactory.postStartCommand }}
|
||||
lifecycle:
|
||||
postStart:
|
||||
exec:
|
||||
command:
|
||||
- '/bin/bash'
|
||||
- '-c'
|
||||
- >
|
||||
echo "Running custom postStartCommand command";
|
||||
{{ tpl . $ }};
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if and (not .Values.waitForDatabase) (not .Values.postgresql.enabled) }}
|
||||
- name: SKIP_WAIT_FOR_EXTERNAL_DB
|
||||
value: "true"
|
||||
{{- end }}
|
||||
{{- if or .Values.database.secrets.user .Values.database.user }}
|
||||
- name: JF_SHARED_DATABASE_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.user }}
|
||||
name: {{ tpl .Values.database.secrets.user.name . }}
|
||||
key: {{ tpl .Values.database.secrets.user.key . }}
|
||||
{{- else if .Values.database.user }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-user
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{ if or .Values.database.secrets.password .Values.database.password .Values.postgresql.enabled }}
|
||||
- name: JF_SHARED_DATABASE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.password }}
|
||||
name: {{ tpl .Values.database.secrets.password.name . }}
|
||||
key: {{ tpl .Values.database.secrets.password.key . }}
|
||||
{{- else if .Values.database.password }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-password
|
||||
{{- else if .Values.postgresql.enabled }}
|
||||
name: {{ .Release.Name }}-postgresql
|
||||
key: postgresql-password
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.database.secrets.url .Values.database.url }}
|
||||
- name: JF_SHARED_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
{{- if .Values.database.secrets.url }}
|
||||
name: {{ tpl .Values.database.secrets.url.name . }}
|
||||
key: {{ tpl .Values.database.secrets.url.key . }}
|
||||
{{- else if .Values.database.url }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}-database-creds
|
||||
key: db-url
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: JF_SHARED_NODE_PRIMARY
|
||||
value: "true"
|
||||
- name: JF_SHARED_NODE_HAENABLED
|
||||
value: "true"
|
||||
{{- with .Values.artifactory.extraEnvironmentVariables }}
|
||||
{{ tpl (toYaml .) $ | indent 8 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.artifactory.internalPort }}
|
||||
name: http
|
||||
- containerPort: {{ .Values.artifactory.internalArtifactoryPort }}
|
||||
name: http-internal
|
||||
{{- if .Values.artifactory.primary.javaOpts.jmx.enabled }}
|
||||
- containerPort: {{ .Values.artifactory.primary.javaOpts.jmx.port }}
|
||||
name: tcp-jmx
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.ssh.enabled }}
|
||||
- containerPort: {{ .Values.artifactory.ssh.internalPort }}
|
||||
name: tcp-ssh
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.artifactory.customPersistentVolumeClaim }}
|
||||
- name: {{ .Values.artifactory.customPersistentVolumeClaim.name }}
|
||||
mountPath: {{ .Values.artifactory.customPersistentVolumeClaim.mountPath }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.customPersistentPodVolumeClaim }}
|
||||
- name: {{ .Values.artifactory.customPersistentPodVolumeClaim.name }}
|
||||
mountPath: {{ .Values.artifactory.customPersistentPodVolumeClaim.mountPath }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.userPluginSecrets }}
|
||||
- name: bootstrap-plugins
|
||||
mountPath: "/artifactory_bootstrap/plugins/"
|
||||
{{- range .Values.artifactory.userPluginSecrets }}
|
||||
- name: {{ tpl . $ }}
|
||||
mountPath: "/tmp/plugin/{{ tpl . $ }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: volume
|
||||
mountPath: "{{ .Values.artifactory.persistence.mountPath }}"
|
||||
{{- if eq .Values.artifactory.persistence.type "file-system" }}
|
||||
{{- if .Values.artifactory.persistence.fileSystem.existingSharedClaim.enabled }}
|
||||
{{- range $sharedClaimNumber, $e := until (.Values.artifactory.persistence.fileSystem.existingSharedClaim.numberOfExistingClaims|int) }}
|
||||
- name: artifactory-ha-data-{{ $sharedClaimNumber }}
|
||||
mountPath: "{{ tpl $.Values.artifactory.persistence.fileSystem.existingSharedClaim.dataDir $ }}/filestore{{ $sharedClaimNumber }}"
|
||||
{{- end }}
|
||||
- name: artifactory-ha-backup
|
||||
mountPath: "{{ $.Values.artifactory.persistence.fileSystem.existingSharedClaim.backupDir }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.artifactory.persistence.type "nfs" }}
|
||||
- name: artifactory-ha-data
|
||||
mountPath: "{{ .Values.artifactory.persistence.nfs.dataDir }}"
|
||||
- name: artifactory-ha-backup
|
||||
mountPath: "{{ .Values.artifactory.persistence.nfs.backupDir }}"
|
||||
{{- else }}
|
||||
{{- if .Values.artifactory.binarystore.enabled }}
|
||||
- name: binarystore-xml
|
||||
mountPath: "/artifactory_bootstrap/binarystore.xml"
|
||||
subPath: binarystore.xml
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.persistence.googleStorage.gcpServiceAccount.enabled }}
|
||||
- name: gcpcreds-json
|
||||
mountPath: "/artifactory_bootstrap/gcp.credentials.json"
|
||||
subPath: gcp.credentials.json
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.configMapName }}
|
||||
- name: bootstrap-config
|
||||
mountPath: "/bootstrap/"
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.license.secret .Values.artifactory.license.licenseKey }}
|
||||
- name: artifactory-license
|
||||
mountPath: "/artifactory_bootstrap/artifactory.cluster.license"
|
||||
{{- if .Values.artifactory.license.secret }}
|
||||
subPath: {{ .Values.artifactory.license.dataKey }}
|
||||
{{- else if .Values.artifactory.license.licenseKey }}
|
||||
subPath: artifactory.lic
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: installer-info
|
||||
mountPath: "/artifactory_bootstrap/info/installer-info.json"
|
||||
subPath: installer-info.json
|
||||
{{- if or .Values.artifactory.customVolumeMounts .Values.global.customVolumeMounts }}
|
||||
{{ tpl (include "artifactory-ha.customVolumeMounts" .) . | indent 8 }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.artifactory.primary.resources | indent 10 }}
|
||||
{{- if .Values.artifactory.startupProbe.enabled }}
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: {{ .Values.artifactory.startupProbe.path }}
|
||||
scheme: {{ include "artifactory-ha.scheme" . | upper }}
|
||||
port: {{ .Values.artifactory.internalPort }}
|
||||
initialDelaySeconds: {{ .Values.artifactory.startupProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.artifactory.startupProbe.periodSeconds }}
|
||||
failureThreshold: {{ .Values.artifactory.startupProbe.failureThreshold }}
|
||||
timeoutSeconds: {{ .Values.artifactory.startupProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: {{ .Values.artifactory.readinessProbe.path }}
|
||||
scheme: {{ include "artifactory-ha.scheme" . | upper }}
|
||||
port: {{ .Values.artifactory.internalPort }}
|
||||
initialDelaySeconds: {{ .Values.artifactory.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.artifactory.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.artifactory.readinessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.artifactory.readinessProbe.failureThreshold }}
|
||||
successThreshold: {{ .Values.artifactory.readinessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: {{ .Values.artifactory.livenessProbe.path }}
|
||||
scheme: {{ include "artifactory-ha.scheme" . | upper }}
|
||||
port: {{ .Values.artifactory.internalPort }}
|
||||
initialDelaySeconds: {{ .Values.artifactory.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.artifactory.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.artifactory.livenessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.artifactory.livenessProbe.failureThreshold }}
|
||||
successThreshold: {{ .Values.artifactory.livenessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- $mountPath := .Values.artifactory.persistence.mountPath }}
|
||||
{{- range .Values.artifactory.loggers }}
|
||||
- name: {{ . | replace "_" "-" | replace "." "-" }}
|
||||
image: {{ include "artifactory-ha.getImageInfoByValue" (list $ "logger") }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- 'sh /scripts/tail-log.sh {{ $mountPath }}/log {{ . }}'
|
||||
volumeMounts:
|
||||
- name: volume
|
||||
mountPath: {{ $mountPath }}
|
||||
- name: tail-logger-script
|
||||
mountPath: /scripts/tail-log.sh
|
||||
subPath: tail-log.sh
|
||||
resources:
|
||||
{{ toYaml $.Values.artifactory.loggersResources | indent 10 }}
|
||||
{{- end }}
|
||||
{{ if .Values.artifactory.catalinaLoggers }}
|
||||
{{- range .Values.artifactory.catalinaLoggers }}
|
||||
- name: {{ . | replace "_" "-" | replace "." "-" }}
|
||||
image: {{ include "artifactory-ha.getImageInfoByValue" (list $ "logger") }}
|
||||
command:
|
||||
- 'sh'
|
||||
- '-c'
|
||||
- 'sh /scripts/tail-log.sh {{ $mountPath }}/log/tomcat {{ . }}'
|
||||
volumeMounts:
|
||||
- name: volume
|
||||
mountPath: {{ $mountPath }}
|
||||
- name: tail-logger-script
|
||||
mountPath: /scripts/tail-log.sh
|
||||
subPath: tail-log.sh
|
||||
resources:
|
||||
{{ toYaml $.Values.artifactory.catalinaLoggersResources | indent 10 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.filebeat.enabled }}
|
||||
- name: {{ .Values.filebeat.name }}
|
||||
image: "{{ .Values.filebeat.image.repository }}:{{ .Values.filebeat.image.version }}"
|
||||
imagePullPolicy: {{ .Values.filebeat.image.pullPolicy }}
|
||||
args:
|
||||
- "-e"
|
||||
- "-E"
|
||||
- "http.enabled=true"
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
volumeMounts:
|
||||
- name: filebeat-config
|
||||
mountPath: /usr/share/filebeat/filebeat.yml
|
||||
readOnly: true
|
||||
subPath: filebeat.yml
|
||||
- name: volume
|
||||
mountPath: "{{ .Values.artifactory.persistence.mountPath }}"
|
||||
livenessProbe:
|
||||
{{ toYaml .Values.filebeat.livenessProbe | indent 10 }}
|
||||
readinessProbe:
|
||||
{{ toYaml .Values.filebeat.readinessProbe | indent 10 }}
|
||||
resources:
|
||||
{{ toYaml .Values.filebeat.resources | indent 10 }}
|
||||
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriod }}
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.customSidecarContainers .Values.global.customSidecarContainers }}
|
||||
{{ tpl (include "artifactory-ha.customSidecarContainers" .) . | indent 6 }}
|
||||
{{- end }}
|
||||
{{- with .Values.artifactory.primary.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.primary.affinity }}
|
||||
{{- with .Values.artifactory.primary.affinity }}
|
||||
affinity:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- else if eq .Values.artifactory.primary.podAntiAffinity.type "soft" }}
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
topologyKey: {{ .Values.artifactory.primary.podAntiAffinity.topologyKey }}
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- else if eq .Values.artifactory.primary.podAntiAffinity.type "hard" }}
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- topologyKey: {{ .Values.artifactory.primary.podAntiAffinity.topologyKey }}
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
{{- with .Values.artifactory.primary.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if or .Values.artifactory.customCertificates.enabled .Values.global.customCertificates.enabled }}
|
||||
- name: ca-certs
|
||||
secret:
|
||||
secretName: {{ default .Values.global.customCertificates.certificateSecretName .Values.artifactory.customCertificates.certificateSecretName }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.binarystore.enabled }}
|
||||
- name: binarystore-xml
|
||||
secret:
|
||||
{{- if .Values.artifactory.persistence.customBinarystoreXmlSecret }}
|
||||
secretName: {{ .Values.artifactory.persistence.customBinarystoreXmlSecret }}
|
||||
{{- else }}
|
||||
secretName: {{ template "artifactory-ha.fullname" . }}-binarystore
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.persistence.googleStorage.gcpServiceAccount.enabled }}
|
||||
- name: gcpcreds-json
|
||||
secret:
|
||||
{{- if .Values.artifactory.persistence.googleStorage.gcpServiceAccount.customSecretName }}
|
||||
secretName: {{ .Values.artifactory.persistence.googleStorage.gcpServiceAccount.customSecretName }}
|
||||
{{- else }}
|
||||
secretName: {{ template "artifactory-ha.fullname" . }}-gcpcreds
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.license.secret .Values.artifactory.license.licenseKey }}
|
||||
- name: artifactory-license
|
||||
secret:
|
||||
{{- if .Values.artifactory.license.secret }}
|
||||
secretName: {{ .Values.artifactory.license.secret }}
|
||||
{{- else if .Values.artifactory.license.licenseKey }}
|
||||
secretName: {{ template "artifactory-ha.fullname" . }}-license
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.migration.enabled }}
|
||||
- name: migration-scripts
|
||||
configMap:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-migration-scripts
|
||||
{{- end }}
|
||||
- name: installer-info
|
||||
configMap:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-installer-info
|
||||
{{- if .Values.artifactory.userPluginSecrets }}
|
||||
- name: bootstrap-plugins
|
||||
emptyDir: {}
|
||||
{{- range .Values.artifactory.userPluginSecrets }}
|
||||
- name: {{ tpl . $ }}
|
||||
secret:
|
||||
secretName: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.configMapName }}
|
||||
- name: bootstrap-config
|
||||
configMap:
|
||||
name: {{ .Values.artifactory.configMapName }}
|
||||
{{- end}}
|
||||
{{- if or .Values.artifactory.loggers .Values.artifactory.catalinaLoggers }}
|
||||
- name: tail-logger-script
|
||||
configMap:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-logger
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.configMaps }}
|
||||
- name: artifactory-configmaps
|
||||
configMap:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-configmaps
|
||||
{{- end }}
|
||||
{{- if or (and .Values.artifactory.admin.secret .Values.artifactory.admin.dataKey) .Values.artifactory.admin.password }}
|
||||
- name: access-bootstrap-creds
|
||||
secret:
|
||||
{{- if and .Values.artifactory.admin.secret .Values.artifactory.admin.dataKey }}
|
||||
secretName: {{ .Values.artifactory.admin.secret }}
|
||||
{{- else }}
|
||||
secretName: {{ template "artifactory-ha.fullname" . }}-bootstrap-creds
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.artifactory.persistence.type "file-system" }}
|
||||
{{- if .Values.artifactory.persistence.fileSystem.existingSharedClaim.enabled }}
|
||||
{{- range $sharedClaimNumber, $e := until (.Values.artifactory.persistence.fileSystem.existingSharedClaim.numberOfExistingClaims|int) }}
|
||||
- name: artifactory-ha-data-{{ $sharedClaimNumber }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "artifactory-ha.fullname" $ }}-data-pvc-{{ $sharedClaimNumber }}
|
||||
{{- end }}
|
||||
- name: artifactory-ha-backup
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "artifactory-ha.fullname" $ }}-backup-pvc
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.artifactory.persistence.type "nfs" }}
|
||||
- name: artifactory-ha-data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "artifactory-ha.fullname" . }}-data-pvc
|
||||
- name: artifactory-ha-backup
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "artifactory-ha.fullname" . }}-backup-pvc
|
||||
{{- end }}
|
||||
{{- if or .Values.systemYamlOverride.existingSecret .Values.artifactory.systemYaml }}
|
||||
- name: systemyaml
|
||||
secret:
|
||||
secretName: {{ default (printf "%s-%s" (include "artifactory-ha.primary.name" .) "system-yaml") .Values.systemYamlOverride.existingSecret }}
|
||||
{{- end }}
|
||||
{{- if .Values.access.accessConfig }}
|
||||
- name: access-config
|
||||
secret:
|
||||
secretName: {{ template "artifactory-ha.fullname" . }}-access-config
|
||||
{{- end }}
|
||||
{{- if .Values.access.customCertificatesSecretName }}
|
||||
- name: access-certs
|
||||
secret:
|
||||
secretName: {{ .Values.access.customCertificatesSecretName }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.customPersistentVolumeClaim }}
|
||||
- name: {{ .Values.artifactory.customPersistentVolumeClaim.name }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Values.artifactory.customPersistentVolumeClaim.name }}
|
||||
{{- end }}
|
||||
{{- if .Values.filebeat.enabled }}
|
||||
- name: filebeat-config
|
||||
configMap:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-filebeat-config
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.customVolumes .Values.global.customVolumes }}
|
||||
{{ tpl (include "artifactory-ha.customVolumes" .) . | indent 6 }}
|
||||
{{- end }}
|
||||
{{- if not .Values.artifactory.persistence.enabled }}
|
||||
- name: volume
|
||||
emptyDir:
|
||||
sizeLimit: {{ .Values.artifactory.persistence.size }}
|
||||
{{- end }}
|
||||
volumeClaimTemplates:
|
||||
{{- if .Values.artifactory.persistence.enabled }}
|
||||
- metadata:
|
||||
name: volume
|
||||
{{- if not .Values.artifactory.primary.persistence.existingClaim }}
|
||||
spec:
|
||||
{{- if .Values.artifactory.persistence.storageClassName }}
|
||||
{{- if (eq "-" .Values.artifactory.persistence.storageClassName) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.artifactory.persistence.storageClassName }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
accessModes: [ "{{ .Values.artifactory.persistence.accessMode }}" ]
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.artifactory.persistence.size }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.customPersistentPodVolumeClaim }}
|
||||
- metadata:
|
||||
name: {{ .Values.artifactory.customPersistentPodVolumeClaim.name }}
|
||||
spec:
|
||||
{{- if .Values.artifactory.customPersistentPodVolumeClaim.storageClassName }}
|
||||
{{- if (eq "-" .Values.artifactory.customPersistentPodVolumeClaim.storageClassName) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.artifactory.customPersistentPodVolumeClaim.storageClassName }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
accessModes:
|
||||
{{- range .Values.artifactory.customPersistentPodVolumeClaim.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.artifactory.customPersistentPodVolumeClaim.size }}
|
||||
{{- end }}
|
|
@ -0,0 +1,9 @@
|
|||
{{- if .Values.artifactory.priorityClass.create }}
|
||||
apiVersion: scheduling.k8s.io/v1
|
||||
kind: PriorityClass
|
||||
metadata:
|
||||
name: {{ default (include "artifactory-ha.fullname" .) .Values.artifactory.priorityClass.name }}
|
||||
value: {{ .Values.artifactory.priorityClass.value }}
|
||||
globalDefault: false
|
||||
description: "Artifactory priority class"
|
||||
{{- end }}
|
|
@ -0,0 +1,14 @@
|
|||
{{- if .Values.rbac.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}
|
||||
rules:
|
||||
{{ toYaml .Values.rbac.role.rules }}
|
||||
{{- end }}
|
|
@ -0,0 +1,19 @@
|
|||
{{- if .Values.rbac.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "artifactory-ha.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "artifactory-ha.serviceAccountName" . }}
|
||||
roleRef:
|
||||
kind: Role
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
name: {{ template "artifactory-ha.fullname" . }}
|
||||
{{- end }}
|
|
@ -0,0 +1,21 @@
|
|||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
type: Opaque
|
||||
data:
|
||||
{{- if or .Values.artifactory.masterKey .Values.global.masterKey }}
|
||||
{{- if not (or .Values.artifactory.masterKeySecretName .Values.global.masterKeySecretName) }}
|
||||
master-key: {{ include "artifactory-ha.masterKey" . | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.artifactory.joinKey .Values.global.joinKey }}
|
||||
{{- if not (or .Values.artifactory.joinKeySecretName .Values.global.joinKeySecretName) }}
|
||||
join-key: {{ include "artifactory-ha.joinKey" . | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,109 @@
|
|||
# Service for all Artifactory cluster nodes.
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- with .Values.artifactory.node.labels }}
|
||||
{{ toYaml .| indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.service.annotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.artifactory.service.annotations | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.artifactory.service.type }}
|
||||
{{- if and (eq .Values.artifactory.service.type "ClusterIP") .Values.artifactory.service.clusterIP }}
|
||||
clusterIP: {{ .Values.artifactory.service.clusterIP }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.service.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{ toYaml .Values.artifactory.service.loadBalancerSourceRanges | indent 4 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- port: {{ .Values.artifactory.externalPort }}
|
||||
targetPort: {{ .Values.artifactory.internalPort }}
|
||||
protocol: TCP
|
||||
name: http-router
|
||||
{{- if .Values.artifactory.ssh.enabled }}
|
||||
- port: {{ .Values.artifactory.ssh.externalPort }}
|
||||
targetPort: {{ .Values.artifactory.ssh.internalPort }}
|
||||
protocol: TCP
|
||||
name: tcp-ssh
|
||||
{{- end }}
|
||||
- port: {{ .Values.artifactory.externalArtifactoryPort }}
|
||||
targetPort: {{ .Values.artifactory.internalArtifactoryPort }}
|
||||
protocol: TCP
|
||||
name: http-artifactory
|
||||
{{- with .Values.artifactory.node.javaOpts.jmx }}
|
||||
{{- if .enabled }}
|
||||
- port: {{ .port }}
|
||||
targetPort: {{ .port }}
|
||||
protocol: TCP
|
||||
name: tcp-jmx
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- if eq (int .Values.artifactory.node.replicaCount) 0 }}
|
||||
role: {{ template "artifactory-ha.primary.name" . }}
|
||||
{{- else if eq .Values.artifactory.service.pool "members" }}
|
||||
role: {{ template "artifactory-ha.node.name" . }}
|
||||
{{- end }}
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
component: "{{ .Values.artifactory.name }}"
|
||||
release: {{ .Release.Name }}
|
||||
---
|
||||
# Internal service for Artifactory primary node only!
|
||||
# Used by member nodes to check readiness of primary node before starting up
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.primary.name" . }}
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
{{- with .Values.artifactory.primary.labels }}
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
# Statically setting service type to ClusterIP since this is an internal only service
|
||||
type: ClusterIP
|
||||
{{- if and (eq .Values.artifactory.service.type "ClusterIP") .Values.artifactory.service.clusterIP }}
|
||||
clusterIP: {{ .Values.artifactory.service.clusterIP }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- port: {{ .Values.artifactory.externalPort }}
|
||||
targetPort: {{ .Values.artifactory.internalPort }}
|
||||
protocol: TCP
|
||||
name: http-router
|
||||
- port: {{ .Values.artifactory.externalArtifactoryPort }}
|
||||
targetPort: {{ .Values.artifactory.internalArtifactoryPort }}
|
||||
protocol: TCP
|
||||
name: http-artifactory
|
||||
{{- if .Values.artifactory.ssh.enabled }}
|
||||
- port: {{ .Values.artifactory.ssh.externalPort }}
|
||||
targetPort: {{ .Values.artifactory.ssh.internalPort }}
|
||||
protocol: TCP
|
||||
name: tcp-ssh
|
||||
{{- end }}
|
||||
{{- with .Values.artifactory.primary.javaOpts.jmx }}
|
||||
{{- if .enabled }}
|
||||
- port: {{ .port }}
|
||||
targetPort: {{ .port }}
|
||||
protocol: TCP
|
||||
name: tcp-jmx
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
selector:
|
||||
role: {{ template "artifactory-ha.primary.name" . }}
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
component: "{{ .Values.artifactory.name }}"
|
||||
release: {{ .Release.Name }}
|
|
@ -0,0 +1,16 @@
|
|||
{{- if .Values.serviceAccount.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{ tpl (toYaml .) $ | indent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "artifactory-ha.serviceAccountName" . }}
|
||||
{{- end }}
|
|
@ -0,0 +1,27 @@
|
|||
{{ if .Values.artifactory.customPersistentVolumeClaim }}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ .Values.artifactory.customPersistentVolumeClaim.name }}
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
version: "{{ .Values.artifactory.version }}"
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.artifactory.customPersistentVolumeClaim.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.artifactory.customPersistentVolumeClaim.storageClassName }}
|
||||
{{- if (eq "-" .Values.artifactory.customPersistentVolumeClaim.storageClassName) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.artifactory.customPersistentVolumeClaim.storageClassName }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.artifactory.customPersistentVolumeClaim.size | quote }}
|
||||
{{ end -}}
|
|
@ -0,0 +1,16 @@
|
|||
{{- if not .Values.systemYamlOverride.existingSecret }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.primary.name" . }}-system-yaml
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
component: {{ .Values.artifactory.name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
system.yaml: |
|
||||
{{ tpl .Values.artifactory.systemYaml . | indent 4 }}
|
||||
{{- end }}
|
|
@ -0,0 +1,15 @@
|
|||
{{- if .Values.filebeat.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.name" . }}-filebeat-config
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
data:
|
||||
filebeat.yml: |
|
||||
{{ tpl .Values.filebeat.filebeatYml . | indent 4 }}
|
||||
{{- end -}}
|
|
@ -0,0 +1,149 @@
|
|||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $serviceName := include "artifactory-ha.fullname" . -}}
|
||||
{{- $servicePort := .Values.artifactory.externalPort -}}
|
||||
{{- $artifactoryServicePort := .Values.artifactory.externalArtifactoryPort -}}
|
||||
{{- $ingressName := default ( include "artifactory-ha.fullname" . ) .Values.ingress.name -}}
|
||||
{{- if semverCompare ">=v1.14.0-0" .Capabilities.KubeVersion.GitVersion }}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else }}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $ingressName }}
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
{{- if .Values.ingress.labels }}
|
||||
{{ .Values.ingress.labels | toYaml | trimSuffix "\n"| indent 4 -}}
|
||||
{{- end}}
|
||||
{{- if .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{ .Values.ingress.annotations | toYaml | trimSuffix "\n" | indent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.defaultBackend.enabled }}
|
||||
backend:
|
||||
serviceName: {{ $serviceName }}
|
||||
servicePort: {{ $servicePort }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- if .Values.ingress.hosts }}
|
||||
{{- range $host := .Values.ingress.hosts }}
|
||||
- host: {{ $host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $.Values.ingress.routerPath }}
|
||||
backend:
|
||||
serviceName: {{ $serviceName }}
|
||||
servicePort: {{ $servicePort }}
|
||||
- path: {{ $.Values.ingress.artifactoryPath }}
|
||||
backend:
|
||||
serviceName: {{ $serviceName }}
|
||||
servicePort: {{ $artifactoryServicePort }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with .Values.ingress.additionalRules }}
|
||||
{{ tpl . $ | indent 2 }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{ toYaml .Values.ingress.tls | indent 4 }}
|
||||
{{- end -}}
|
||||
{{- if .Values.artifactory.replicator.enabled }}
|
||||
---
|
||||
{{- $replicationIngressName := default ( include "artifactory-ha.replicator.fullname" . ) .Values.artifactory.replicator.ingress.name -}}
|
||||
{{- if semverCompare ">=v1.14.0-0" .Capabilities.KubeVersion.GitVersion }}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else }}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $replicationIngressName }}
|
||||
labels:
|
||||
app: "{{ template "artifactory-ha.name" $ }}"
|
||||
chart: "{{ template "artifactory-ha.chart" $ }}"
|
||||
release: {{ $.Release.Name | quote }}
|
||||
heritage: {{ $.Release.Service | quote }}
|
||||
{{- if .Values.artifactory.replicator.ingress.annotations }}
|
||||
annotations:
|
||||
{{ .Values.artifactory.replicator.ingress.annotations | toYaml | trimSuffix "\n" | indent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.defaultBackend.enabled }}
|
||||
backend:
|
||||
serviceName: {{ $serviceName }}
|
||||
servicePort: {{ $servicePort }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- if .Values.artifactory.replicator.ingress.hosts }}
|
||||
{{- range $host := .Values.artifactory.replicator.ingress.hosts }}
|
||||
- host: {{ $host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: /replicator/
|
||||
backend:
|
||||
serviceName: {{ $serviceName }}
|
||||
servicePort: {{ $servicePort }}
|
||||
- path: /artifactory/api/replication/replicate/file/streaming
|
||||
backend:
|
||||
serviceName: {{ $serviceName }}
|
||||
servicePort: {{ $servicePort }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if .Values.artifactory.replicator.ingress.tls }}
|
||||
tls:
|
||||
{{ toYaml .Values.artifactory.replicator.ingress.tls | indent 4 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if and .Values.artifactory.replicator.enabled .Values.artifactory.replicator.trackerIngress.enabled }}
|
||||
---
|
||||
{{- $replicatorTrackerIngressName := default ( include "artifactory-ha.replicator.tracker.fullname" . ) .Values.artifactory.replicator.trackerIngress.name -}}
|
||||
{{- if semverCompare ">=v1.14.0-0" .Capabilities.KubeVersion.GitVersion }}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else }}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $replicatorTrackerIngressName }}
|
||||
labels:
|
||||
app: "{{ template "artifactory-ha.name" $ }}"
|
||||
chart: "{{ template "artifactory-ha.chart" $ }}"
|
||||
release: {{ $.Release.Name | quote }}
|
||||
heritage: {{ $.Release.Service | quote }}
|
||||
{{- if .Values.artifactory.replicator.trackerIngress.annotations }}
|
||||
annotations:
|
||||
{{ .Values.artifactory.replicator.trackerIngress.annotations | toYaml | trimSuffix "\n" | indent 4 -}}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.defaultBackend.enabled }}
|
||||
backend:
|
||||
serviceName: {{ $serviceName }}
|
||||
servicePort: {{ $servicePort }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- if .Values.artifactory.replicator.trackerIngress.hosts }}
|
||||
{{- range $host := .Values.artifactory.replicator.trackerIngress.hosts }}
|
||||
- host: {{ $host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
backend:
|
||||
serviceName: {{ $serviceName }}
|
||||
servicePort: {{ $servicePort }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if .Values.artifactory.replicator.trackerIngress.tls }}
|
||||
tls:
|
||||
{{ toYaml .Values.artifactory.replicator.trackerIngress.tls | indent 4 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if .Values.customIngress }}
|
||||
---
|
||||
{{ .Values.customIngress | toYaml | trimSuffix "\n" }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
|
@ -0,0 +1,63 @@
|
|||
{{- if or .Values.artifactory.loggers .Values.artifactory.catalinaLoggers }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "artifactory-ha.fullname" . }}-logger
|
||||
labels:
|
||||
app: {{ template "artifactory-ha.name" . }}
|
||||
chart: {{ template "artifactory-ha.chart" . }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
data:
|
||||
tail-log.sh: |
|
||||
#!/bin/sh
|
||||
|
||||
LOG_DIR=$1
|
||||
LOG_NAME=$2
|
||||
PID=
|
||||
|
||||
# Wait for log dir to appear
|
||||
while [ ! -d ${LOG_DIR} ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
cd ${LOG_DIR}
|
||||
|
||||
LOG_PREFIX=$(echo ${LOG_NAME} | sed 's/.log$//g')
|
||||
|
||||
# Find the log to tail
|
||||
LOG_FILE=$(ls -1t ./${LOG_PREFIX}*.log 2>/dev/null | head -1)
|
||||
|
||||
# Wait for the log file
|
||||
while [ -z "${LOG_FILE}" ]; do
|
||||
sleep 1
|
||||
LOG_FILE=$(ls -1t ./${LOG_PREFIX}*.log 2>/dev/null | head -1)
|
||||
done
|
||||
|
||||
echo "Log file ${LOG_FILE} is ready!"
|
||||
|
||||
# Get inode number
|
||||
INODE_ID=$(ls -i ${LOG_FILE})
|
||||
|
||||
# echo "Tailing ${LOG_FILE}"
|
||||
tail -F ${LOG_FILE} &
|
||||
PID=$!
|
||||
|
||||
# Loop forever to see if a new log was created
|
||||
while true; do
|
||||
# Check inode number
|
||||
NEW_INODE_ID=$(ls -i ${LOG_FILE})
|
||||
|
||||
# If inode number changed, this means log was rotated and need to start a new tail
|
||||
if [ "${INODE_ID}" != "${NEW_INODE_ID}" ]; then
|
||||
kill -9 ${PID} 2>/dev/null
|
||||
INODE_ID="${NEW_INODE_ID}"
|
||||
|
||||
# Start a new tail
|
||||
tail -F ${LOG_FILE} &
|
||||
PID=$!
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
{{- end }}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue