Skip to content

Commit

Permalink
Add --insecure-registries flag (#583)
Browse files Browse the repository at this point in the history
```sh
> helm template charts/kubedb-provisioner \
  --set insecureRegistries[0]=harbor.example.com \
  --set insecureRegistries[1]=hub.example.com

> helm template charts/kubedb \
  --set global.insecureRegistries[0]=hub.example.com \
  --set global.insecureRegistries[1]=hub2.example.com \
  --set kubedb-provisioner.insecureRegistries[0]=harbor.example.com
```

Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha authored Jan 16, 2023
1 parent 321c372 commit a070531
Show file tree
Hide file tree
Showing 29 changed files with 126 additions and 29 deletions.
11 changes: 6 additions & 5 deletions apis/installer/v1alpha1/kubedb_ops_manager_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ type KubedbOpsManagerSpec struct {
//+optional
NameOverride string `json:"nameOverride"`
//+optional
FullnameOverride string `json:"fullnameOverride"`
ReplicaCount int32 `json:"replicaCount"`
RegistryFQDN string `json:"registryFQDN"`
Operator Container `json:"operator"`
ImagePullPolicy string `json:"imagePullPolicy"`
FullnameOverride string `json:"fullnameOverride"`
ReplicaCount int32 `json:"replicaCount"`
RegistryFQDN string `json:"registryFQDN"`
InsecureRegistries []string `json:"insecureRegistries"`
Operator Container `json:"operator"`
ImagePullPolicy string `json:"imagePullPolicy"`
//+optional
ImagePullSecrets []core.LocalObjectReference `json:"imagePullSecrets"`
// +optional
Expand Down
11 changes: 6 additions & 5 deletions apis/installer/v1alpha1/kubedb_provisioner_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ type KubedbProvisionerSpec struct {
//+optional
NameOverride string `json:"nameOverride"`
//+optional
FullnameOverride string `json:"fullnameOverride"`
ReplicaCount int32 `json:"replicaCount"`
RegistryFQDN string `json:"registryFQDN"`
Operator Container `json:"operator"`
ImagePullPolicy string `json:"imagePullPolicy"`
FullnameOverride string `json:"fullnameOverride"`
ReplicaCount int32 `json:"replicaCount"`
RegistryFQDN string `json:"registryFQDN"`
InsecureRegistries []string `json:"insecureRegistries"`
Operator Container `json:"operator"`
ImagePullPolicy string `json:"imagePullPolicy"`
//+optional
ImagePullSecrets []core.LocalObjectReference `json:"imagePullSecrets"`
// +optional
Expand Down
7 changes: 4 additions & 3 deletions apis/installer/v1alpha1/kubedb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ type KubedbMetricsValues struct {
}

type GlobalValues struct {
License string `json:"license"`
Registry string `json:"registry"`
RegistryFQDN string `json:"registryFQDN"`
License string `json:"license"`
Registry string `json:"registry"`
RegistryFQDN string `json:"registryFQDN"`
InsecureRegistries []string `json:"insecureRegistries"`
//+optional
ImagePullSecrets []core.LocalObjectReference `json:"imagePullSecrets"`
Monitoring EASMonitoring `json:"monitoring"`
Expand Down
15 changes: 15 additions & 0 deletions apis/installer/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion charts/kubedb-autoscaler/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Returns the registry used for operator docker image
{{- list .Values.registryFQDN .Values.operator.registry | compact | join "/" }}
{{- end }}

{{- define "appscode.imagePullSecrets" -}}
{{- define "docker.imagePullSecrets" -}}
{{- with .Values.imagePullSecrets -}}
imagePullSecrets:
{{- toYaml . | nindent 2 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kubedb-autoscaler/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "appscode.imagePullSecrets" . | nindent 6 }}
{{- include "docker.imagePullSecrets" . | nindent 6 }}
serviceAccountName: {{ include "kubedb-autoscaler.serviceAccountName" . }}
containers:
- name: operator
Expand Down
2 changes: 1 addition & 1 deletion charts/kubedb-dashboard/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Returns the registry used for operator docker image
{{- list .Values.registryFQDN .Values.operator.registry | compact | join "/" }}
{{- end }}

{{- define "appscode.imagePullSecrets" -}}
{{- define "docker.imagePullSecrets" -}}
{{- with .Values.imagePullSecrets -}}
imagePullSecrets:
{{- toYaml . | nindent 2 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kubedb-dashboard/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "appscode.imagePullSecrets" . | nindent 6 }}
{{- include "docker.imagePullSecrets" . | nindent 6 }}
serviceAccountName: {{ include "kubedb-dashboard.serviceAccountName" . }}
containers:
- name: operator
Expand Down
1 change: 1 addition & 0 deletions charts/kubedb-ops-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ The following table lists the configurable parameters of the `kubedb-ops-manager
| replicaCount | Number of KubeDB operator replicas to create (only 1 is supported) | <code>1</code> |
| license | License for the product. Get a license by following the steps from [here](https://stash.run/docs/latest/setup/install/enterprise#get-a-trial-license). <br> Example: <br> `helm install appscode/kubedb-ops-manager \` <br> `--set-file license=/path/to/license/file` <br> `or` <br> `helm install appscode/kubedb-ops-manager \` <br> `--set license=<license file content>` | <code>""</code> |
| registryFQDN | Docker registry fqdn used to pull KubeDB related images Set this to use docker registry hosted at ${registryFQDN}/${registry}/${image} | <code>ghcr.io</code> |
| insecureRegistries | Specify an array of insecure registries. <br> Example: <br> `helm template charts/kubedb-ops-manager \` <br> `--set insecureRegistries[0]=hub.company.com \` <br> `--set insecureRegistries[1]=reg.example.com` | <code>[]</code> |
| operator.registry | Docker registry used to pull KubeDB ops manager image | <code>kubedb</code> |
| operator.repository | KubeDB ops manager container image | <code>kubedb-ops-manager</code> |
| operator.tag | KubeDB ops manager container image tag | <code>""</code> |
Expand Down
11 changes: 10 additions & 1 deletion charts/kubedb-ops-manager/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,22 @@ Returns the registry used for operator docker image
{{- list .Values.registryFQDN .Values.operator.registry | compact | join "/" }}
{{- end }}

{{- define "appscode.imagePullSecrets" -}}
{{- define "docker.imagePullSecrets" -}}
{{- with .Values.imagePullSecrets -}}
imagePullSecrets:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}

{{/*
Returns the --insecure-registries flags
*/}}
{{- define "docker.insecureRegistries" -}}
{{- range (.Values.insecureRegistries | uniq | sortAlpha) }}
- --insecure-registries={{.}}
{{- end }}
{{- end }}

{{/*
Returns the enabled monitoring agent name
*/}}
Expand Down
3 changes: 2 additions & 1 deletion charts/kubedb-ops-manager/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "appscode.imagePullSecrets" . | nindent 6 }}
{{- include "docker.imagePullSecrets" . | nindent 6 }}
serviceAccountName: {{ include "kubedb-ops-manager.serviceAccountName" . }}
containers:
- name: operator
Expand All @@ -50,6 +50,7 @@ spec:
- --gen-rotate-tls-recommendation-before-expiry-month={{ .genRotateTLSRecommendationBeforeExpiryMonth }}
- --gen-rotate-tls-recommendation-before-expiry-day={{ .genRotateTLSRecommendationBeforeExpiryDay }}
{{- end }}
{{ include "docker.insecureRegistries" . | nindent 8 }}
{{- if include "appscode.license" . }}
- --license-file=/var/run/secrets/appscode/license/key.txt
{{- end }}
Expand Down
5 changes: 5 additions & 0 deletions charts/kubedb-ops-manager/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,10 @@ properties:
type: object
x-kubernetes-map-type: atomic
type: array
insecureRegistries:
items:
type: string
type: array
license:
type: string
logLevel:
Expand Down Expand Up @@ -1237,6 +1241,7 @@ properties:
required:
- apiserver
- imagePullPolicy
- insecureRegistries
- monitoring
- operator
- registryFQDN
Expand Down
7 changes: 7 additions & 0 deletions charts/kubedb-ops-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ license: ""
# Docker registry fqdn used to pull KubeDB related images
# Set this to use docker registry hosted at ${registryFQDN}/${registry}/${image}
registryFQDN: ghcr.io
# Specify an array of insecure registries.
#
# Example:
# helm template charts/kubedb-ops-manager \
# --set insecureRegistries[0]=hub.company.com \
# --set insecureRegistries[1]=reg.example.com
insecureRegistries: []
# Docker registry containing KubeDB images
operator:
# Docker registry used to pull KubeDB ops manager image
Expand Down
2 changes: 1 addition & 1 deletion charts/kubedb-opscenter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Returns the registry used for image docker image
{{/*
Returns the appscode image pull secrets
*/}}
{{- define "appscode.imagePullSecrets" -}}
{{- define "docker.imagePullSecrets" -}}
{{- with .Values.global.imagePullSecrets -}}
imagePullSecrets:
{{- toYaml . | nindent 2 }}
Expand Down
1 change: 1 addition & 0 deletions charts/kubedb-provisioner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ The following table lists the configurable parameters of the `kubedb-provisioner
| replicaCount | Number of KubeDB operator replicas to create (only 1 is supported) | <code>1</code> |
| license | License for the product. Get a license by following the steps from [here](https://kubedb.run/docs/latest/setup/install/enterprise#get-a-trial-license). <br> Example: <br> `helm install appscode/kubedb-ops-manager \` <br> `--set-file license=/path/to/license/file` <br> `or` <br> `helm install appscode/kubedb-ops-manager \` <br> `--set license=<license file content>` | <code>""</code> |
| registryFQDN | Docker registry fqdn used to pull KubeDB related images Set this to use docker registry hosted at ${registryFQDN}/${registry}/${image} | <code>ghcr.io</code> |
| insecureRegistries | Specify an array of insecure registries. <br> Example: <br> `helm template charts/kubedb-ops-manager \` <br> `--set insecureRegistries[0]=hub.company.com \` <br> `--set insecureRegistries[1]=reg.example.com` | <code>[]</code> |
| operator.registry | Docker registry used to pull KubeDB operator image | <code>kubedb</code> |
| operator.repository | KubeDB operator container image | <code>kubedb-provisioner</code> |
| operator.tag | KubeDB operator container image tag | <code>""</code> |
Expand Down
11 changes: 10 additions & 1 deletion charts/kubedb-provisioner/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,22 @@ Returns the registry used for operator docker image
{{- list .Values.registryFQDN .Values.operator.registry | compact | join "/" }}
{{- end }}

{{- define "appscode.imagePullSecrets" -}}
{{- define "docker.imagePullSecrets" -}}
{{- with .Values.imagePullSecrets -}}
imagePullSecrets:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}

{{/*
Returns the --insecure-registries flags
*/}}
{{- define "docker.insecureRegistries" -}}
{{- range (.Values.insecureRegistries | uniq | sortAlpha) }}
- --insecure-registries={{.}}
{{- end }}
{{- end }}

{{/*
Returns the enabled monitoring agent name
*/}}
Expand Down
3 changes: 2 additions & 1 deletion charts/kubedb-provisioner/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "appscode.imagePullSecrets" . | nindent 6 }}
{{- include "docker.imagePullSecrets" . | nindent 6 }}
serviceAccountName: {{ include "kubedb-provisioner.serviceAccountName" . }}
containers:
- name: operator
Expand All @@ -44,6 +44,7 @@ spec:
- --use-kubeapiserver-fqdn-for-aks={{ .Values.apiserver.useKubeapiserverFqdnForAks }}
- --metrics-bind-address=:{{ .Values.monitoring.bindPort }}
- --health-probe-bind-address=:{{ .Values.apiserver.healthcheck.probePort }}
{{ include "docker.insecureRegistries" . | nindent 8 }}
{{- if include "appscode.license" . }}
- --license-file=/var/run/secrets/appscode/license/key.txt
{{- end }}
Expand Down
5 changes: 5 additions & 0 deletions charts/kubedb-provisioner/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,10 @@ properties:
type: object
x-kubernetes-map-type: atomic
type: array
insecureRegistries:
items:
type: string
type: array
license:
type: string
logLevel:
Expand Down Expand Up @@ -1227,6 +1231,7 @@ properties:
required:
- apiserver
- imagePullPolicy
- insecureRegistries
- monitoring
- operator
- registryFQDN
Expand Down
7 changes: 7 additions & 0 deletions charts/kubedb-provisioner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ license: ""
# Docker registry fqdn used to pull KubeDB related images
# Set this to use docker registry hosted at ${registryFQDN}/${registry}/${image}
registryFQDN: ghcr.io
# Specify an array of insecure registries.
#
# Example:
# helm template charts/kubedb-ops-manager \
# --set insecureRegistries[0]=hub.company.com \
# --set insecureRegistries[1]=reg.example.com
insecureRegistries: []
# Docker registry containing KubeDB images
operator:
# Docker registry used to pull KubeDB operator image
Expand Down
2 changes: 1 addition & 1 deletion charts/kubedb-schema-manager/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Returns the registry used for operator docker image
{{- list .Values.registryFQDN .Values.operator.registry | compact | join "/" }}
{{- end }}

{{- define "appscode.imagePullSecrets" -}}
{{- define "docker.imagePullSecrets" -}}
{{- with .Values.imagePullSecrets -}}
imagePullSecrets:
{{- toYaml . | nindent 2 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kubedb-schema-manager/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "appscode.imagePullSecrets" . | nindent 6 }}
{{- include "docker.imagePullSecrets" . | nindent 6 }}
serviceAccountName: {{ include "kubedb-schema-manager.serviceAccountName" . }}
containers:
- name: operator
Expand Down
2 changes: 1 addition & 1 deletion charts/kubedb-ui-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Returns the registry used for image docker image
{{- list .Values.registryFQDN .Values.image.registry | compact | join "/" }}
{{- end }}

{{- define "appscode.imagePullSecrets" -}}
{{- define "docker.imagePullSecrets" -}}
{{- with .Values.imagePullSecrets -}}
imagePullSecrets:
{{- toYaml . | nindent 2 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kubedb-ui-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "appscode.imagePullSecrets" . | nindent 6 }}
{{- include "docker.imagePullSecrets" . | nindent 6 }}
serviceAccountName: {{ include "kubedb-ui-server.serviceAccountName" . }}
containers:
- name: server
Expand Down
2 changes: 1 addition & 1 deletion charts/kubedb-webhook-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Returns the registry used for operator docker image
{{- list .Values.registryFQDN .Values.server.registry | compact | join "/" }}
{{- end }}

{{- define "appscode.imagePullSecrets" -}}
{{- define "docker.imagePullSecrets" -}}
{{- with .Values.imagePullSecrets -}}
imagePullSecrets:
{{- toYaml . | nindent 2 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kubedb-webhook-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- include "appscode.imagePullSecrets" . | nindent 6 }}
{{- include "docker.imagePullSecrets" . | nindent 6 }}
serviceAccountName: {{ include "kubedb-webhook-server.serviceAccountName" . }}
containers:
- name: operator
Expand Down
Loading

0 comments on commit a070531

Please sign in to comment.