Skip to content
This repository was archived by the owner on May 6, 2022. It is now read-only.

Commit ef11c30

Browse files
Thulio Ferraz Assismook-as
andauthored
fix: set cluster domain for credentials URIs (#111)
* fix: set cluster domain for credentials URIs Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: missing license headers Signed-off-by: Thulio Ferraz Assis <[email protected]> * ci: trigger Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: typo * doc: ClusterDomain option Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: comment Co-authored-by: Mark Yen <[email protected]> * fix: ease test readability with BeEmpty Co-authored-by: Mark Yen <[email protected]> * refactor: use libpod/pkg/resolvconf for parsing Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: go mod tidy Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: old make target Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: pipe test helm commands to std{err,out} Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: for loop over search path domains Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: remove the Greek letter Ω from tests Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: increase timeout for integ test helm install Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: a defer assurance for the future Signed-off-by: Thulio Ferraz Assis <[email protected]> * bump: CI testing script timeout Signed-off-by: Thulio Ferraz Assis <[email protected]> * feat: print waiting message to output Signed-off-by: Thulio Ferraz Assis <[email protected]> * feat: stream integration-tests output This also helps with CI failing when there's no output for a while. Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: use GinkgoWriter for std{out,err} Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: disable wordpress persistence on pvc Signed-off-by: Thulio Ferraz Assis <[email protected]> * feat: bump wordpress image to 5.5.1 Signed-off-by: Thulio Ferraz Assis <[email protected]> * feat: change wordpress db from mysql to mariadb Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: comment Co-authored-by: Mark Yen <[email protected]> Co-authored-by: Mark Yen <[email protected]>
1 parent 59a70ab commit ef11c30

File tree

25 files changed

+503
-138
lines changed

25 files changed

+503
-138
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ test-unit:
9494
ginkgo -cover cmd/... pkg/...
9595

9696
test-integration:
97-
(cd ./tests/integration; NAMESPACE=minibroker-tests WORDPRESS_CHART="$(WORDPRESS_CHART)" ginkgo --nodes 4 --slowSpecThreshold 180 .)
97+
(cd ./tests/integration; NAMESPACE=minibroker-tests WORDPRESS_CHART="$(WORDPRESS_CHART)" ginkgo --nodes 4 -v --stream --slowSpecThreshold 180 .)
9898

99-
test: test-unit test-integration test-wordpress
99+
test: test-unit test-integration
100100

101101
log:
102102
kubectl log -n minibroker deploy/minibroker-minibroker -c minibroker

charts/wordpress/README.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,6 @@ To install the chart with the release name `my-release`:
3939
$ helm install --name my-release charts/wordpress
4040
```
4141

42-
Note: when installing the wordpress chart on some versions of Minikube, you
43-
may encounter issues due to [kubernetes/minikube#2256](https://github.com/kubernetes/minikube/issues/2256).
44-
If you're using
45-
[v0.24.1](https://github.com/kubernetes/minikube/releases/tag/v0.24.1), we recommend setting
46-
the `persistence.enabled` parameter to `false` using the following command.
47-
48-
```console
49-
$ helm install --name my-release --namespace wp charts/wordpress \
50-
--set persistence.enabled=false
51-
```
52-
5342
The command deploys WordPress on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
5443

5544
> **Tip**: List all releases using `helm list`
@@ -96,10 +85,6 @@ The following tables lists the configurable parameters of the WordPress chart an
9685
| `ingress.secrets[0].name` | TLS Secret Name | `nil` |
9786
| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` |
9887
| `ingress.secrets[0].key` | TLS Secret Key | `nil` |
99-
| `persistence.enabled` | Enable persistence using PVC | `true` |
100-
| `persistence.storageClass` | PVC Storage Class | `nil` (uses alpha storage class annotation) |
101-
| `persistence.accessMode` | PVC Access Mode | `ReadWriteOnce` |
102-
| `persistence.size` | PVC Storage Request | `10Gi` |
10388
| `nodeSelector` | Node labels for pod assignment | `{}` |
10489

10590
The above parameters map to the env variables defined in [bitnami/wordpress](http://github.com/bitnami/bitnami-docker-wordpress). For more information please refer to the [bitnami/wordpress](http://github.com/bitnami/bitnami-docker-wordpress) image documentation.
@@ -123,13 +108,6 @@ $ helm install --name my-release -f values.yaml stable/wordpress
123108

124109
> **Tip**: You can use the default [values.yaml](values.yaml)
125110
126-
## Persistence
127-
128-
The [Bitnami WordPress](https://github.com/bitnami/bitnami-docker-wordpress) image stores the WordPress data and configurations at the `/bitnami` path of the container.
129-
130-
Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube.
131-
See the [Configuration](#configuration) section to configure the PVC or to disable persistence.
132-
133111
## Ingress
134112

135113
This chart provides support for ingress resources. If you have an

charts/wordpress/templates/deployment.yaml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,32 @@ spec:
1717
labels:
1818
app: {{ template "fullname" . }}
1919
spec:
20+
hostAliases:
21+
- ip: "127.0.0.1"
22+
hostnames:
23+
- status.localhost
24+
securityContext:
25+
runAsUser: 1001
26+
fsGroup: 1001
2027
containers:
2128
- name: {{ template "fullname" . }}
2229
image: "{{ .Values.image }}"
2330
imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }}
2431
env:
32+
- name: ALLOW_EMPTY_PASSWORD
33+
value: "yes"
34+
- name: WORDPRESS_HTACCESS_OVERRIDE_NONE
35+
value: "no"
36+
- name: WORDPRESS_HTACCESS_PERSISTENCE_ENABLED
37+
value: "no"
38+
- name: WORDPRESS_SKIP_INSTALL
39+
value: "no"
40+
- name: WORDPRESS_TABLE_PREFIX
41+
value: "wp_"
42+
- name: WORDPRESS_SCHEME
43+
value: "http"
44+
- name: WORDPRESS_EXTRA_WP_CONFIG_CONTENT
45+
value: ""
2546
- name: MARIADB_HOST
2647
valueFrom:
2748
secretKeyRef:
@@ -79,9 +100,9 @@ spec:
79100
value: {{ default "" .Values.smtpProtocol | quote }}
80101
ports:
81102
- name: http
82-
containerPort: 80
103+
containerPort: 8080
83104
- name: https
84-
containerPort: 443
105+
containerPort: 8443
85106
livenessProbe:
86107
httpGet:
87108
path: /wp-login.php
@@ -103,25 +124,14 @@ spec:
103124
{{- end }}
104125
{{ toYaml .Values.readinessProbe | indent 10 }}
105126
volumeMounts:
106-
- mountPath: /bitnami/apache
107-
name: wordpress-data
108-
subPath: apache
109127
- mountPath: /bitnami/wordpress
110128
name: wordpress-data
111129
subPath: wordpress
112-
- mountPath: /bitnami/php
113-
name: wordpress-data
114-
subPath: php
115130
resources:
116131
{{ toYaml .Values.resources | indent 10 }}
117132
volumes:
118133
- name: wordpress-data
119-
{{- if .Values.persistence.enabled }}
120-
persistentVolumeClaim:
121-
claimName: {{ template "fullname" . }}
122-
{{- else }}
123134
emptyDir: {}
124-
{{ end }}
125135
{{- if .Values.nodeSelector }}
126136
nodeSelector:
127137
{{ toYaml .Values.nodeSelector | indent 8 }}

charts/wordpress/templates/mysql-instance.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
release: "{{ .Release.Name }}"
99
heritage: "{{ .Release.Service }}"
1010
spec:
11-
clusterServiceClassExternalName: mysql
11+
clusterServiceClassExternalName: {{ .Values.externalDatabase.minibroker.class }}
1212
clusterServicePlanExternalName: {{ .Values.externalDatabase.minibroker.servicePlan }}
1313
{{- if .Values.externalDatabase.minibroker.parameters }}
1414
parameters: {{ toJson .Values.externalDatabase.minibroker.parameters }}

charts/wordpress/templates/pvc.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

charts/wordpress/values.yaml

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Bitnami WordPress image version
22
## ref: https://hub.docker.com/r/bitnami/wordpress/tags/
33
##
4-
image: bitnami/wordpress:4.9.4-r0
4+
image: bitnami/wordpress:5.5.1
55

66
## Specify a imagePullPolicy
77
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
@@ -51,32 +51,15 @@ wordpressBlogName: User's Blog!
5151

5252
externalDatabase:
5353
minibroker:
54-
## The plan to request from Minibroker, use svcat get plans --class mysql to see your options
55-
servicePlan: 5-7-30
54+
class: mariadb
55+
## The plan to request from Minibroker, use svcat get plans --class mariadb to see your options.
56+
servicePlan: 10-3-22
5657
parameters:
57-
mysqlDatabase: bitnami_wordpress
58-
mysqlUser: bn_wordpress
59-
placeholder: yarrr
60-
61-
##
62-
## MariaDB chart configuration
63-
##
64-
mariadb:
65-
## Enable persistence using Persistent Volume Claims
66-
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
67-
##
68-
persistence:
69-
enabled: true
70-
## mariadb data Persistent Volume Storage Class
71-
## If defined, storageClassName: <storageClass>
72-
## If set to "-", storageClassName: "", which disables dynamic provisioning
73-
## If undefined (the default) or set to null, no storageClassName spec is
74-
## set, choosing the default provisioner. (gp2 on AWS, standard on
75-
## GKE, AWS & OpenStack)
76-
##
77-
# storageClass: "-"
78-
accessMode: ReadWriteOnce
79-
size: 8Gi
58+
db:
59+
name: bitnami_wordpress
60+
user: bn_wordpress
61+
replication:
62+
enabled: false
8063

8164
## Kubernetes configuration
8265
## For minikube, set this to NodePort, elsewhere use LoadBalancer
@@ -147,22 +130,6 @@ ingress:
147130
# key:
148131
# certificate:
149132

150-
## Enable persistence using Persistent Volume Claims
151-
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
152-
##
153-
persistence:
154-
enabled: true
155-
## wordpress data Persistent Volume Storage Class
156-
## If defined, storageClassName: <storageClass>
157-
## If set to "-", storageClassName: "", which disables dynamic provisioning
158-
## If undefined (the default) or set to null, no storageClassName spec is
159-
## set, choosing the default provisioner. (gp2 on AWS, standard on
160-
## GKE, AWS & OpenStack)
161-
##
162-
# storageClass: "-"
163-
accessMode: ReadWriteOnce
164-
size: 10Gi
165-
166133
## Configure resource requests and limits
167134
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
168135
##

ci/test_integration.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ timeout 1m kubectl create namespace minibroker-tests
2121
timeout 10m make image
2222
timeout 1m make charts
2323
timeout 3m make deploy
24-
timeout 8m make test-integration
24+
timeout 15m make test-integration

cmd/minibroker/main.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"syscall"
2828

2929
"github.com/kubernetes-sigs/minibroker/pkg/broker"
30+
"github.com/kubernetes-sigs/minibroker/pkg/kubernetes"
3031
"github.com/pmorie/osb-broker-lib/pkg/metrics"
3132
prom "github.com/prometheus/client_golang/prometheus"
3233
klog "k8s.io/klog/v2"
@@ -65,6 +66,8 @@ func main() {
6566
"The default namespace for brokers when the request doesn't specify")
6667
flag.StringVar(&options.ProvisioningSettingsPath, "provisioningSettings", "",
6768
"The path to the YAML file where the optional provisioning settings are stored")
69+
flag.StringVar(&options.ClusterDomain, "clusterDomain", "",
70+
"The k8s cluster domain - if not set, Minibroker infers from /etc/resolv.conf")
6871
flag.Parse()
6972

7073
klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
@@ -79,6 +82,22 @@ func main() {
7982
})
8083
defer klog.Flush()
8184

85+
if options.ClusterDomain == "" {
86+
resolvConf, err := os.Open("/etc/resolv.conf")
87+
if err != nil {
88+
klog.Fatalln(err)
89+
}
90+
// An assurance for the future-proof copy-paste of this block! Yes, this
91+
// is not necessary here but shall be if other events happen in the
92+
// future.
93+
defer resolvConf.Close()
94+
95+
if options.ClusterDomain, err = kubernetes.ClusterDomain(resolvConf); err != nil {
96+
klog.Fatalln(err)
97+
}
98+
resolvConf.Close()
99+
}
100+
82101
if err := run(); err != nil && err != context.Canceled && err != context.DeadlineExceeded {
83102
klog.Fatalln(err)
84103
}

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ go 1.13
44

55
require (
66
github.com/Masterminds/semver v1.4.0
7+
github.com/containers/libpod v1.9.3
78
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
89
github.com/golang/mock v1.2.0
910
github.com/golang/protobuf v1.4.1 // indirect
10-
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
1111
github.com/onsi/ginkgo v1.12.0
1212
github.com/onsi/gomega v1.10.0
1313
github.com/pkg/errors v0.9.1
1414
github.com/pmorie/go-open-service-broker-client v0.0.0-20180304212357-e8aa16c90363
1515
github.com/pmorie/osb-broker-lib v0.0.0-20180516212803-87d71cfbf342
1616
github.com/prometheus/client_golang v1.6.0
17-
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
1817
gopkg.in/yaml.v2 v2.3.0 // indirect
1918
helm.sh/helm/v3 v3.2.3
2019
k8s.io/api v0.18.0

0 commit comments

Comments
 (0)