Skip to content

Commit

Permalink
📝 Move samples to its own directories
Browse files Browse the repository at this point in the history
Add kustomization.yaml for ease of use
  • Loading branch information
adyanth committed Feb 2, 2022
1 parent 176340d commit 8814791
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 7 deletions.
39 changes: 39 additions & 0 deletions samples/cluster-tunnel/crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# New tunnel
apiVersion: networking.cfargotunnel.com/v1alpha1
kind: ClusterTunnel
metadata:
name: new-tunnel
spec:
newTunnel:
name: new-k8s-cluster-tunnel
size: 2
cloudflare:
domain: example.com
secret: cloudflare-secrets
# accountId and accountName cannot be both empty. If both are provided, Account ID is used if valid, else falls back to Account Name.
email: [email protected]
accountName: <Cloudflare account name>
accountId: <Cloudflare account ID>
# CLOUDFLARE_API_TOKEN: <override key to be used reading from secret>
# CLOUDFLARE_API_KEY: <override key to be used reading from secret>
# ---
# # Existing tunnel
# apiVersion: networking.cfargotunnel.com/v1alpha1
# kind: ClusterTunnel
# metadata:
# name: existing-tunnel
# spec:
# existingTunnel:
# # id and name cannot be both empty. If both are provided, Tunnel ID is used if valid, else falls back to Tunnel Name.
# id: <tunnel ID>
# name: <tunnel Name>
# size: 2
# cloudflare:
# domain: example.com
# secret: cloudflare-secrets
# # accountId and accountName cannot be both empty. If both are provided, Account ID is used if valid, else falls back to Account Name.
# accountName: <Cloudflare account name>
# accountId: <Cloudflare account ID>
# # CLOUDFLARE_API_KEY: <override key to be used reading from secret>
# # CLOUDFLARE_TUNNEL_CREDENTIAL_FILE: <override key to be used reading from secret>
# # CLOUDFLARE_TUNNEL_CREDENTIAL_SECRET: <override key to be used reading from secret>
8 changes: 8 additions & 0 deletions samples/cluster-tunnel/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace: test-cloudflare-operator-cluster-tunnel
namePrefix: test-cloudflare-operator-cluster-tunnel-

resources:
- "./namespace.yaml"
- "./secrets.yaml"
- "./crd.yaml"
- "./service.yaml"
4 changes: 4 additions & 0 deletions samples/cluster-tunnel/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: app
13 changes: 13 additions & 0 deletions samples/cluster-tunnel/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Secret
metadata:
name: cloudflare-secrets
namespace: cloudflare-operator-system # For a default installation, this will be the namespace for cluster resources
type: Opaque
data:
CLOUDFLARE_API_TOKEN: <API Key, base64 encoded>
CLOUDFLARE_API_KEY: <API Key, base64 encoded>
# CREDENTIAL_FILE is used if found, else CREDENTIAL_SECRET is used to build the file.
# Either of them is needed when using an existing tunnel
CLOUDFLARE_TUNNEL_CREDENTIAL_FILE: <~/.cloudflared/tunnelID.json, base64 encoded>
CLOUDFLARE_TUNNEL_CREDENTIAL_SECRET: <TunnelSecret from ~/.cloudflared/tunnelID.json, base64 encoded>
35 changes: 35 additions & 0 deletions samples/cluster-tunnel/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: whoami
spec:
selector:
matchLabels:
app: whoami
template:
metadata:
labels:
app: whoami
spec:
containers:
- name: whoami
image: traefik/whoami
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: whoami-test
annotations:
cfargotunnel.com/cluster-tunnel: new-tunnel
spec:
selector:
app: whoami
ports:
- port: 80
targetPort: 80
File renamed without changes.
8 changes: 8 additions & 0 deletions samples/tunnel/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace: test-cloudflare-operator-tunnel-app
namePrefix: test-cloudflare-operator-tunnel-

resources:
- "./namespace.yaml"
- "./secrets.yaml"
- "./crd.yaml"
- "./service.yaml"
4 changes: 4 additions & 0 deletions samples/tunnel/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: app
File renamed without changes.
7 changes: 0 additions & 7 deletions samples/service.yaml → samples/tunnel/service.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: testing-crd
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: whoami
namespace: testing-crd
spec:
selector:
matchLabels:
Expand All @@ -31,7 +25,6 @@ apiVersion: v1
kind: Service
metadata:
name: whoami-test
namespace: testing-crd
annotations:
cfargotunnel.com/tunnel: new-tunnel
spec:
Expand Down

0 comments on commit 8814791

Please sign in to comment.