forked from nakamasato/mysql-operator
-
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.
Merge pull request #2 from thealtoclef/Add-helm-chart
Add helm chart
- Loading branch information
Showing
18 changed files
with
1,059 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Release Docker Image | ||
|
||
on: | ||
workflow_dispatch: # for manual testing | ||
push: | ||
# Publish semver tags as releases: | ||
tags: ["v*.*.*"] | ||
|
||
jobs: | ||
call-docker-release: | ||
permissions: | ||
packages: write | ||
uses: thealtoclef/modular-automations/.github/workflows/docker-release-forked-repo.yaml@main |
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,14 @@ | ||
name: Release Helm Chart | ||
|
||
on: | ||
workflow_dispatch: # for manual testing | ||
push: | ||
# Publish semver tags as releases: | ||
tags: ["helm-v*.*.*"] | ||
|
||
jobs: | ||
call-helm-release: | ||
permissions: | ||
contents: write | ||
packages: write | ||
uses: thealtoclef/modular-automations/.github/workflows/helm-release.yaml@main |
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 | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,21 @@ | ||
apiVersion: v2 | ||
name: doris-manager | ||
description: A Helm chart for Kubernetes | ||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: "0.0.1" | ||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "0.0.1" |
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,40 @@ | ||
# [mysql-operator](https://github.com/nakamasato/mysql-operator) | ||
|
||
## Values | ||
|
||
1. **adminUserSecretType**: `raw`, `gcp` or `k8s` . With `raw`, you need to give root user password in `MySQL` custom resource. With `gcp`, you can securely store root user password in GCP SecretManager. This root user password is used to manage (create/edit/update) MySQL users, databases, etc. With k8s you need to create (in the same namespace where this operator is installed) two kubernetes secrets one for the root username and another one for root password. | ||
1. **gcpServiceAccount**: Only for `adminUserSecretType=gcp`. GCP service account for Pod `[email protected]` | ||
1. This service account needs the following roles: | ||
1. `roles/secretmanager.secretAccessor` to allow to get root password from SecretManager | ||
1. **gcpProjectId**: Only for `adminUserSecretType=gcp` | ||
1. **adminUserSecretNamespace**: Only for `adminUserSecretType=k8s`. Kubernetes Namespace of Secret for MySQL admin user credentials. | ||
1. **cloudSQL.instanceConnectionName**: `InstanceConnectionName` for [Google Cloud SQL](https://cloud.google.com/sql/) if you use Cloud SQL to manage with mysql-operator. `<project-id>:<region>:<instance-name>` | ||
|
||
|
||
|
||
## Usage | ||
|
||
### Dryrun | ||
|
||
You can check the final yaml with `--dry-run`: | ||
|
||
``` | ||
helm install mysql-operator ./charts/mysql-operator \ | ||
--dry-run \ | ||
--set adminUserSecretType=gcp \ | ||
--set gcpServiceAccount=${SA_NAME}@${PROJECT}.iam.gserviceaccount.com \ | ||
--set gcpProjectId=$PROJECT \ | ||
--set cloudSQL.instanceConnectionName=$PROJECT:$REGION:$INSTANCE_NAME \ | ||
--namespace mysql-operator | ||
``` | ||
|
||
### Install | ||
|
||
``` | ||
helm install mysql-operator ./charts/mysql-operator \ | ||
--set adminUserSecretType=gcp \ | ||
--set gcpServiceAccount=${SA_NAME}@${PROJECT}.iam.gserviceaccount.com \ | ||
--set gcpProjectId=$PROJECT \ | ||
--set cloudSQL.instanceConnectionName=$PROJECT:$REGION:$INSTANCE_NAME \ | ||
--namespace mysql-operator | ||
``` |
109 changes: 109 additions & 0 deletions
109
helm-charts/doris-resource-operator/crds/mysql.nakamasato.com_mysqldbs.yaml
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,109 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.14.0 | ||
name: mysqldbs.mysql.nakamasato.com | ||
spec: | ||
group: mysql.nakamasato.com | ||
names: | ||
kind: MySQLDB | ||
listKind: MySQLDBList | ||
plural: mysqldbs | ||
singular: mysqldb | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- description: The phase of MySQLDB | ||
jsonPath: .status.phase | ||
name: Phase | ||
type: string | ||
- description: The reason for the current phase of this MySQLDB | ||
jsonPath: .status.reason | ||
name: Reason | ||
type: string | ||
- description: schema_migration table if schema migration is enabled. | ||
jsonPath: .status.schemaMigration | ||
name: SchemaMigration | ||
type: string | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: MySQLDB is the Schema for the mysqldbs API | ||
properties: | ||
apiVersion: | ||
description: |- | ||
APIVersion defines the versioned schema of this representation of an object. | ||
Servers should convert recognized schemas to the latest internal value, and | ||
may reject unrecognized values. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | ||
type: string | ||
kind: | ||
description: |- | ||
Kind is a string value representing the REST resource this object represents. | ||
Servers may infer this from the endpoint the client submits requests to. | ||
Cannot be updated. | ||
In CamelCase. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: MySQLDBSpec defines the desired state of MySQLDB | ||
properties: | ||
clusterName: | ||
description: Cluster name to reference to, which decides the destination | ||
type: string | ||
x-kubernetes-validations: | ||
- message: Cluster name is immutable | ||
rule: self == oldSelf | ||
dbName: | ||
description: MySQL Database name | ||
type: string | ||
schemaMigrationFromGitHub: | ||
description: MySQL Database Schema Migrations from GitHub | ||
properties: | ||
owner: | ||
type: string | ||
path: | ||
type: string | ||
ref: | ||
type: string | ||
repo: | ||
type: string | ||
required: | ||
- owner | ||
- path | ||
- repo | ||
type: object | ||
required: | ||
- clusterName | ||
- dbName | ||
type: object | ||
status: | ||
description: MySQLDBStatus defines the observed state of MySQLDB | ||
properties: | ||
phase: | ||
description: The phase of database creation | ||
type: string | ||
reason: | ||
description: The reason for the current phase | ||
type: string | ||
schemaMigration: | ||
description: Schema Migration status | ||
properties: | ||
dirty: | ||
type: boolean | ||
version: | ||
type: integer | ||
required: | ||
- dirty | ||
- version | ||
type: object | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
138 changes: 138 additions & 0 deletions
138
helm-charts/doris-resource-operator/crds/mysql.nakamasato.com_mysqls.yaml
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,138 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.14.0 | ||
name: mysqls.mysql.nakamasato.com | ||
spec: | ||
group: mysql.nakamasato.com | ||
names: | ||
kind: MySQL | ||
listKind: MySQLList | ||
plural: mysqls | ||
singular: mysql | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .spec.host | ||
name: Host | ||
type: string | ||
- jsonPath: .spec.adminUser.name | ||
name: AdminUser | ||
type: string | ||
- jsonPath: .status.connected | ||
name: Connected | ||
type: boolean | ||
- description: The number of MySQLUsers that belongs to the MySQL | ||
jsonPath: .status.userCount | ||
name: UserCount | ||
type: integer | ||
- description: The number of MySQLDBs that belongs to the MySQL | ||
jsonPath: .status.dbCount | ||
name: DBCount | ||
type: integer | ||
- jsonPath: .status.reason | ||
name: Reason | ||
type: string | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: MySQL is the Schema for the mysqls API | ||
properties: | ||
apiVersion: | ||
description: |- | ||
APIVersion defines the versioned schema of this representation of an object. | ||
Servers should convert recognized schemas to the latest internal value, and | ||
may reject unrecognized values. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | ||
type: string | ||
kind: | ||
description: |- | ||
Kind is a string value representing the REST resource this object represents. | ||
Servers may infer this from the endpoint the client submits requests to. | ||
Cannot be updated. | ||
In CamelCase. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: MySQLSpec holds the connection information for the target | ||
MySQL cluster. | ||
properties: | ||
adminPassword: | ||
description: AdminPassword is MySQL password to connect target MySQL | ||
cluster. | ||
properties: | ||
name: | ||
description: Secret Name | ||
type: string | ||
type: | ||
description: Secret Type (e.g. gcp, raw, k8s) | ||
enum: | ||
- raw | ||
- gcp | ||
- k8s | ||
type: string | ||
required: | ||
- name | ||
- type | ||
type: object | ||
adminUser: | ||
description: AdminUser is MySQL user to connect target MySQL cluster. | ||
properties: | ||
name: | ||
description: Secret Name | ||
type: string | ||
type: | ||
description: Secret Type (e.g. gcp, raw, k8s) | ||
enum: | ||
- raw | ||
- gcp | ||
- k8s | ||
type: string | ||
required: | ||
- name | ||
- type | ||
type: object | ||
host: | ||
description: Host is MySQL host of target MySQL cluster. | ||
type: string | ||
port: | ||
default: 3306 | ||
description: Port is MySQL port of target MySQL cluster. | ||
type: integer | ||
required: | ||
- adminPassword | ||
- adminUser | ||
- host | ||
type: object | ||
status: | ||
description: MySQLStatus defines the observed state of MySQL | ||
properties: | ||
connected: | ||
description: true if successfully connected to the MySQL cluster | ||
type: boolean | ||
dbCount: | ||
default: 0 | ||
description: The number of database in this MySQL | ||
format: int32 | ||
type: integer | ||
reason: | ||
description: Reason for connection failure | ||
type: string | ||
userCount: | ||
default: 0 | ||
description: The number of users in this MySQL | ||
format: int32 | ||
type: integer | ||
required: | ||
- dbCount | ||
- userCount | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
Oops, something went wrong.