Skip to content

Commit

Permalink
Add glance chart
Browse files Browse the repository at this point in the history
  • Loading branch information
caotingv authored and kungze-robot committed Jul 26, 2022
1 parent 898b846 commit 6962aae
Show file tree
Hide file tree
Showing 23 changed files with 790 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/install-openstack-glance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Install glance chart

on:
pull_request:
paths:
- 'charts/glance/**'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Fetch history
run: git fetch --prune --unshallow

- name: Set up chart-testing
uses: helm/[email protected]

- name: Create kind cluster
uses: helm/[email protected]

- name: use local disk
run: tests/scripts/github-action-helper.sh use_local_disk_for_integration_test

- name: Delply rook ceph
run: |
git clone --single-branch --branch v1.9.3 https://github.com/rook/rook.git
kubectl apply -f rook/deploy/examples/crds.yaml
kubectl apply -f rook/deploy/examples/common.yaml
kubectl apply -f rook/deploy/examples/operator.yaml
kubectl apply -f rook/deploy/examples/cluster-test.yaml
- name: Create k8s namespace
run:
kubectl create namespace test-glance

- name: Install password chart
run:
helm install openstack-password charts/password --namespace test-glance

- name: Install openstack-dep chart
run: |
helm dependency build charts/openstack-dep
helm install openstack-dependency charts/openstack-dep --namespace test-glance --wait --timeout 600s
- name: Install keystone chart
run: |
helm dependency build charts/keystone
helm install openstack-keystone charts/keystone --namespace test-glance --wait --timeout 600s
- name: Run chart-testing (install)
run: ct install --namespace test-glance --target-branch main --charts charts/glance --debug --helm-extra-args "--timeout 600s"

- name: setup tmate session for debugging when event is PR
if: failure() && github.event_name == 'pull_request'
uses: mxschmitt/action-tmate@v3
timeout-minutes: 60
11 changes: 11 additions & 0 deletions charts/glance/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
description: Openstack glance service
name: glance
version: 1.0.0
home: https://github.com/kungze/kolla-helm
maintainers:
- name: Kungze
dependencies:
- name: common
repository: https://kungze.github.io/kolla-helm
version: 1.x.x
85 changes: 85 additions & 0 deletions charts/glance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@

# glance

The chart used to deploy openstack glance project.

## TL;DR

```shell
$ helm repo add kolla-helm https://kungze.github.io/kolla-helm
$ helm install openstack-password kolla-helm/password
$ helm install openstack-dependency kolla-helm/openstack-dep
$ helm install openstack-keystone kolla-helm/keystone
$ helm install openstack-glance kolla-helm/glance --set ceph.enabled=false
```

## Ceph Backend

The [rook](https://github.com/rook/rook) ceph cluster is the dependency of the
ceph backend. You can use rook to create a ceph cluster, refer to the
[doc](https://rook.github.io/docs/rook/v1.9/Getting-Started/quickstart/).
Alternatively, you can use rook to manage already existing ceph cluster.
The parameters ``ceph.cephClusterNamespace`` and ``ceph.cephClusterName`` are
required while the ceph backend was enabled.

## Parameters

### Cluster Paramters

| Name | Form title | Description | Value |
| ----------------------- | --------------------- | -------------------------------------------- | --------------- |
| `cluster_domain_suffix` | Cluster Domain Suffix | The doamin suffix of the current k8s cluster | `cluster.local` |


### Dependency Parameters

| Name | Form title | Description | Value |
| --------------------- | --------------------- | --------------------------------------- | ---------------------- |
| `openstackDepRelease` | Openstack-dep Release | The release name of openstack-dep chart | `openstack-dependency` |
| `passwordRelease` | Password Release | The release name of password chart | `openstack-password` |
| `keystoneRelease` | keystone Release | The release name of keystone chart | `openstack-keystone` |


### Image Parameters

| Name | Form title | Description | Value |
| ---------------- | ----------------- | ----------------------------------------------- | ----------------------- |
| `imageRegistry` | Image Registry | The registry address of openstack kolla image | `registry.aliyuncs.com` |
| `imageNamespace` | Image Namespace | The registry namespace of openstack kolla image | `kolla-helm` |
| `openstackTag` | Openstack version | The openstack version | `yoga` |
| `pullPolicy` | Pull Policy | The image pull policy | `IfNotPresent` |


### Deployment Parameters

| Name | Form title | Description | Value |
| ---------------------- | ----------------------- | ------------------------------------------------------------------------ | -------- |
| `replicaCount` | | Number of cinder replicas to deploy (requires ReadWriteMany PVC support) | `1` |
| `serviceAccountName` | | ServiceAccount name | `glance` |
| `enableLivenessProbe` | Enable Liveness Probe | Whether or not enable liveness probe | `true` |
| `enableReadinessProbe` | Enable Readliness Probe | Whether or not enable readiness probe | `true` |


### glance Config parameters

| Name | Form title | Description | Value |
| ---------------------------- | --------------------------- | --------------------------------------------------------------------------------------------------- |-------------- |
| `db_database` | Glance database | The glance database name | `glance` |
| `db_username` | Glance Database User | The glance database user name | `glance` |
| `enabled_notification` | Enable Notification | Whether or not enable notification | `false` |
| `ceph.enabled` | Enable Ceph | Whether or not enable ceph backend | `true` |
| `ceph.poolName` | Pool Name | The ceph pool name which used to store the cinder volumes | `volumes` |
| `ceph.replicatedSize` | Pool Replicated Size | For a pool based on raw copies, specify the number of copies. A size of 1 indicates no redundancy. | `3` |
| `ceph.failureDomain` | Pool Failure Domain | The failure domain will spread the replicas of the data across different failure zones | `host` |
| `ceph.cephClusterNamespace` | Rook Ceph Cluster Namespace | The k8s namespace of rook cephcluster | `rook-ceph` |
| `ceph.cephClusterName` | Rook Ceph Cluster Name | The rook cephcluster name | `rook-ceph` |
| `ceph.cephClientName` | Rook Ceph Client Name | The name of rook ceph cephclient | `glance` |


### Ingress Parameters

| Name | Form title | Description | Value |
| ---------------------- | ------------- | --------------------------------------------------------------------------------------- | ----------------- |
| `ingress.enabled` | Ingress | Whether or not create ingress for glance service | `true` |
| `ingress.ingressClass` | Ingress Class | Ingress Class Name | `openstack-nginx` |
| `ingress.path` | Path Prefix | Ingress will match the path prefix, and forward the matched request to glance service | `image` |
23 changes: 23 additions & 0 deletions charts/glance/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}


CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}

** Please be patient while the chart is being deployed **

Verify:
source openstackrc
openstack image list
17 changes: 17 additions & 0 deletions charts/glance/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{/* vim: set filetype=mustache: */}}

{{/*
Return the proper glance api image name
*/}}
{{- define "glance.api.image" -}}
{{ $repository := "ubuntu-source-glance-api" }}
{{- include "common.images.image" (dict "registry" .Values.imageRegistry "namespace" .Values.imageNamespace "repository" $repository "tag" .Values.openstackTag) }}
{{- end -}}

{{/*
Return the glance.cluster.endpoints
*/}}
{{- define "glance.cluster.endpoint" -}}
{{ printf "http://%s.%s.svc.%s:9292" "glance-api" .Release.Namespace .Values.cluster_domain_suffix }}
{{- end }}

6 changes: 6 additions & 0 deletions charts/glance/templates/cephclient-glance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{- if .Values.ceph.enabled -}}
{{ $images := dict "poolName" "images" "readOnly" true }}
{{ $prvileges := tuple $images }}
{{ $cephClient := dict "cephClusterNamespace" .Values.ceph.cephClusterNamespace "cephUserName" .Values.ceph.cephClientName "prvileges" $prvileges }}
{{- $cephClient | include "common.manifests.cephclient" -}}
{{- end -}}
4 changes: 4 additions & 0 deletions charts/glance/templates/cephpool-images.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{- if .Values.ceph.enabled -}}
{{- $cephPool := dict "poolName" .Values.ceph.poolName "cephClusterNamespace" .Values.ceph.cephClusterNamespace "replicated" .Values.ceph.replicatedSize "failureDomain" .Values.ceph.failureDomain -}}
{{- $cephPool | include "common.manifests.cephpool" -}}
{{- end -}}
74 changes: 74 additions & 0 deletions charts/glance/templates/conf/_glance_api.conf.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[DEFAULT]
debug = False
log_file = /var/log/kolla/glance/glance-api.log
use_forwarded_for = true
bind_host = 0.0.0.0
bind_port = 9292
workers = 5
show_multiple_locations = True
transport_url = rabbit://openstack:rabbitmq_password_placeholder@rabbitmq_endpoint_placeholder
{{- if .Values.ceph.enabled }}
enabled_backends = rbd:rbd
{{- end }}

[database]
connection = mysql+pymysql://glance:database_password_placeholder@database_endpoint_placeholder/glance
connection_recycle_time = 10
max_pool_size = 1
max_retries = -1

[keystone_authtoken]
www_authenticate_uri = keystone_endpoint_placeholder
auth_url = keystone_endpoint_placeholder
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = keystone_password_placeholder
memcached_servers = memcache_endpoint_placeholder

[paste_deploy]
flavor = keystone

[glance_store]
{{- if .Values.ceph.enabled }}
default_backend = rbd
{{- else }}
default_backend = file
{{- end }}

{{- if .Values.ceph.enabled }}
[rbd]
rbd_store_user = {{ .Values.ceph.cephClientName }}
rbd_store_pool = {{ .Values.ceph.poolName }}
rbd_store_chunk_size = 8
{{- else }}
[file]
filesystem_store_datadir = /var/lib/glance/images/
{{- end }}


[os_glance_tasks_store]
filesystem_store_datadir = /var/lib/glance/tasks_work_dir

[os_glance_staging_store]
filesystem_store_datadir = /var/lib/glance/staging

[oslo_middleware]
enable_proxy_headers_parsing = True

[oslo_messaging_notifications]
transport_url = rabbit://openstack:rabbitmq_password_placeholder@rabbitmq_endpoint_placeholder
driver = noop

[image_import_opts]
image_import_plugins = [image_conversion]

[taskflow_executor]
conversion_format = raw

[cors]
allowed_origin = *
allow_headers = Content-MD5,X-Image-Meta-Checksum,X-Storage-Token,Accept-Encoding,X-Auth-Token,X-Identity-Status,X-Roles,X-Service-Catalog,X-User-Id,X-Tenant-Id,X-OpenStack-Request-ID,Authorization,Current-Project,Current-User,Operation-Code,Region-Code

23 changes: 23 additions & 0 deletions charts/glance/templates/conf/_glance_api.json.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"command": "glance-api",
"config_files": [
{
"source": "/var/lib/kolla/config_files/glance-api.conf",
"dest": "/etc/glance/glance-api.conf",
"owner": "glance",
"perm": "0600"
} ],
"permissions": [
{
"path": "/var/lib/glance",
"owner": "glance:glance",
"recurse": true
},
{
"path": "/var/log/kolla/glance",
"owner": "glance:glance",
"recurse": true
}
]
}

22 changes: 22 additions & 0 deletions charts/glance/templates/conf/_glance_db_sync.json.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"command": "/tmp/db-sync.sh",
"config_files": [
{
"source": "/var/lib/kolla/config_files/glance-api.conf",
"dest": "/etc/glance/glance-api.conf",
"owner": "glance",
"perm": "0600"
}
],
"permissions": [
{
"path": "/var/log/kolla",
"owner": "glance:kolla"
},
{
"path": "/var/log/kolla/glance/glance.log",
"owner": "glance:glance"
}
]
}

26 changes: 26 additions & 0 deletions charts/glance/templates/configmap-bin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- $envAll := . }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: glance-bin
namespace: {{ .Release.Namespace | quote }}
data:
db-init.sh: |
{{- include "common.scripts.db_init" . | indent 4 }}
db-sync.sh: |
{{- include "common.scripts.db_sync" . | indent 4 }}
ks-register-services.sh: |
{{- include "common.scripts.ks_register_services" . | indent 4 }}
ks-register-users.sh: |
{{- include "common.scripts.ks_register_users" . | indent 4 }}
configmap-render.py: |
{{ include "common.scripts.configmap_render" . | indent 4 }}
update-openstack-conn-info.py: |
{{- include "common.scripts.update_openstack_conn_info" . | indent 4 }}
{{- if .Values.ceph.enabled }}
gen-ceph-conf.sh: |
{{ include "common.scripts.gen_ceph_conf" . | indent 4 }}
sync-ceph-cm-secrets.py: |
{{- include "common.scripts.sync_ceph_cm_secret" . | indent 4 }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/glance/templates/configmap-etc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: glance-etc
namespace: {{ .Release.Namespace | quote }}
data:
kolla-toolbox-sudoer: |
ansible ALL=(ALL) NOPASSWD: ALL
glance-api.conf: |
{{ tuple "conf/_glance_api.conf.tpl" . | include "common.utils.template" | indent 4 }}
config.json: |
{{ tuple "conf/_glance_api.json.tpl" . | include "common.utils.template" | indent 4 }}
db-sync.json: |
{{ tuple "conf/_glance_db_sync.json.tpl" . | include "common.utils.template" | indent 4 }}
Loading

0 comments on commit 6962aae

Please sign in to comment.