Skip to content

Commit

Permalink
Support to install Kubeapps offline (#1751)
Browse files Browse the repository at this point in the history
* Support to install Kubeapps offline

* Remove debug changes. Fix dashboard build

* Fix values.yaml
  • Loading branch information
Andres Martinez Gotor authored May 26, 2020
1 parent 4c9db99 commit a68fa6c
Show file tree
Hide file tree
Showing 15 changed files with 104 additions and 39 deletions.
1 change: 1 addition & 0 deletions chart/kubeapps/templates/apprepository-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ spec:
containers:
- name: controller
image: {{ template "kubeapps.image" (list .Values.apprepository.image .Values.global) }}
imagePullPolicy: {{ .Values.apprepository.image.pullPolicy | quote }}
command:
- /apprepository-controller
args:
Expand Down
1 change: 1 addition & 0 deletions chart/kubeapps/templates/apprepository-jobs-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ spec:
containers:
- name: kubectl
image: {{ template "kubeapps.image" (list .Values.hooks.image .Values.global) }}
imagePullPolicy: {{ .Values.hooks.image.pullPolicy | quote }}
command:
- /bin/sh
args:
Expand Down
4 changes: 3 additions & 1 deletion chart/kubeapps/templates/apprepository-jobs-postupgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ spec:
containers:
- name: invalidate-cache
image: {{ template "kubeapps.image" (list .Values.apprepository.syncImage .Values.global) }}
imagePullPolicy: {{ .Values.apprepository.syncImage.pullPolicy | quote }}
command:
- /asset-syncer
args:
Expand Down Expand Up @@ -73,7 +74,8 @@ spec:
# Helm 3.1 supports a lookup template tag to create a secret if it does not exist
# but we can't yet restrict to helm 3.1, hence manually doing this with an initContainer.
- name: ensure-postgres-password
image: bitnami/kubectl:1.18.2
image: {{ template "kubeapps.image" (list .Values.hooks.image .Values.global) }}
imagePullPolicy: {{ .Values.hooks.image.pullPolicy | quote }}
command:
- /bin/bash
args:
Expand Down
1 change: 1 addition & 0 deletions chart/kubeapps/templates/assetsvc-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec:
containers:
- name: assetsvc
image: {{ template "kubeapps.image" (list .Values.assetsvc.image .Values.global) }}
imagePullPolicy: {{ .Values.assetsvc.image.pullPolicy | quote }}
command:
- /assetsvc
{{- if .Values.mongodb.enabled }}
Expand Down
1 change: 1 addition & 0 deletions chart/kubeapps/templates/dashboard-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ spec:
containers:
- name: dashboard
image: {{ template "kubeapps.image" (list .Values.dashboard.image .Values.global) }}
imagePullPolicy: {{ .Values.dashboard.image.pullPolicy | quote }}
{{- if .Values.dashboard.livenessProbe }}
livenessProbe: {{- toYaml .Values.dashboard.livenessProbe | nindent 12 }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions chart/kubeapps/templates/db-secret-jobs-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ spec:
containers:
- name: kubectl
image: {{ template "kubeapps.image" (list .Values.hooks.image .Values.global) }}
imagePullPolicy: {{ .Values.hooks.image.pullPolicy | quote }}
command:
- /bin/sh
args:
Expand Down
2 changes: 2 additions & 0 deletions chart/kubeapps/templates/kubeapps-frontend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ spec:
containers:
- name: nginx
image: {{ template "kubeapps.image" (list .Values.frontend.image .Values.global) }}
imagePullPolicy: {{ .Values.frontend.image.pullPolicy | quote }}
{{- if .Values.frontend.livenessProbe }}
livenessProbe: {{- toYaml .Values.frontend.livenessProbe | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -75,6 +76,7 @@ spec:
- {{ . }}
{{- end }}
image: {{ template "kubeapps.image" (list .Values.authProxy.image .Values.global) }}
imagePullPolicy: {{ .Values.authProxy.image.pullPolicy | quote }}
ports:
- name: proxy
containerPort: 3000
Expand Down
1 change: 1 addition & 0 deletions chart/kubeapps/templates/kubeops-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ spec:
containers:
- name: kubeops
image: {{ template "kubeapps.image" (list .Values.kubeops.image .Values.global) }}
imagePullPolicy: {{ .Values.kubeops.image.pullPolicy | quote }}
command:
- /kubeops
args:
Expand Down
43 changes: 43 additions & 0 deletions chart/kubeapps/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ frontend:
registry: docker.io
repository: bitnami/nginx
tag: 1.17.10-debian-10-r10
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent

## Frontend service parameters
##
service:
Expand Down Expand Up @@ -189,6 +194,10 @@ apprepository:
registry: docker.io
repository: kubeapps/apprepository-controller
tag: latest
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent
## Kubeapps assets synchronization tool
## Image used to perform chart repository syncs
## ref: https://hub.docker.com/r/bitnami/kubeapps-asset-syncer/tags/
Expand All @@ -197,6 +206,11 @@ apprepository:
registry: docker.io
repository: kubeapps/asset-syncer
tag: latest
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent

## Initial charts repo proxies to configure
##
initialReposProxy:
Expand Down Expand Up @@ -264,6 +278,11 @@ hooks:
registry: docker.io
repository: bitnami/kubectl
tag: 1.16.3-debian-10-r85
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent

## Affinity for hooks' pods assignment
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
##
Expand All @@ -285,6 +304,11 @@ kubeops:
registry: docker.io
repository: kubeapps/kubeops
tag: latest
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent

service:
port: 8080
resources:
Expand Down Expand Up @@ -327,6 +351,10 @@ tillerProxy:
registry: docker.io
repository: kubeapps/tiller-proxy
tag: latest
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent

## Tiller Proxy service parameters
##
Expand Down Expand Up @@ -401,6 +429,11 @@ assetsvc:
registry: docker.io
repository: kubeapps/assetsvc
tag: latest
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent

## Assetsvc service parameters
##
service:
Expand Down Expand Up @@ -461,6 +494,11 @@ dashboard:
registry: docker.io
repository: kubeapps/dashboard
tag: latest
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent

## Dashboard service parameters
##
service:
Expand Down Expand Up @@ -607,6 +645,11 @@ authProxy:
registry: docker.io
repository: bitnami/oauth2-proxy
tag: 5.1.0-debian-10-r24
## Specify a imagePullPolicy
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent

## Mandatory parameters
##
provider: ""
Expand Down
10 changes: 6 additions & 4 deletions cmd/apprepository-controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ func syncJobSpec(apprepo *apprepov1alpha1.AppRepository, kubeappsNamespace strin
}
podTemplateSpec.Spec.Containers[0].Name = "sync"
podTemplateSpec.Spec.Containers[0].Image = repoSyncImage
podTemplateSpec.Spec.Containers[0].ImagePullPolicy = "IfNotPresent"
podTemplateSpec.Spec.Containers[0].Command = []string{repoSyncCommand}
podTemplateSpec.Spec.Containers[0].Args = apprepoSyncJobArgs(apprepo)
podTemplateSpec.Spec.Containers[0].Env = append(podTemplateSpec.Spec.Containers[0].Env, apprepoSyncJobEnvVars(apprepo, kubeappsNamespace)...)
Expand Down Expand Up @@ -513,10 +514,11 @@ func cleanupJobSpec(repoName, repoNamespace string) batchv1.JobSpec {
RestartPolicy: "Never",
Containers: []corev1.Container{
{
Name: "delete",
Image: repoSyncImage,
Command: []string{repoSyncCommand},
Args: apprepoCleanupJobArgs(repoName, repoNamespace),
Name: "delete",
Image: repoSyncImage,
ImagePullPolicy: "IfNotPresent",
Command: []string{repoSyncCommand},
Args: apprepoCleanupJobArgs(repoName, repoNamespace),
Env: []corev1.EnvVar{
{
Name: "DB_PASSWORD",
Expand Down
70 changes: 40 additions & 30 deletions cmd/apprepository-controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ func Test_newCronJob(t *testing.T) {
RestartPolicy: "OnFailure",
Containers: []corev1.Container{
{
Name: "sync",
Image: repoSyncImage,
Command: []string{"/chart-repo"},
Name: "sync",
Image: repoSyncImage,
ImagePullPolicy: "IfNotPresent",
Command: []string{"/chart-repo"},
Args: []string{
"sync",
"--database-type=mongodb",
Expand Down Expand Up @@ -168,9 +169,10 @@ func Test_newCronJob(t *testing.T) {
RestartPolicy: "OnFailure",
Containers: []corev1.Container{
{
Name: "sync",
Image: repoSyncImage,
Command: []string{"/chart-repo"},
Name: "sync",
Image: repoSyncImage,
ImagePullPolicy: "IfNotPresent",
Command: []string{"/chart-repo"},
Args: []string{
"sync",
"--database-type=mongodb",
Expand Down Expand Up @@ -255,9 +257,10 @@ func Test_newCronJob(t *testing.T) {
RestartPolicy: "OnFailure",
Containers: []corev1.Container{
{
Name: "sync",
Image: repoSyncImage,
Command: []string{"/chart-repo"},
Name: "sync",
Image: repoSyncImage,
ImagePullPolicy: "IfNotPresent",
Command: []string{"/chart-repo"},
Args: []string{
"sync",
"--database-type=mongodb",
Expand Down Expand Up @@ -372,9 +375,10 @@ func Test_newSyncJob(t *testing.T) {
RestartPolicy: "OnFailure",
Containers: []corev1.Container{
{
Name: "sync",
Image: repoSyncImage,
Command: []string{"/chart-repo"},
Name: "sync",
Image: repoSyncImage,
ImagePullPolicy: "IfNotPresent",
Command: []string{"/chart-repo"},
Args: []string{
"sync",
"--database-type=mongodb",
Expand Down Expand Up @@ -438,9 +442,10 @@ func Test_newSyncJob(t *testing.T) {
RestartPolicy: "OnFailure",
Containers: []corev1.Container{
{
Name: "sync",
Image: repoSyncImage,
Command: []string{"/chart-repo"},
Name: "sync",
Image: repoSyncImage,
ImagePullPolicy: "IfNotPresent",
Command: []string{"/chart-repo"},
Args: []string{
"sync",
"--database-type=mongodb",
Expand Down Expand Up @@ -518,9 +523,10 @@ func Test_newSyncJob(t *testing.T) {
RestartPolicy: "OnFailure",
Containers: []corev1.Container{
{
Name: "sync",
Image: repoSyncImage,
Command: []string{"/chart-repo"},
Name: "sync",
Image: repoSyncImage,
ImagePullPolicy: "IfNotPresent",
Command: []string{"/chart-repo"},
Args: []string{
"sync",
"--database-type=mongodb",
Expand Down Expand Up @@ -605,9 +611,10 @@ func Test_newSyncJob(t *testing.T) {
RestartPolicy: "OnFailure",
Containers: []corev1.Container{
{
Name: "sync",
Image: repoSyncImage,
Command: []string{"/chart-repo"},
Name: "sync",
Image: repoSyncImage,
ImagePullPolicy: "IfNotPresent",
Command: []string{"/chart-repo"},
Args: []string{
"sync",
"--database-type=mongodb",
Expand Down Expand Up @@ -703,9 +710,10 @@ func Test_newSyncJob(t *testing.T) {
RestartPolicy: "OnFailure",
Containers: []corev1.Container{
{
Name: "sync",
Image: repoSyncImage,
Command: []string{"/chart-repo"},
Name: "sync",
Image: repoSyncImage,
ImagePullPolicy: "IfNotPresent",
Command: []string{"/chart-repo"},
Args: []string{
"sync",
"--database-type=mongodb",
Expand Down Expand Up @@ -819,9 +827,10 @@ func Test_newSyncJob(t *testing.T) {
RestartPolicy: "OnFailure",
Containers: []corev1.Container{
{
Name: "sync",
Image: repoSyncImage,
Command: []string{"/chart-repo"},
Name: "sync",
Image: repoSyncImage,
ImagePullPolicy: "IfNotPresent",
Command: []string{"/chart-repo"},
Args: []string{
"sync",
"--database-type=mongodb",
Expand Down Expand Up @@ -895,9 +904,10 @@ func Test_newCleanupJob(t *testing.T) {
RestartPolicy: "Never",
Containers: []corev1.Container{
{
Name: "delete",
Image: repoSyncImage,
Command: []string{"/chart-repo"},
Name: "delete",
Image: repoSyncImage,
ImagePullPolicy: "IfNotPresent",
Command: []string{"/chart-repo"},
Args: []string{
"delete",
"my-charts",
Expand Down
3 changes: 3 additions & 0 deletions dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ WORKDIR /app
COPY package.json yarn.lock /app/
RUN yarn install --frozen-lockfile

RUN mkdir /app/src
RUN curl -L https://unpkg.com/@bitnami/hex@3.2.0/dist/hex.min.css > /app/src/hex.min.css

COPY . /app
RUN yarn run build

Expand Down
Binary file added dashboard/kubeapps-3.6.0.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion dashboard/src/index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import url("https://fonts.googleapis.com/css?family=Fira+Sans:300,400,700|Hind:300,400,700");
@import url("//unpkg.com/@bitnami/hex@3.2.0/dist/hex.min.css");
@import "hex.min.css";

body {
margin: 0;
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ require (
github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/heptiolabs/healthcheck v0.0.0-20180807145615-6ff867650f40
github.com/imdario/mergo v0.3.8 // indirect
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect
github.com/kubeapps/common v0.0.0-20200304064434-f6ba82e79f47
github.com/lib/pq v1.3.0
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/miekg/dns v0.0.0-20181005163659-0d29b283ac0f // indirect
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.2.1 // indirect
Expand All @@ -57,7 +55,6 @@ require (
golang.org/x/sys v0.0.0-20191028164358-195ce5e7f934 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e // indirect
google.golang.org/appengine v1.6.5 // indirect
google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6 // indirect
google.golang.org/grpc v1.27.0
gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0 // indirect
Expand Down

0 comments on commit a68fa6c

Please sign in to comment.