Last active
October 16, 2024 14:48
-
-
Save carlosedp/703bf3cae3715ac0fb677499550be295 to your computer and use it in GitHub Desktop.
Min.io OpenShift template
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
# To create a Minio deployment using Docker/Podman, use: | |
# mkdir -p ~/minio/data | |
# | |
# podman run \ | |
# -p 9000:9000 \ | |
# -p 9001:9001 \ | |
# -v ~/minio/data:/data \ | |
# -e "MINIO_ROOT_USER=root" \ | |
# -e "MINIO_ROOT_PASSWORD=mysecret" \ | |
# quay.io/minio/minio server /data --console-address ":9001" | |
# | |
# To create a new Minio instance on OpenShift, save this file and use the following command: | |
# | |
# oc new-project minio | |
# oc new-app --namespace=minio -f minio-template.yaml -p MINIO_ROOT_USER=root -p MINIO_ROOT_PASSWORD=mysecret -p APPLICATION_DOMAIN=minio.$(oc get ingresses.config/cluster -o jsonpath={.spec.domain}) -p PV_SIZE=20Gi | |
# | |
# To interact with this Minio deployment, you can use the aws cli tool which can be downloaded with | |
# brew install awscli / apt-get install awscli / yum install awscli | |
# | |
# On your client or application which needs to interact with the Minio deployment, use the IP | |
# address or route of the API service, the access key and secret key provided in the template, | |
# and the port 9000. If asked for a region, use us-east-1. | |
# | |
# To configure the awscli tool, run the commands (replacing endpoint with IP or route): | |
# | |
# Get Minio API service route: | |
# oc get route minio-api -o jsonpath={.spec.host} | |
# | |
# aws configure | |
# aws configure set default.endpoint_url https://localhost:9000 | |
# | |
# To list the buckets, you can use the following command: | |
# aws s3 ls | |
# | |
# To create a new bucket, you can use the following command: | |
# aws s3 mb s3://mybucket | |
# | |
# To put a file (upload) in the bucket, you can use the following command: | |
# aws s3 cp myfile s3://mybucket | |
# | |
############################################################################################ | |
apiVersion: template.openshift.io/v1 | |
kind: Template | |
labels: | |
app: minio | |
template: minio | |
message: |- | |
The following service(s) have been created in your project: ${NAME}. | |
Get latest version of this template at: https://gist.github.com/carlosedp/703bf3cae3715ac0fb677499550be295 | |
metadata: | |
annotations: | |
description: |- | |
Get latest version of this template at: https://gist.github.com/carlosedp/703bf3cae3715ac0fb677499550be295 | |
WARNING: This template needs a default storage class with enough space. | |
iconClass: icon-database | |
openshift.io/display-name: min.io | |
openshift.io/documentation-url: https://gist.github.com/carlosedp/703bf3cae3715ac0fb677499550be295 | |
openshift.io/long-description: | |
This template defines resources needed to deploy | |
a min.io service that allows you to use a AWS S3 compatible api in your apps. | |
tags: minio,min.io,s3 | |
template.openshift.io/bindable: "false" | |
name: minio | |
objects: | |
- apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: ${NAME}-keys | |
namespace: ${NAMESPACE} | |
stringData: | |
access-key: ${MINIO_ROOT_USER} | |
secret-key: ${MINIO_ROOT_PASSWORD} | |
- apiVersion: v1 | |
kind: Service | |
metadata: | |
annotations: | |
description: Exposes the application pod API | |
service.alpha.openshift.io/dependencies: '[{"name": "${MINIO_SERVICE_NAME}", "kind": "Service"}]' | |
name: ${NAME}-api | |
namespace: ${NAMESPACE} | |
spec: | |
ports: | |
- name: ${NAME} | |
port: 9000 | |
targetPort: 9000 | |
selector: | |
app: ${NAME} | |
- apiVersion: v1 | |
kind: Service | |
metadata: | |
annotations: | |
description: Exposes the application pod Console | |
service.alpha.openshift.io/dependencies: '[{"name": "${MINIO_SERVICE_NAME}", "kind": "Service"}]' | |
name: ${NAME}-console | |
namespace: ${NAMESPACE} | |
spec: | |
ports: | |
- name: ${NAME} | |
port: 9001 | |
targetPort: 9001 | |
selector: | |
app: ${NAME} | |
- apiVersion: v1 | |
kind: Route | |
metadata: | |
name: ${NAME}-api | |
namespace: ${NAMESPACE} | |
spec: | |
host: api-${APPLICATION_DOMAIN} | |
to: | |
kind: Service | |
name: ${NAME}-api | |
tls: | |
termination: edge | |
insecureEdgeTerminationPolicy: Redirect | |
- apiVersion: v1 | |
kind: Route | |
metadata: | |
name: ${NAME}-console | |
namespace: ${NAMESPACE} | |
spec: | |
host: console-${APPLICATION_DOMAIN} | |
to: | |
kind: Service | |
name: ${NAME}-console | |
tls: | |
termination: edge | |
insecureEdgeTerminationPolicy: Redirect | |
- apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
labels: | |
app: ${NAME} | |
name: ${NAME} | |
namespace: ${NAMESPACE} | |
spec: | |
podManagementPolicy: OrderedReady | |
replicas: 1 | |
revisionHistoryLimit: 1 | |
selector: | |
matchLabels: | |
app: ${NAME} | |
serviceName: ${NAME} | |
template: | |
metadata: | |
creationTimestamp: null | |
labels: | |
app: ${NAME} | |
spec: | |
containers: | |
- args: | |
- server | |
- /data | |
env: | |
- name: MINIO_ROOT_USER | |
valueFrom: | |
secretKeyRef: | |
key: access-key | |
name: ${NAME}-keys | |
- name: MINIO_ROOT_PASSWORD | |
valueFrom: | |
secretKeyRef: | |
key: secret-key | |
name: ${NAME}-keys | |
- name: MINIO_BROWSER_REDIRECT_URL | |
value: https://console-${APPLICATION_DOMAIN} | |
- name: MINIO_SERVER_URL | |
value: https://api-${APPLICATION_DOMAIN} | |
- name: MINIO_CONSOLE_ADDRESS | |
value: ":9001" | |
image: minio/minio:latest | |
imagePullPolicy: IfNotPresent | |
name: ${NAME} | |
ports: | |
- containerPort: 9000 | |
protocol: TCP | |
resources: | |
limits: | |
cpu: 200m | |
memory: ${MEMORY_LIMIT} | |
terminationMessagePath: /dev/termination-log | |
terminationMessagePolicy: File | |
volumeMounts: | |
- mountPath: /data | |
name: data | |
dnsPolicy: ClusterFirst | |
restartPolicy: Always | |
schedulerName: default-scheduler | |
securityContext: {} | |
terminationGracePeriodSeconds: 30 | |
updateStrategy: | |
type: OnDelete | |
volumeClaimTemplates: | |
- metadata: | |
name: data | |
spec: | |
# storageClassName: "thin" # uncomment this line to use an existing storage class otherwise, default will be used | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: ${PV_SIZE} | |
parameters: | |
- description: The name assigned to all of the frontend objects defined in this template. | |
displayName: Name | |
name: NAME | |
required: true | |
value: minio | |
- description: The project used for the application. | |
displayName: Namespace | |
name: NAMESPACE | |
required: true | |
value: minio | |
- description: Maximum amount of memory the container can use. | |
displayName: Memory Limit | |
name: MEMORY_LIMIT | |
required: true | |
value: 512Mi | |
- description: Persistent volume storage size. | |
displayName: Storage size | |
name: PV_SIZE | |
required: true | |
value: 20Gi | |
- description: | |
The exposed hostname that will route to the Min.io service, if left | |
blank a value will be defaulted. | |
displayName: Application Hostname | |
name: APPLICATION_DOMAIN | |
- description: Root user for min.io api. | |
displayName: Root user | |
from: "[a-zA-Z0-9]{32}" | |
generate: expression | |
name: MINIO_ROOT_USER | |
- description: Root password for min.io api. | |
displayName: Root password | |
from: "[a-zA-Z0-9]{32}" | |
generate: expression | |
name: MINIO_ROOT_PASSWORD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment