Skip to content

Commit fbf0ca8

Browse files
zphAndrew Chen
andauthored
Add TiDB Resource Controls (#1)
TODO ==== - [ ] Setup automated testing for these changes - [ ] Offer upstream to petoju repo - [ ] Optionally build in lookups to see if current allocation is within limits of total predicted cluster capacity ``` mysql> CALIBRATE RESOURCE START_TIME '2024-07-09 19:10:21' DURATION '30m'; +--------+ | QUOTA | +--------+ | 160194 | +--------+ 1 row in set (0.24 sec) That's approx NOW() - DURATION ``` --------- Co-authored-by: Andrew Chen <[email protected]>
1 parent a091819 commit fbf0ca8

File tree

2,803 files changed

+992
-819891
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,803 files changed

+992
-819891
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Main (test, releases)
22
on:
33
# # Indicates I want to run this workflow on all branches, PR, and tags
44
push:
5-
branches: ["*"]
5+
branches: ["master"]
66
tags: ["*"]
77
pull_request:
88
branches: [ "master" ]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
example.tf
55
terraform.tfplan
66
terraform.tfstate
7+
.terraform.lock*
78
terraform-provider-mysql
89
bin/
910
modules-dev/

.goreleaser.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
version: 2
44
before:
55
hooks:
6-
# this is just an example and not a requirement for provider building/publishing
76
- go mod tidy
7+
# Disabled until auto-generated docs and manual docs operate peacefully
8+
# - go generate ./...
9+
810
builds:
911
- env:
1012
# goreleaser does not work with CGO, it could also complicate

GNUmakefile

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,30 @@ TERRAFORM_VERSION=0.14.7
66
TERRAFORM_OS=$(shell uname -s | tr A-Z a-z)
77
TEST_USER=root
88
TEST_PASSWORD=my-secret-pw
9-
DATESTAMP=$(shell date "+%Y%m%d%H%M%S")
9+
DATESTAMP=$(shell date "+%Y%m%d")
1010
SHA_SHORT=$(shell git describe --match=FORCE_NEVER_MATCH --always --abbrev=40 --dirty --abbrev)
1111
MOST_RECENT_UPSTREAM_TAG=$(shell git for-each-ref refs/tags --sort=-taggerdate --format="%(refname)" | head -1 | grep -E -o "v\d+\.\d+\.\d+")
1212

13+
OS_ARCH=linux_amd64
14+
# Set correct OS_ARCH on Mac
15+
UNAME := $(shell uname -s)
16+
ifeq ($(UNAME),Darwin)
17+
HW := $(shell uname -m)
18+
ifeq ($(HW),arm64)
19+
ARCH=$(HW)
20+
else
21+
ARCH=amd64
22+
endif
23+
OS_ARCH=darwin_$(ARCH)
24+
endif
25+
26+
HOSTNAME=registry.terraform.io
27+
NAMESPACE=zph
28+
NAME=mysql
29+
VERSION=9.9.9
30+
## on linux base os
31+
TERRAFORM_PLUGINS_DIRECTORY=~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
32+
1333
default: build
1434

1535
build: fmtcheck
@@ -121,12 +141,26 @@ endif
121141

122142
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
123143

144+
install:
145+
mkdir -p ${TERRAFORM_PLUGINS_DIRECTORY}
146+
go build -o ${TERRAFORM_PLUGINS_DIRECTORY}/terraform-provider-${NAME}
147+
cd examples && rm -rf .terraform
148+
cd examples && make init
149+
150+
re-install:
151+
rm -f examples/.terraform.lock.hcl
152+
rm -f ${TERRAFORM_PLUGINS_DIRECTORY}/terraform-provider-${NAME}
153+
go build -o ${TERRAFORM_PLUGINS_DIRECTORY}/terraform-provider-${NAME}
154+
cd examples && rm -rf .terraform
155+
cd examples && terraform init
156+
124157
format-tag:
125158
@echo $(MOST_RECENT_UPSTREAM_TAG)-$(DATESTAMP)-$(SHA_SHORT)
126159

127160
tag:
128161
@echo git tag -a $(MOST_RECENT_UPSTREAM_TAG)-$(DATESTAMP)-$(SHA_SHORT) -m $(MOST_RECENT_UPSTREAM_TAG)-$(DATESTAMP)-$(SHA_SHORT)
129162
@git tag -a $(MOST_RECENT_UPSTREAM_TAG)-$(DATESTAMP)-$(SHA_SHORT) -m $(MOST_RECENT_UPSTREAM_TAG)-$(DATESTAMP)-$(SHA_SHORT)
130163

131-
132-
.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile website website-test tag
164+
release:
165+
@goreleaser release --clean --verbose
166+
.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile website website-test tag format-tag

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fragmentation. We will update this readme if those design choices change.
1313

1414
zph fork will use release naming in the following form:
1515

16-
v3.0.62-20240705125429-3c7af6a
16+
v3.0.62-20240705-3c7af6a
1717

1818
{petoju version}-{date}-{sha}
1919

docs/data-sources/databases.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "mysql_databases Data Source - terraform-provider-mysql"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# mysql_databases (Data Source)
10+
11+
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Optional
19+
20+
- `pattern` (String)
21+
22+
### Read-Only
23+
24+
- `databases` (List of String)
25+
- `id` (String) The ID of this resource.

docs/data-sources/tables.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "mysql_tables Data Source - terraform-provider-mysql"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# mysql_tables (Data Source)
10+
11+
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `database` (String)
21+
22+
### Optional
23+
24+
- `pattern` (String)
25+
26+
### Read-Only
27+
28+
- `id` (String) The ID of this resource.
29+
- `tables` (List of String)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)