Skip to content

Commit

Permalink
Merge pull request #4 from denniskniep/feature/local-dev-with-kind
Browse files Browse the repository at this point in the history
Local development with kind
  • Loading branch information
denniskniep authored May 25, 2024
2 parents 95a3063 + 4466671 commit de311e6
Show file tree
Hide file tree
Showing 13 changed files with 113 additions and 21 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ jobs:
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-

- name: Vendor Dependencies
run: make vendor vendor.check

# We could run 'make lint' but we prefer this action because it leaves
# 'annotations' (i.e. it comments on PRs to point out linter violations).
- name: Lint
Expand Down Expand Up @@ -106,9 +103,6 @@ jobs:
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-

- name: Vendor Dependencies
run: make vendor vendor.check

- name: Check Diff
id: check-diff
run: |
Expand Down Expand Up @@ -156,9 +150,6 @@ jobs:
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-

- name: Vendor Dependencies
run: make vendor vendor.check

- name: Start Temporal with docker-compose
run: docker-compose -f tests/docker-compose.yaml up -d

Expand All @@ -182,7 +173,7 @@ jobs:
- unit-tests
- check-diff
- lint
if: needs.detect-noop.outputs.noop != 'true'
if: needs.detect-noop.outputs.noop != 'true' && contains(github.ref, 'refs/tags/v')

steps:
- name: Setup QEMU
Expand Down Expand Up @@ -236,9 +227,6 @@ jobs:
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-

- name: Vendor Dependencies
run: make vendor vendor.check

- name: Build Artifacts
run: make -j2 build.all
env:
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "build"]
path = build
url = https://github.com/upbound/build
url = https://github.com/crossplane/build
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,21 @@ run: go.build
@# To see other arguments that can be provided, run the command with --help instead
$(GO_OUT_DIR)/provider --debug

USER_DIR := $(abspath $(shell cd ~ && pwd -P))

dev: $(KIND) $(KUBECTL)
@$(INFO) Creating kind cluster
@$(KIND) create cluster --name=$(PROJECT_NAME)-dev
@sudo $(KIND) create cluster --name=$(PROJECT_NAME)-dev --kubeconfig=$(USER_DIR)/.kube/config
@$(KUBECTL) cluster-info --context kind-$(PROJECT_NAME)-dev
@$(INFO) Installing Crossplane CRDs
@$(KUBECTL) apply -k https://github.com/crossplane/crossplane//cluster?ref=master
@$(KUBECTL) create -k https://github.com/crossplane/crossplane//cluster?ref=master
@$(INFO) Installing Provider temporal CRDs
@$(KUBECTL) apply -R -f package/crds
@$(INFO) Starting Provider temporal controllers
@$(GO) run cmd/provider/main.go --debug
@$(INFO) Start Provider temporal via: $(GO) run cmd/provider/main.go --debug

dev-clean: $(KIND) $(KUBECTL)
@$(INFO) Deleting kind cluster
@$(KIND) delete cluster --name=$(PROJECT_NAME)-dev
@sudo $(KIND) delete cluster --name=$(PROJECT_NAME)-dev

.PHONY: submodules fallthrough test-integration run dev dev-clean

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ guide may also be of use.
[CONTRIBUTING.md]: https://github.com/crossplane/crossplane/blob/master/CONTRIBUTING.md
[provider-dev]: https://github.com/crossplane/crossplane/blob/master/contributing/guide-provider-development.md

## Start Debug with local cluster
* `make dev` starts a fresh KIND cluster
* `sudo docker-compose -f tests/docker-compose.yaml up -d` starts temporal environment
* debug source code with `.vscode/launch.json`
* Apply the CRDs `kubectl apply -f examples`

## Stop Debug with local cluster
* `make dev-clean` shutdown the earlier started KIND cluster
* `sudo docker-compose -f tests/docker-compose.yaml down -v`

## Tests
Start temporal environment for tests
```
Expand Down
4 changes: 4 additions & 0 deletions examples/00-namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: crossplane-system
25 changes: 25 additions & 0 deletions examples/01-temporal-provider.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
name: debug-config
spec:
deploymentTemplate:
spec:
selector: {}
template:
spec:
containers:
- name: package-runtime
args:
- --debug
---
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-temporal
spec:
package: xpkg.upbound.io/denniskniep/provider-temporal:v1.3.0
packagePullPolicy: IfNotPresent
revisionActivationPolicy: Automatic
runtimeConfigRef:
name: debug-config
11 changes: 11 additions & 0 deletions examples/02-temporal-provider-config-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
name: provider-temporal-config-creds
namespace: crossplane-system
type: Opaque
stringData:
credentials: |
{
"HostPort": "localhost:7222"
}
11 changes: 11 additions & 0 deletions examples/03-temporal-provider-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: temporal.crossplane.io/v1alpha1
kind: ProviderConfig
metadata:
name: local-temporal-instance-config
spec:
credentials:
source: Secret
secretRef:
namespace: crossplane-system
name: provider-temporal-config-creds
key: credentials
11 changes: 11 additions & 0 deletions examples/04-temporal-namespace-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: core.temporal.crossplane.io/v1alpha1
kind: TemporalNamespace
metadata:
name: ns1
spec:
forProvider:
name: "Test 1"
description: "Desc 1"
ownerEmail: "Test@test.local"
providerConfigRef:
name: local-temporal-instance-config
11 changes: 11 additions & 0 deletions examples/05-temporal-searchattribute-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: core.temporal.crossplane.io/v1alpha1
kind: SearchAttribute
metadata:
name: searchattr1
spec:
forProvider:
name: "Test0815"
type: "Keyword"
temporalNamespaceName: "Test 1"
providerConfigRef:
name: local-temporal-instance-config
12 changes: 12 additions & 0 deletions examples/06-temporal-searchattribute-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: core.temporal.crossplane.io/v1alpha1
kind: SearchAttribute
metadata:
name: searchattr2
spec:
forProvider:
name: "Test1234"
type: "Text"
temporalNamespaceNameRef:
name: "ns1"
providerConfigRef:
name: local-temporal-instance-config
10 changes: 9 additions & 1 deletion tests/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ services:
- 7222:7233
depends_on:
- postgresql

temporal-ui:
image: temporalio/ui:2.21.4
container_name: temporal-ui
depends_on:
- temporal
environment:
- TEMPORAL_ADDRESS=temporal:7233
ports:
- 8181:8080
postgresql:
image: postgres:13
environment:
Expand Down

0 comments on commit de311e6

Please sign in to comment.