Skip to content

Commit

Permalink
US-512990: External Image Pull Secrets (#495)
Browse files Browse the repository at this point in the history
US-512990: External image pull secrets for docker registry credentials
  • Loading branch information
PEGA-NarasimhaRao-Meda committed Jan 11, 2023
1 parent 966316c commit c865fd4
Show file tree
Hide file tree
Showing 17 changed files with 338 additions and 5 deletions.
3 changes: 3 additions & 0 deletions charts/pega/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ Specify the location for the Pega Docker image. This image is available on Dock

When using a private registry that requires a username and password, specify them using the `docker.registry.username` and `docker.registry.password` parameters.

To avoid specifying Docker registry credentials in values.yaml, create secrets for Docker registry credentials to avoid exposing these credentials. Refer to [Kubernetes secrets](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) to create Docker registry secrets. Specify secret names as a list of comma-separated strings using the `docker.imagePullSecretNames` parameter. Kubernetes checks each registry secret of image pull secrets to pull an image from the repository. If the specified image is available in one of the provided secrets, kubernetes will pull it from that repository. To create Docker registry secrets from external secrets, refer to [this section](#optional-support-for-providing-credentialscertificates-using-external-secrets-operator).

When you download Docker images, it is recommended that you specify the absolute image version and the image name instead of using the `latest` tag; for example: `pegasystems/pega:8.4.4` or `platform-services/search-n-reporting-service:1.12.0`. When you download these images with these details from the Pega repository, you pull the latest available image. If you pull images only specifying `latest`, you may not get the image you wanted.

For this reason, it is also recommended that you specify the `docker.pega.imagePullPolicy: "IfNotPresent"` option in production, since it will ensure that a new generic tagged image will not overwrite the locally cached version.
Expand All @@ -165,6 +167,7 @@ docker:
url: "YOUR_DOCKER_REGISTRY"
username: "YOUR_DOCKER_REGISTRY_USERNAME"
password: "YOUR_DOCKER_REGISTRY_PASSWORD"
imagePullSecretNames: []
pega:
image: "pegasystems/pega:8.4.4"
imagePullPolicy: "Always"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
app: constellation
spec:
imagePullSecrets:
- name: {{ template "pegaRegistrySecret" $ }}
{{- include "imagePullSecrets" . | indent 6 }}
containers:
- name: constellation
imagePullPolicy: {{ .Values.imagePullPolicy }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ spec:
# Volume used to mount secret files.
{{- include "pegaCredentialVolumeTemplate" . | indent 6 }}
imagePullSecrets:
- name: {{ template "pegaRegistrySecret" $ }}
{{- include "imagePullSecrets" . | indent 6 }}
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ spec:
{{- end }}
restartPolicy: Never
imagePullSecrets:
- name: {{ template "pegaRegistrySecret" .root }}
{{- include "imagePullSecrets" .root | indent 6 }}
---
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ spec:
- name: esstorage
mountPath: /usr/share/elasticsearch/data
imagePullSecrets:
- name: {{ template "pegaRegistrySecret" $}}
{{- include "imagePullSecrets" . | indent 6 }}
volumeClaimTemplates:
- metadata:
name: esstorage
Expand Down
13 changes: 13 additions & 0 deletions charts/pega/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ false
{{- define "pegaBackendConfig" -}}pega-backend-config{{- end -}}

{{- define "imagePullSecret" }}
{{- if .Values.global.docker.registry }}
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.global.docker.registry.url (printf "%s:%s" .Values.global.docker.registry.username .Values.global.docker.registry.password | b64enc) | b64enc }}
{{- end }}
{{- end }}

{{- define "performOnlyDeployment" }}
{{- if (eq .Values.global.actions.execute "deploy") -}}
Expand Down Expand Up @@ -480,4 +482,15 @@ servicePort: use-annotation
{{- else -}}
{{- add .failureThreshold 1 -}}
{{- end -}}
{{- end -}}

{{- define "imagePullSecrets" }}
{{- if .Values.global.docker.registry }}
- name: {{ template "pegaRegistrySecret" $ }}
{{- end }}
{{- if (.Values.global.docker.imagePullSecretNames) }}
{{- range .Values.global.docker.imagePullSecretNames }}
- name: {{ . }}
{{- end -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/pega/templates/_pega-deployment.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ spec:
# Secret which is used to pull the image from the repository. This secret contains docker login details for the particular user.
# If the image is in a protected registry, you must specify a secret to access it.
imagePullSecrets:
- name: {{ template "pegaRegistrySecret" .root }}
{{- include "imagePullSecrets" .root | indent 6 }}
{{- if (.node.volumeClaimTemplate) }}
volumeClaimTemplates:
- metadata:
Expand Down
2 changes: 2 additions & 0 deletions charts/pega/templates/pega-registry-secret.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{{- if .Values.global.docker.registry }}
{{- include "pegaRegistryCredentialsSecretTemplate" . }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/pega/values-large.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ global:
url: "YOUR_DOCKER_REGISTRY"
username: "YOUR_DOCKER_REGISTRY_USERNAME"
password: "YOUR_DOCKER_REGISTRY_PASSWORD"
# To avoid exposing Docker registry details, create secrets to manage your Docker registry credentials.
# Specify secret names as an array of comma-separated strings in double quotation marks using the imagePullSecretNames parameter. For example: ["secret1", "secret2"]
imagePullSecretNames: []
# Docker image information for the Pega docker image, containing the application server.
pega:
image: "pegasystems/pega"
Expand Down
3 changes: 3 additions & 0 deletions charts/pega/values-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ global:
url: "YOUR_DOCKER_REGISTRY"
username: "YOUR_DOCKER_REGISTRY_USERNAME"
password: "YOUR_DOCKER_REGISTRY_PASSWORD"
# To avoid exposing Docker registry details, create secrets to manage your Docker registry credentials.
# Specify secret names as an array of comma-separated strings in double quotation marks using the imagePullSecretNames parameter. For example: ["secret1", "secret2"]
imagePullSecretNames: []
# Docker image information for the Pega docker image, containing the application server.
pega:
image: "pegasystems/pega"
Expand Down
3 changes: 3 additions & 0 deletions charts/pega/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ global:
url: "YOUR_DOCKER_REGISTRY"
username: "YOUR_DOCKER_REGISTRY_USERNAME"
password: "YOUR_DOCKER_REGISTRY_PASSWORD"
# To avoid exposing Docker registry details, create secrets to manage your Docker registry credentials.
# Specify secret names as an array of comma-separated strings in double quotation marks using the imagePullSecretNames parameter. For example: ["secret1", "secret2"]
imagePullSecretNames: []
# Docker image information for the Pega docker image, containing the application server.
pega:
image: "pegasystems/pega"
Expand Down
1 change: 1 addition & 0 deletions docs/Deploying-Pega-on-AKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ helm inspect values pega/pega > <local filepath>/aks-demo/pega.yaml
| customArtifactory.authentication: basic.username: basic.password: apiKey.headerName: apiKey.value: | To download a JDBC driver from your custom artifactory which is secured with Basic or APIKey Authentication. Use `customArtifactory.authentication.basic` section to provide access credentials or use `customArtifactory.authentication.apiKey` section to provide APIKey value and dedicated APIKey header details. | <ul><li>basic.username: "\<Custom artifactory basic Authentication username\>"</li><li>basic.password: "\<Custom artifactory basic Authentication password\>"</li><li>apiKey.headerName: "\<Custom artifactory dedicated APIKey Authentication header name\>"</li><li>apiKey.value: "\<Custom artifactory APIKey value for APIKey authentication\>"</li> </ul> |
| customArtifactory.certificate: | Custom artifactory SSL certificate verification is enabled by default. If your custom artifactory domain has a self-signed SSL certificate, provide the certificate. You can disable SSL certificate verification by setting `customArtifactory.enableSSLVerification` to `false`;however, this setting establishes an insecure connection. | <ul><li> certificate: "\<custom artifactory SSL certificate to be verified\>"</li></ul> |
| docker.registry.url: username: password: | Include the URL of your Docker registry along with the registry “username” and “password” credentials. | <ul><li>url: “\<URL of your registry>” </li><li>username: "\<Registry account username\>"</li><li> password: "\<Registry account password\>"</li></ul> |
| docker.imagePullSecretNames | Specify the Docker registry secrets to pull an image from a private Docker repository. Refer to [Kubernetes Secrets](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) to create Docker registry secrets. | imagePullSecretNames: ["secret1", "secret2"] |
| docker.pega.image: | Specify the Pega-provided `Pega` image you downloaded and pushed to your Docker registry. | Image: "\<Registry host name:Port\>/my-pega:\<Pega Platform version>" |
| tier.name: ”web” tier.ingress.domain:| Set a host name for the pega-web service of the DNS zone. | <ul><li>domain: "\<the host name for your web service tier\>" </li><li>tier.ingress.tls: set to `true` to support HTTPS in the ingress and pass the SSL certificate in the cluster using a secret. For details, see step 12 in the section, **Deploying Pega Platform using the command line**.</li></ul> |
| tier.name: ”web” tier.service.tls:| Set this parameter as `true` to encrypt the traffic between the load balancer/ingress and pods. Beginning with Helm version `2.2.0` Pega provides a default self-signed certificate; Pega also supports specifying your own CA certificate. | <ul><li>tier.service.tls.enabled: set to `true` to enable the traffic encryption </li><li>tier.service.tls.port: 443</li><li>tier.service.tls.targetPort: 8443</li><li>tier.service.tls.keystore: The base64 encoded content of the keystore file. Leave this value empty to use the default, Pega-provided self-signed certificate. The CN(Common Name) of the certificate should match that of the domain specified in `tiers.web.ingress.domain`, see [End-to-end TLS with the v2 SKU](https://docs.microsoft.com/en-us/azure/application-gateway/ssl-overview#end-to-end-tls-with-the-v2-sku).</li><li>tier.service.tls.keystorepassword: the password of the keystore file</li><li>tier.service.tls.cacertificate: the base64 encrypted content of the root CA certificate. Leave this value empty for AKS deployments.</li><li>tier.service.traefik.enabled: set to `false` as this option is for `k8s` provider not for `AKS`</li></ul> |
Expand Down
1 change: 1 addition & 0 deletions docs/Deploying-Pega-on-EKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ Configure the parameters so the pega.yaml Helm chart matches your deployment res
| customArtifactory.authentication: basic.username: basic.password: apiKey.headerName: apiKey.value: | To download a JDBC driver from your custom artifactory which is secured with Basic or APIKey Authentication. Use `customArtifactory.authentication.basic` section to provide access credentials or use `customArtifactory.authentication.apiKey` section to provide APIKey value and dedicated APIKey header details. | <ul><li>basic.username: "\<Custom artifactory basic Authentication username\>"</li><li>basic.password: "\<Custom artifactory basic Authentication password\>"</li><li>apiKey.headerName: "\<Custom artifactory dedicated APIKey Authentication header name\>"</li><li>apiKey.value: "\<Custom artifactory APIKey value for APIKey authentication\>"</li> </ul> |
| customArtifactory.certificate: | Custom artifactory SSL certificate verification is enabled by default. If your custom artifactory domain has a self-signed SSL certificate, provide the certificate. You can disable SSL certificate verification by setting `customArtifactory.enableSSLVerification` to `false`;however, this setting establishes an insecure connection. | <ul><li> certificate: "\<custom artifactory SSL certificate to be verified\>"</li></ul> |
| docker.registry.url: username: password: | Map the host name of a registry to an object that contains the “username” and “password” values for that registry. For more information, search for “index.docker.io/v1” in [Engine API v1.24](https://docs.docker.com/engine/api/v1.24/). | <ul><li>url: “<https://index.docker.io/v1/>” </li><li>username: "\<DockerHub account username\>"</li><li> password: "\< DockerHub account password\>"</li></ul> |
| docker.imagePullSecretNames | Specify the Docker registry secrets to pull an image from a private Docker repository. Refer to [Kubernetes Secrets](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) to create Docker registry secrets. | imagePullSecretNames: ["secret1", "secret2"] |
| docker.pega.image: | Specify the Pega-provided `Pega` image that you downloaded and pushed to your Docker registry. | Image: "\<Registry host name:Port\>/my-pega:\<Pega Platform version>" |
| tier.name: ”web” tier.service.domain:| Set a host name for the pega-web service of the DNS zone. To support the use of HTTPS for ingress connectivity enable SSL/TLS termination protocols on the tier ingress and provide your ARN certificate, where `alb.ingress.kubernetes.io/certificate-arn` is the required annotation name and `<certificate-arn>` takes the form, `arn:aws:acm:<region>:<AWS account>:certificate/xxxxxxx` which you copy from the AWS console view of the load balancer configuration.| <ul><li>domain: "\<the host name for your web service tier\>" </li><li>ingress.tls.enabled: "true"</li><li>ingress.ssl_annotation: alb.ingress.kubernetes.io/certificate-arn: \<certificate-arn></li><li>Assign this host name with the DNS host name that the load balancer associates with the web tier; after the deployment is complete, you can log into Pega Platform with your host name in the URL. Your web tier host name must comply with your networking standards and be available on an external network.</li></ul> |
| tier.name: ”web” tier.service.tls:| Set this parameter as `true` to encrypt the traffic between the load balancer/ingress and pods. Beginning with Helm version `2.2.0` Pega provides a default self-signed certificate; Pega also supports specifying your own CA certificate. | <ul><li>tier.service.tls.enabled: set to `true` to enable the traffic encryption </li><li>tier.service.tls.port: 443</li><li>tier.service.tls.targetPort: 8443</li><li>tier.service.tls.keystore: The base64 encoded content of the keystore file. Leave this value empty to use the default, Pega-provided self-signed certificate.</li><li>tier.service.tls.keystorepassword: the password of the keystore file</li><li>tier.service.tls.cacertificate: the base64 encrypted content of the root CA certificate. You can leave this value empty for EKS deployments.</li><li>tier.service.traefik.enabled: set to `false` as this option is for `k8s` provider not for `EKS`</li></ul> |
Expand Down
1 change: 1 addition & 0 deletions docs/Deploying-Pega-on-GKE.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ Configure the following parameters so the pega.yaml Helm chart matches your depl
| customArtifactory.authentication: basic.username: basic.password: apiKey.headerName: apiKey.value: | To download a JDBC driver from your custom artifactory which is secured with Basic or APIKey Authentication. Use `customArtifactory.authentication.basic` section to provide access credentials or use `customArtifactory.authentication.apiKey` section to provide APIKey value and dedicated APIKey header details. | <ul><li>basic.username: "\<Custom artifactory basic Authentication username\>"</li><li>basic.password: "\<Custom artifactory basic Authentication password\>"</li><li>apiKey.headerName: "\<Custom artifactory dedicated APIKey Authentication header name\>"</li><li>apiKey.value: "\<Custom artifactory APIKey value for APIKey authentication\>"</li> </ul> |
| customArtifactory.certificate: | Custom artifactory SSL certificate verification is enabled by default. If your custom artifactory domain has a self-signed SSL certificate, provide the certificate. You can disable SSL certificate verification by setting `customArtifactory.enableSSLVerification` to `false`;however, this setting establishes an insecure connection. | <ul><li> certificate: "\<custom artifactory SSL certificate to be verified\>"</li></ul> |
| docker.registry.url: username: password: | Include the URL of your Docker registry along with the registry “username” and “password” credentials. | <ul><li>url: “\<URL of your registry>” </li><li>username: "\<Registry account username\>"</li><li> password: "\<Registry account password\>"</li></ul> |
| docker.imagePullSecretNames | Specify the Docker registry secrets to pull an image from a private Docker repository. Refer to [Kubernetes Secrets](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) to create Docker registry secrets. | imagePullSecretNames: ["secret1", "secret2"] |
| docker.pega.image: | Specify the Pega-provided `Pega` image you downloaded and pushed to your Docker registry. | Image: "<Registry host name:Port\>/my-pega:\<Pega Platform version>" |
| tier.name: ”web” tier.ingress.domain:| Set a host name for the pega-web service of the DNS zone. Pega supports specifying certificates for an ingress using the same methods GKE supports. Note that if you configure both secrets and pre-shared certificates on the ingress, the load balancer ignores the secrets and uses the list of pre-shared certificates. For details, see [Using multiple SSL certificates in HTTP(s) load balancing with Ingress](https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-multi-ssl). | <ul><li>tier.name: "\<the host name for your web service tier\>" </li><li>Assign this host name with an external IP address and log into Pega Platform with this host name in the URL. Your web tier host name must comply with your networking standards and be available as an external IP address.</li><li>tier.ingress.tls: set to `true` to support HTTPS in the ingress. See step 12 to support the management of the certificates in your deployment.</li></ul> |
| tier.name: ”web” tier.service.tls:| Set this parameter as `true` to encrypt the traffic between the load balancer/ingress and pods. Beginning with Helm version `2.2.0` Pega provides a default self-signed certificate; Pega also supports specifying your own CA certificate. | <ul><li>tier.service.tls.enabled: set to `true` to enable the traffic encryption </li><li>tier.service.tls.port: 443</li><li>tier.service.tls.targetPort: 8443</li><li>tier.service.tls.keystore: The base64 encoded content of the keystore file. Leave this value empty to use the default, Pega-provided self-signed certificate.</li><li>tier.service.tls.keystorepassword: the password of the keystore file</li><li>tier.service.tls.cacertificate: the base64 encrypted content of the root CA certificate. You can leave this value empty for GKE deployments.</li><li>tier.service.traefik.enabled: set to `false` as this option is for `k8s` provider not for `GKE`</li></ul> |
Expand Down
Loading

0 comments on commit c865fd4

Please sign in to comment.