forked from zilliztech/milvus-helm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: quicksilver <zhifeng.zhang@zilliz.com>
- Loading branch information
1 parent
d8587dc
commit ccc2673
Showing
29 changed files
with
2,205 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
# OWNERS file for Kubernetes | ||
OWNERS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v1 | ||
description: High Performance, Kubernetes Native Object Storage | ||
name: minio | ||
version: 8.0.10 | ||
appVersion: master | ||
keywords: | ||
- storage | ||
- object-storage | ||
- S3 | ||
home: https://min.io | ||
icon: https://min.io/resources/img/logo/MINIO_wordmark.png | ||
sources: | ||
- https://github.com/minio/minio | ||
maintainers: | ||
- name: jeffoverflow | ||
email: dev@minio.io |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{{- if eq .Values.service.type "ClusterIP" "NodePort" }} | ||
Minio can be accessed via port {{ .Values.service.port }} on the following DNS name from within your cluster: | ||
{{ template "minio.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local | ||
|
||
To access Minio from localhost, run the below commands: | ||
|
||
1. export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
|
||
2. kubectl port-forward $POD_NAME 9000 --namespace {{ .Release.Namespace }} | ||
|
||
Read more about port forwarding here: http://kubernetes.io/docs/user-guide/kubectl/kubectl_port-forward/ | ||
|
||
You can now access Minio server on http://localhost:9000. Follow the below steps to connect to Minio server with mc client: | ||
|
||
1. Download the Minio mc client - https://docs.minio.io/docs/minio-client-quickstart-guide | ||
|
||
2. Get the ACCESS_KEY=$(kubectl get secret {{ template "minio.secretName" . }} -o jsonpath="{.data.accesskey}" | base64 --decode) and the SECRET_KEY=$(kubectl get secret {{ template "minio.secretName" . }} -o jsonpath="{.data.secretkey}" | base64 --decode) | ||
|
||
3. mc alias set {{ template "minio.fullname" . }}-local http://localhost:{{ .Values.service.port }} "$ACCESS_KEY" "$SECRET_KEY" --api s3v4 | ||
|
||
4. mc ls {{ template "minio.fullname" . }}-local | ||
|
||
Alternately, you can use your browser or the Minio SDK to access the server - https://docs.minio.io/categories/17 | ||
{{- end }} | ||
{{- if eq .Values.service.type "LoadBalancer" }} | ||
Minio can be accessed via port {{ .Values.service.port }} on an external IP address. Get the service external IP address by: | ||
kubectl get svc --namespace {{ .Release.Namespace }} -l app={{ template "minio.fullname" . }} | ||
|
||
Note that the public IP may take a couple of minutes to be available. | ||
|
||
You can now access Minio server on http://<External-IP>:9000. Follow the below steps to connect to Minio server with mc client: | ||
|
||
1. Download the Minio mc client - https://docs.minio.io/docs/minio-client-quickstart-guide | ||
|
||
2. Get the ACCESS_KEY=$(kubectl get secret {{ template "minio.secretName" . }} --namespace {{ .Release.Namespace }} -o jsonpath="{.data.accesskey}" | base64 --decode) and the SECRET_KEY=$(kubectl get secret {{ template "minio.secretName" . }} --namespace {{ .Release.Namespace }} -o jsonpath="{.data.secretkey}" | base64 --decode) | ||
3. mc alias set {{ template "minio.fullname" . }} http://<External-IP>:{{ .Values.service.port }} "$ACCESS_KEY" "$SECRET_KEY" --api s3v4 | ||
|
||
4. mc ls {{ template "minio.fullname" . }} | ||
|
||
Alternately, you can use your browser or the Minio SDK to access the server - https://docs.minio.io/categories/17 | ||
{{- end }} | ||
|
||
{{ if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }} | ||
Note: Since NetworkPolicy is enabled, only pods with label | ||
{{ template "minio.fullname" . }}-client=true" | ||
will be able to connect to this minio cluster. | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#!/bin/sh | ||
set -e ; # Have script exit in the event of a failed command. | ||
|
||
{{- if .Values.configPathmc }} | ||
MC_CONFIG_DIR="{{ .Values.configPathmc }}" | ||
MC="/usr/bin/mc --insecure --config-dir ${MC_CONFIG_DIR}" | ||
{{- else }} | ||
MC="/usr/bin/mc --insecure" | ||
{{- end }} | ||
|
||
# connectToMinio | ||
# Use a check-sleep-check loop to wait for Minio service to be available | ||
connectToMinio() { | ||
SCHEME=$1 | ||
ATTEMPTS=0 ; LIMIT=29 ; # Allow 30 attempts | ||
set -e ; # fail if we can't read the keys. | ||
ACCESS=$(cat /config/accesskey) ; SECRET=$(cat /config/secretkey) ; | ||
set +e ; # The connections to minio are allowed to fail. | ||
echo "Connecting to Minio server: $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT" ; | ||
MC_COMMAND="${MC} config host add myminio $SCHEME://$MINIO_ENDPOINT:$MINIO_PORT $ACCESS $SECRET" ; | ||
$MC_COMMAND ; | ||
STATUS=$? ; | ||
until [ $STATUS = 0 ] | ||
do | ||
ATTEMPTS=`expr $ATTEMPTS + 1` ; | ||
echo \"Failed attempts: $ATTEMPTS\" ; | ||
if [ $ATTEMPTS -gt $LIMIT ]; then | ||
exit 1 ; | ||
fi ; | ||
sleep 2 ; # 1 second intervals between attempts | ||
$MC_COMMAND ; | ||
STATUS=$? ; | ||
done ; | ||
set -e ; # reset `e` as active | ||
return 0 | ||
} | ||
|
||
# checkBucketExists ($bucket) | ||
# Check if the bucket exists, by using the exit code of `mc ls` | ||
checkBucketExists() { | ||
BUCKET=$1 | ||
CMD=$(${MC} ls myminio/$BUCKET > /dev/null 2>&1) | ||
return $? | ||
} | ||
|
||
# createBucket ($bucket, $policy, $purge) | ||
# Ensure bucket exists, purging if asked to | ||
createBucket() { | ||
BUCKET=$1 | ||
POLICY=$2 | ||
PURGE=$3 | ||
VERSIONING=$4 | ||
|
||
# Purge the bucket, if set & exists | ||
# Since PURGE is user input, check explicitly for `true` | ||
if [ $PURGE = true ]; then | ||
if checkBucketExists $BUCKET ; then | ||
echo "Purging bucket '$BUCKET'." | ||
set +e ; # don't exit if this fails | ||
${MC} rm -r --force myminio/$BUCKET | ||
set -e ; # reset `e` as active | ||
else | ||
echo "Bucket '$BUCKET' does not exist, skipping purge." | ||
fi | ||
fi | ||
|
||
# Create the bucket if it does not exist | ||
if ! checkBucketExists $BUCKET ; then | ||
echo "Creating bucket '$BUCKET'" | ||
${MC} mb myminio/$BUCKET | ||
else | ||
echo "Bucket '$BUCKET' already exists." | ||
fi | ||
|
||
|
||
# set versioning for bucket | ||
if [ ! -z $VERSIONING ] ; then | ||
if [ $VERSIONING = true ] ; then | ||
echo "Enabling versioning for '$BUCKET'" | ||
${MC} version enable myminio/$BUCKET | ||
elif [ $VERSIONING = false ] ; then | ||
echo "Suspending versioning for '$BUCKET'" | ||
${MC} version suspend myminio/$BUCKET | ||
fi | ||
else | ||
echo "Bucket '$BUCKET' versioning unchanged." | ||
fi | ||
|
||
# At this point, the bucket should exist, skip checking for existence | ||
# Set policy on the bucket | ||
echo "Setting policy of bucket '$BUCKET' to '$POLICY'." | ||
${MC} policy set $POLICY myminio/$BUCKET | ||
} | ||
|
||
# Try connecting to Minio instance | ||
{{- if .Values.tls.enabled }} | ||
scheme=https | ||
{{- else }} | ||
scheme=http | ||
{{- end }} | ||
connectToMinio $scheme | ||
|
||
{{- if or .Values.defaultBucket.enabled }} | ||
# Create the bucket | ||
createBucket {{ .Values.defaultBucket.name }} {{ .Values.defaultBucket.policy }} {{ .Values.defaultBucket.purge }} {{ .Values.defaultBucket.versioning }} | ||
{{ else if .Values.buckets }} | ||
# Create the buckets | ||
{{- range .Values.buckets }} | ||
createBucket {{ .name }} {{ .policy }} {{ .purge }} {{ .versioning }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.