-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PLNSRVCE-769: Add minio tenant for tekton results #443
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- minio.yaml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: minio-operator | ||
namespace: openshift-operators | ||
spec: | ||
channel: stable | ||
installPlanApproval: Automatic | ||
name: minio-operator | ||
source: certified-operators | ||
sourceNamespace: openshift-marketplace |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- namespace.yaml | ||
- tenant.yaml | ||
- tenant-permissions.yaml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: minio | ||
namespace: tekton-results | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: minio | ||
namespace: tekton-results | ||
rules: | ||
- apiGroups: | ||
- security.openshift.io | ||
resourceNames: | ||
- nonroot | ||
resources: | ||
- securitycontextconstraints | ||
verbs: | ||
- use | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: minio | ||
namespace: tekton-results | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: minio | ||
subjects: | ||
- kind: ServiceAccount | ||
name: minio | ||
namespace: tekton-results |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
apiVersion: minio.min.io/v2 | ||
kind: Tenant | ||
metadata: | ||
name: storage | ||
namespace: tekton-results | ||
Comment on lines
+3
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it make more sense to make the |
||
labels: | ||
app: minio | ||
annotations: | ||
prometheus.io/path: /minio/v2/metrics/cluster | ||
prometheus.io/port: "9000" | ||
prometheus.io/scrape: "true" | ||
spec: | ||
exposeServices: | ||
console: true | ||
minio: true | ||
features: | ||
bucketDNS: false | ||
domains: {} | ||
# This desired part doesn't work. Issues: | ||
# https://github.com/minio/operator/issues/1345 | ||
# https://github.com/minio/operator/issues/1346 | ||
# users: | ||
# - name: storage-user | ||
# buckets: | ||
# - name: "tekton-results" | ||
# region: "us-east-1" | ||
# objectLock: true | ||
certConfig: {} | ||
podManagementPolicy: Parallel | ||
configuration: | ||
name: minio-storage-configuration | ||
env: [] | ||
serviceMetadata: | ||
minioServiceLabels: {} | ||
minioServiceAnnotations: {} | ||
consoleServiceLabels: {} | ||
consoleServiceAnnotations: {} | ||
priorityClassName: "" | ||
externalCaCertSecret: [] | ||
externalCertSecret: [] | ||
externalClientCertSecrets: [] | ||
image: quay.io/minio/minio:RELEASE.2022-09-17T00-09-45Z | ||
imagePullSecret: {} | ||
mountPath: /export | ||
subPath: "" | ||
serviceAccountName: "minio" | ||
pools: | ||
- servers: 1 | ||
name: pool-0 | ||
volumesPerServer: 2 | ||
nodeSelector: {} | ||
tolerations: [] | ||
affinity: | ||
nodeAffinity: {} | ||
podAffinity: {} | ||
podAntiAffinity: {} | ||
resources: {} | ||
volumeClaimTemplate: | ||
apiVersion: v1 | ||
kind: persistentvolumeclaims | ||
metadata: {} | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
status: {} | ||
securityContext: {} | ||
requestAutoCert: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: minio-storage-configuration | ||
namespace: tekton-results | ||
type: Opaque | ||
stringData: | ||
config.env: |- | ||
export MINIO_ROOT_USER=user | ||
export MINIO_ROOT_PASSWORD=password | ||
export MINIO_STORAGE_CLASS_STANDARD="EC:2" | ||
export MINIO_BROWSER="on" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: tekton-results |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,11 @@ init() { | |
TEKTON_RESULTS_DATABASE_USER=${TEKTON_RESULTS_DATABASE_USER:="tekton"} | ||
TEKTON_RESULTS_DATABASE_PASSWORD=${TEKTON_RESULTS_DATABASE_PASSWORD:=$(openssl rand -base64 20)} | ||
|
||
TEKTON_RESULTS_MINIO_USER=${TEKTON_RESULTS_MINIO_USER:="minio"} | ||
export TEKTON_RESULTS_MINIO_USER | ||
TEKTON_RESULTS_MINIO_PASSWORD=${TEKTON_RESULTS_MINIO_PASSWORD:=$(openssl rand -base64 20)} | ||
export TEKTON_RESULTS_MINIO_PASSWORD | ||
|
||
detect_container_engine | ||
} | ||
|
||
|
@@ -174,6 +179,7 @@ tekton_results_manifest(){ | |
results_kustomize="$manifests_dir/compute/tekton-results/kustomization.yaml" | ||
results_namespace="$manifests_dir/compute/tekton-results/namespace.yaml" | ||
results_secret="$manifests_dir/compute/tekton-results/tekton-results-secret.yaml" | ||
results_minio_secret="$manifests_dir/compute/tekton-results/tekton-results-minio-secret.yaml" | ||
if [ ! -e "$results_kustomize" ]; then | ||
results_dir="$(dirname "$results_kustomize")" | ||
mkdir -p "$results_dir" | ||
|
@@ -184,10 +190,31 @@ tekton_results_manifest(){ | |
exit 1 | ||
fi | ||
|
||
if [[ -z $TEKTON_RESULTS_MINIO_USER || -z $TEKTON_RESULTS_MINIO_PASSWORD ]]; then | ||
printf "[ERROR] Tekton results log variable is not set, either set the variables using \n \ | ||
the config.yaml under tekton_results_log \n \ | ||
Or create '%s' \n" "$results_secret" >&2 | ||
exit 1 | ||
fi | ||
|
||
kubectl create namespace tekton-results --dry-run=client -o yaml > "$results_namespace" | ||
kubectl create secret generic -n tekton-results tekton-results-database --from-literal=DATABASE_USER="$TEKTON_RESULTS_DATABASE_USER" --from-literal=DATABASE_PASSWORD="$TEKTON_RESULTS_DATABASE_PASSWORD" --dry-run=client -o yaml > "$results_secret" | ||
|
||
yq e -n '.resources += ["namespace.yaml", "tekton-results-secret.yaml"]' > "$results_kustomize" | ||
echo "--- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We avoid inlining yaml files as it prevents linting. Have a template that you modify on the fly, preferably using |
||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: minio-storage-configuration | ||
namespace: tekton-results | ||
type: Opaque | ||
stringData: | ||
config.env: |- | ||
export MINIO_ROOT_USER=\"$TEKTON_RESULTS_MINIO_USER\" | ||
export MINIO_ROOT_PASSWORD=\"$TEKTON_RESULTS_MINIO_PASSWORD\" | ||
export MINIO_STORAGE_CLASS_STANDARD=\"EC:2\" | ||
export MINIO_BROWSER=\"on\"" >> "$results_minio_secret" | ||
|
||
yq e -n '.resources += ["namespace.yaml", "tekton-results-secret.yaml", "tekton-results-minio-secret.yaml"]' > "$results_kustomize" | ||
if [ "$(yq ".data" < "$results_secret" | grep -cE "DATABASE_USER|DATABASE_PASSWORD")" != "2" ]; then | ||
printf "[ERROR] Invalid manifest: '%s'" "$results_secret" >&2 | ||
exit 1 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,11 @@ SCRIPT_DIR="$( | |
pwd | ||
)" | ||
|
||
ROOT_DIR=$( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If possible please call it |
||
cd "$SCRIPT_DIR/../../../../.." >/dev/null | ||
pwd | ||
) | ||
|
||
# shellcheck source=operator/images/cluster-setup/content/bin/utils.sh | ||
source "$SCRIPT_DIR/utils.sh" | ||
|
||
|
@@ -123,6 +128,9 @@ install_clusters() { | |
|
||
printf -- "- Installing shared manifests... \n" | ||
install_shared_manifests | indent 4 | ||
|
||
install_minio | ||
|
||
printf -- "- Installing applications via Openshift GitOps... \n" | ||
install_applications | indent 4 | ||
|
||
|
@@ -146,6 +154,29 @@ install_shared_manifests() { | |
kubectl apply -k "$CREDENTIALS_DIR/manifests/compute/tekton-results" | ||
} | ||
|
||
install_minio() { | ||
local APP="minio" | ||
DEV_DIR="$ROOT_DIR/developer/openshift" | ||
|
||
############################################################################# | ||
# Install the minio operator | ||
############################################################################# | ||
echo -n "- Minio: " | ||
kubectl apply -k "$DEV_DIR/operators/$APP" >/dev/null | ||
echo "OK" | ||
|
||
check_deployments "openshift-operators" "minio-operator" | indent 2 | ||
|
||
echo -n "- Display Minio Subscription information for potential debug: " | ||
kubectl -n openshift-operators get subscriptions minio-operator -o yaml | ||
|
||
echo -n "- Minio tenant: " | ||
kubectl apply -k "$DEV_DIR/operators/$APP/tenant" >/dev/null | ||
echo "OK" | ||
|
||
check_pod_by_label "tekton-results" "app=minio" | indent 2 | ||
} | ||
|
||
install_applications() { | ||
CONFIG_DIR=$(find "${WORKSPACE_DIR}/environment/compute" -type d -name "${clusters[$i]}") | ||
kubectl apply -k "$CONFIG_DIR" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any default values. How is that going to work when a user will want to deploy a test instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a question for @AndrienkoAleksandr to answer since this was part of his original change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Roming22 I think if user deployed pipeline service using dev_setup.sh script and user didn't set up values in the config.yaml, then defaults will come from here: https://github.com/openshift-pipelines/pipeline-service/pull/443/files#diff-f394b1c9744cc285b6ac80384e967bd73210dd72a905e1ad7581b8ecab4e3773R101 . If you don't like this location we can change it.