Skip to content

Commit cf97231

Browse files
author
Rodrigo Valin
committed
7cfc74068809d0b0ee4a77c898aada655ba15eb3: update public repo contents
1 parent cae9cea commit cf97231

10 files changed

+232
-7
lines changed

crds.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ spec:
6060
properties:
6161
enabled:
6262
type: boolean
63+
ca:
64+
type: string
6365
additionalMongodConfig:
6466
properties:
6567
net:
@@ -104,6 +106,8 @@ spec:
104106
properties:
105107
enabled:
106108
type: boolean
109+
ca:
110+
type: string
107111
clusterAuthenticationMode:
108112
type: string
109113
enum: ["x509"]
@@ -162,6 +166,8 @@ spec:
162166
properties:
163167
enabled:
164168
type: boolean
169+
ca:
170+
type: string
165171
clusterAuthenticationMode:
166172
type: string
167173
enum: ["x509"]

helm_chart/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: mongodb-enterprise-operator
22
description: MongoDB Kubernetes Enterprise Operator
3-
version: '1.0'
3+
version: '1.1'
44
kubeVersion: '>=1.11'
55
keywords:
66
- mongodb

helm_chart/templates/crds.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ spec:
5858
properties:
5959
enabled:
6060
type: boolean
61+
ca:
62+
type: string
6163
additionalMongodConfig:
6264
properties:
6365
net:
@@ -102,6 +104,8 @@ spec:
102104
properties:
103105
enabled:
104106
type: boolean
107+
ca:
108+
type: string
105109
clusterAuthenticationMode:
106110
type: string
107111
enum: ["x509"]
@@ -160,6 +164,8 @@ spec:
160164
properties:
161165
enabled:
162166
type: boolean
167+
ca:
168+
type: string
163169
clusterAuthenticationMode:
164170
type: string
165171
enum: ["x509"]

helm_chart/templates/operator.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,19 @@ spec:
6262
- name: POD_WAIT_RETRIES
6363
value: {{ quote .Values.operator.podSetWaitRetries }}
6464
{{ end }}
65+
66+
{{ if .Values.debug }}
67+
---
68+
apiVersion: v1
69+
kind: Service
70+
metadata:
71+
name: debug-svc
72+
spec:
73+
type: NodePort
74+
ports:
75+
- nodePort: {{ .Values.debugPort }}
76+
port: 40000
77+
protocol: TCP
78+
selector:
79+
app: {{ .Values.operator.name }}
80+
{{ end }}

helm_chart/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ operator:
1616
name: mongodb-enterprise-operator
1717

1818
# Version of mongodb-enterprise-operator and mongodb-enterprise-database images
19-
version: '1.0'
19+
version: '1.1'
2020

2121
database:
2222
name: mongodb-enterprise-database

mongodb-enterprise.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ spec:
139139

140140
containers:
141141
- name: mongodb-enterprise-operator
142-
image: quay.io/mongodb/mongodb-enterprise-operator:1.0
142+
image: quay.io/mongodb/mongodb-enterprise-operator:1.1
143143
imagePullPolicy: Always
144144

145145
env:
@@ -153,9 +153,11 @@ spec:
153153

154154

155155
- name: MONGODB_ENTERPRISE_DATABASE_IMAGE
156-
value: quay.io/mongodb/mongodb-enterprise-database:1.0
156+
value: quay.io/mongodb/mongodb-enterprise-database:1.1
157157
- name: IMAGE_PULL_POLICY
158158
value: Always
159159

160160

161161

162+
163+

samples/extended/replica-set-persistent-volumes.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ spec:
1111
# Indicates featureCompatibilityVersion. This attribute will make the data
1212
# format to persist in a particular version, maybe older, allowing for
1313
# future downgrades if necessary.
14-
featureCompatibilityVersion: 3.6
14+
featureCompatibilityVersion: "3.6"
1515

1616
## Please Note: The default Kubernetes cluster name is `cluster.local`.
1717
## If your cluster has been configured with another name, you can specify

samples/extended/sharded-cluster-persistent-volumes.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
# Indicates featureCompatibilityVersion. This attribute will make the data
1515
# format to persist in a particular version, maybe older, allowing for
1616
# future downgrades if necessary.
17-
featureCompatibilityVersion: 3.6
17+
featureCompatibilityVersion: "3.6"
1818

1919
## Please Note: The default Kubernetes cluster name is `cluster.local`.
2020
## If your cluster has been configured with another name, you can specify

samples/extended/standalone-persistent-volumes.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
# Indicates featureCompatibilityVersion. This attribute will make the data
1111
# format to persist in a particular version, maybe older, allowing for
1212
# future downgrades if necessary.
13-
featureCompatibilityVersion: 4.0
13+
featureCompatibilityVersion: "4.0"
1414

1515
## Please Note: The default Kubernetes cluster name is `cluster.local`.
1616
## If your cluster has been configured with another name, you can specify
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# mdb_operator_diagnostic_data.sh
5+
#
6+
# Use this script to gather data about your MongoDB Enterprise Kubernetes Operator
7+
# and the MongoDB Resources deployed with it.
8+
#
9+
10+
#
11+
# shellcheck disable=SC2119
12+
# shellcheck disable=SC2039
13+
#
14+
15+
usage() {
16+
local script_name
17+
script_name=$(basename "${0}")
18+
echo "Usage:"
19+
echo "${script_name} <namespace> <mdb_resource_name> [<operator_name>] [--private]"
20+
}
21+
22+
contains() {
23+
local e match=$1
24+
shift
25+
for e; do [[ "$e" == "$match" ]] && return 0; done
26+
return 1
27+
}
28+
29+
if [ -z "${2}" ]; then
30+
usage
31+
exit 1
32+
fi
33+
34+
namespace="${1}"
35+
mdb_resource="${2}"
36+
operator_name="${3:-mongodb-enterprise-operator}"
37+
current_date="$(date +%Y-%m-%d_%H_%M)"
38+
39+
contains "--private" "$@"
40+
private_mode=$?
41+
42+
log_dir="logs_${current_date}"
43+
mkdir -p "${log_dir}" &> /dev/null
44+
45+
46+
if ! kubectl get "namespace/${namespace}" &> /dev/null; then
47+
echo "Error fetching namespace. Make sure name ${namespace} for Namespace is correct."
48+
exit 1
49+
fi
50+
51+
if ! kubectl -n "${namespace}" get "mdb/${mdb_resource}" &> /dev/null; then
52+
echo "Error fetching the MongoDB resource. Make sure the ${mdb_resource} is correct."
53+
exit 1
54+
fi
55+
56+
if ! kubectl -n "${namespace}" get "deployment/${operator_name}" &> /dev/null; then
57+
echo "Error fetching the MongoDB Operator Deployment. Make sure the deployment/${operator_name} exist and it is running."
58+
exit 1
59+
fi
60+
61+
if [ ${private_mode} == 0 ]; then
62+
echo "+ Running on private mode. Make sure you don't share the results of this run outside your organization."
63+
fi
64+
65+
echo "++ Versions"
66+
mdb_operator_pod=$(kubectl -n "${namespace}" get pods -l "app=${operator_name}" -o name | cut -d'/' -f 2)
67+
echo "+ Operator Pod: pod/${mdb_operator_pod}"
68+
69+
mdb_operator_filename="operator.yaml"
70+
echo "+ Saving Operator Deployment into ${mdb_operator_filename}"
71+
kubectl -n "${namespace}" get "deployment/${operator_name}" -o yaml > "${log_dir}/${mdb_operator_filename}"
72+
73+
echo "+ Kubernetes Version Reported by kubectl"
74+
kubectl version
75+
76+
if type oc &> /dev/null; then
77+
echo "+ Kubernetes Version Reported by oc"
78+
oc version
79+
fi
80+
81+
operator_logs_filename="${operator_name}_${current_date}.logs"
82+
echo "+ Saving Operator logs to file ${operator_logs_filename}"
83+
kubectl -n "${namespace}" logs "deployment/${operator_name}" > "${log_dir}/${operator_logs_filename}"
84+
85+
database_container_pretty_name=$(kubectl -n "${namespace}" exec -it "${mdb_resource}-0" -- cat /etc/*release | grep "PRETTY_NAME" | cut -d'=' -f 2)
86+
operator_container_pretty_name=$(kubectl -n "${namespace}" exec -it "${mdb_operator_pod}" -- cat /etc/*release | grep "PRETTY_NAME" | cut -d'=' -f 2)
87+
echo "+ Operator is running on: ${operator_container_pretty_name}"
88+
echo "+ Database is running on: ${database_container_pretty_name}"
89+
90+
echo "++ Kubernetes Cluster Ecosystem"
91+
echo "+ Kubectl Cluster Information"
92+
kubectl cluster-info
93+
94+
if [ ${private_mode} == 0 ]; then
95+
kubectl_cluster_info_filename="kubectl_cluster_info_${current_date}.logs"
96+
echo "+ Saving Cluster Info to file ${kubectl_cluster_info_filename} (this might take a few minutes)"
97+
kubectl cluster-info dump | gzip > "${log_dir}/${kubectl_cluster_info_filename}.gz"
98+
else
99+
echo "= Skipping Kubectl cluster information dump, use --private to enable."
100+
fi
101+
102+
kubectl_sc_dump_filename="kubectl_storage_class_${current_date}.yaml"
103+
kubectl get storageclass -o yaml > "${log_dir}/${kubectl_sc_dump_filename}"
104+
105+
nodes_filename="nodes.yaml"
106+
echo "+ Nodes"
107+
kubectl get nodes
108+
109+
echo "+ Saving Nodes full state to ${nodes_filename}"
110+
kubectl get nodes -o yaml > "${log_dir}/${nodes_filename}"
111+
112+
echo "++ MongoDB Resource Running Environment"
113+
crd_filename="crd_mdb.yaml"
114+
echo "+ Saving MDB Customer Resource Definition into ${crd_filename}"
115+
kubectl -n "${namespace}" get crd/mongodb.mongodb.com -o yaml > "${crd_filename}"
116+
117+
project_filename="project.yaml"
118+
mdb_resource_name="mdb/${mdb_resource}"
119+
project_name=$(kubectl -n "${namespace}" get "${mdb_resource_name}" -o jsonpath='{.spec.project}')
120+
credentials_name=$(kubectl -n "${namespace}" get "${mdb_resource_name}" -o jsonpath='{.spec.credentials}')
121+
122+
resource_filename="mdb_object_${mdb_resource}.yaml"
123+
echo "+ MongoDB Resource Status"
124+
kubectl -n "${namespace}" get "${mdb_resource_name}" -o yaml > "${log_dir}/${resource_filename}"
125+
126+
echo "+ Saving Project YAML file to ${project_filename}"
127+
kubectl -n "${namespace}" get "configmap/${project_name}" -o yaml > "${log_dir}/${project_filename}"
128+
129+
credentials_user=$(kubectl -n "${namespace}" get "secret/${credentials_name}" -o jsonpath='{.data.user}' | base64 --decode)
130+
echo "+ User configured is (credentials.user): ${credentials_user}"
131+
132+
echo "= To get the Secret Public API Key use: kubectl -n ${namespace} get secret/${credentials_name} -o jsonpath='{.data.publicApiKey}' | base64 --decode)"
133+
134+
statefulset_filename="statefulset.yaml"
135+
echo "+ Saving StatefulSet state to ${statefulset_filename}"
136+
kubectl -n "${namespace}" get "sts/${mdb_resource}" -o yaml > "${log_dir}/${statefulset_filename}"
137+
138+
echo "+ Deployment Pods"
139+
kubectl -n "${namespace}" get pods | grep -E "^${mdb_resource}-[0-9]+"
140+
141+
echo "+ Saving Pods state to ${mdb_resource}-N.logs"
142+
pods_in_namespace=$(kubectl -n "${namespace}" get pods -o name | cut -d'/' -f 2 | grep -E "^${mdb_resource}-[0-9]+")
143+
for pod in ${pods_in_namespace}; do
144+
kubectl -n "${namespace}" logs "${pod}" > "${log_dir}/${pod}.log"
145+
kubectl -n "${namespace}" get event --field-selector "involvedObject.name=${pod}" > "${log_dir}/${pod}_events.log"
146+
done
147+
148+
echo "+ Persistent Volumes"
149+
kubectl -n "${namespace}" get pv
150+
151+
echo "+ Persistent Volume Claims"
152+
kubectl -n "${namespace}" get pvc
153+
154+
pv_filename="persistent_volumes.yaml"
155+
echo "+ Saving Persistent Volumes state to ${pv_filename}"
156+
kubectl -n "${namespace}" get pv -o yaml > "${log_dir}/${pv_filename}"
157+
158+
pvc_filename="persistent_volume_claims.yaml"
159+
echo "+ Saving Persistent Volumes Claims state to ${pvc_filename}"
160+
kubectl -n "${namespace}" get pvc -o yaml > "${log_dir}/${pvc_filename}"
161+
162+
services_filename="services.yaml"
163+
echo "+ Services"
164+
kubectl -n "${namespace}" get services
165+
166+
echo "+ Saving Services state to ${services_filename}"
167+
kubectl -n "${namespace}" get services -o yaml > "${log_dir}/${services_filename}"
168+
169+
echo "+ Saving Events for the Namespace"
170+
kubectl -n "${namespace}" get events > "${log_dir}/events.log"
171+
172+
echo "+ Certificates (no private keys are captured)"
173+
csr_filename="csr.text"
174+
kubectl get csr | grep "${namespace}"
175+
echo "+ Saving Certificate state into ${csr_filename}"
176+
kubectl describe "$(kubectl get csr -o name | grep ${namespace})"
177+
178+
echo "++ MongoDBUser Resource Status"
179+
mdbusers_filename="mdbu.yaml"
180+
kubectl -n "${namespace}" get mdbu
181+
echo "+ Saving MongoDBUsers to ${mdbusers_filename}"
182+
kubectl -n "${namespace}" get mdbu > "${log_dir}/${mdbusers_filename}"
183+
184+
crdu_filename="crd_mdbu.yaml"
185+
echo "+ Saving MongoDBUser Customer Resource Definition into ${crdu_filename}"
186+
kubectl -n "${namespace}" get crd/mongodbusers.mongodb.com -o yaml > "${log_dir}/${crdu_filename}"
187+
188+
189+
echo "++ Compressing files"
190+
compressed_logs_filename="${namespace}__${mdb_resource}__${current_date}.tar.gz"
191+
tar -czf "${compressed_logs_filename}" -C "${log_dir}" .
192+
193+
echo "- All logs have been captured and compressed into the file ${compressed_logs_filename}."
194+
echo "- If support is needed, please attach this file to an email to provide you with a better support experience."
195+
echo "- If there are additional logs that your organization is capturing, they should be made available in case of a support request."

0 commit comments

Comments
 (0)