-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows us to test that resources can be created and deleted. I will add new tests in future PRs.
- Loading branch information
1 parent
eb98abc
commit f8b1427
Showing
8 changed files
with
133 additions
and
80 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
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ cover.out | |
/vendor | ||
/.vendor-new | ||
.DS_Store | ||
/kubeconfig | ||
|
||
# ignore IDE folders | ||
.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
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,38 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: grafana | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: grafana | ||
namespace: grafana | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: grafana | ||
template: | ||
metadata: | ||
labels: | ||
app: grafana | ||
spec: | ||
containers: | ||
- name: grafana | ||
image: grafana/grafana:latest | ||
ports: | ||
- containerPort: 3000 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: grafana | ||
namespace: grafana | ||
spec: | ||
selector: | ||
app: grafana | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 3000 |
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,28 @@ | ||
# Grafana Provider Creds | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: grafana-creds | ||
namespace: upbound-system | ||
type: Opaque | ||
stringData: | ||
credentials: | | ||
{ | ||
"url": "http://grafana.grafana.svc.cluster.local", | ||
"auth": "admin:admin" | ||
} | ||
--- | ||
|
||
# Grafana Provider | ||
apiVersion: grafana.crossplane.io/v1beta1 | ||
kind: ProviderConfig | ||
metadata: | ||
name: grafana-provider | ||
spec: | ||
credentials: | ||
source: Secret | ||
secretRef: | ||
name: grafana-creds | ||
namespace: upbound-system | ||
key: credentials |
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 |
---|---|---|
@@ -1,26 +1,22 @@ | ||
#!/usr/bin/env bash | ||
set -aeuo pipefail | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
echo "Running setup.sh" | ||
echo "Creating cloud credential secret..." | ||
${KUBECTL} -n upbound-system create secret generic provider-secret --from-literal=credentials="{\"token\":\"${UPTEST_CLOUD_CREDENTIALS}\"}" --dry-run=client -o yaml | ${KUBECTL} apply -f - | ||
|
||
echo "Starting grafana on the cluster..." | ||
${KUBECTL} apply -f "${SCRIPT_DIR}/grafana.yaml" | ||
|
||
echo "Creating provider..." | ||
${KUBECTL} apply -f "${SCRIPT_DIR}/provider.yaml" | ||
|
||
echo "Waiting for grafana to come online..." | ||
${KUBECTL} -n grafana wait --for=condition=Available deployment/grafana --timeout=5m | ||
|
||
echo "Waiting until provider is healthy..." | ||
${KUBECTL} wait provider.pkg --all --for condition=Healthy --timeout 5m | ||
|
||
echo "Waiting for all pods to come online..." | ||
${KUBECTL} -n upbound-system wait --for=condition=Available deployment --all --timeout=5m | ||
|
||
echo "Creating a default provider config..." | ||
cat <<EOF | ${KUBECTL} apply -f - | ||
apiVersion: grafana.com/v1beta1 | ||
kind: ProviderConfig | ||
metadata: | ||
name: default | ||
spec: | ||
credentials: | ||
source: Secret | ||
secretRef: | ||
name: provider-secret | ||
namespace: upbound-system | ||
key: credentials |
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
apiVersion: oss.grafana.crossplane.io/v1alpha1 | ||
kind: Dashboard | ||
metadata: | ||
annotations: | ||
meta.upbound.io/example-id: oss/v1alpha1/dashboard | ||
labels: | ||
testing.upbound.io/example-name: test-dashboard | ||
name: test-dashboard | ||
spec: | ||
forProvider: | ||
configJson: |- | ||
{ | ||
"title" : "My Dashboard", | ||
"uid" : "my-dashboard-uid" | ||
} | ||
folderSelector: | ||
matchLabels: | ||
testing.upbound.io/example-name: test-dashboard | ||
providerConfigRef: | ||
name: grafana-provider | ||
|
||
--- | ||
|
||
apiVersion: oss.grafana.crossplane.io/v1alpha1 | ||
kind: Folder | ||
metadata: | ||
annotations: | ||
meta.upbound.io/example-id: oss/v1alpha1/dashboard | ||
labels: | ||
testing.upbound.io/example-name: test-dashboard | ||
name: test-dashboard | ||
spec: | ||
forProvider: | ||
title: My Folder | ||
uid: my-folder-uid | ||
providerConfigRef: | ||
name: grafana-provider |