generated from crossplane/upjet-provider-template
-
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.
- Loading branch information
1 parent
2758141
commit b0de66d
Showing
12 changed files
with
248 additions
and
16 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
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,119 @@ | ||
apiVersion: apiextensions.crossplane.io/v1 | ||
kind: Composition | ||
metadata: | ||
name: consulserviceacl.composite.daanvinken | ||
spec: | ||
compositeTypeRef: | ||
apiVersion: daanvinken.io/v1 | ||
kind: ConsulServiceACL | ||
resources: | ||
# Consul ACL Policy Resource | ||
- name: consul_acl_policy | ||
base: | ||
apiVersion: acl.daanvinken.io/v1alpha1 | ||
kind: Policy | ||
metadata: | ||
labels: | ||
crossplane.io/composite: "consulserviceacl" # Simplified label | ||
spec: | ||
forProvider: | ||
datacenters: | ||
- dc1 | ||
rules: "" # Patch later | ||
|
||
patches: | ||
- fromFieldPath: "metadata.name" # Use composite name as part of policy name | ||
toFieldPath: "spec.forProvider.name" | ||
transforms: | ||
- type: string | ||
string: | ||
fmt: "policy-%s" | ||
# Inject composite name into the `rules` field dynamically | ||
- fromFieldPath: "metadata.name" | ||
toFieldPath: "spec.forProvider.rules" | ||
transforms: | ||
- type: string | ||
string: | ||
fmt: | | ||
agent_prefix "" { | ||
policy = "read" | ||
} | ||
service_prefix "" { | ||
policy = "read" | ||
} | ||
service_prefix "%[1]s" { | ||
policy = "write" | ||
} | ||
key_prefix "%[1]s" { | ||
policy = "write" | ||
} | ||
key_prefix "app/%[1]s" { | ||
policy = "write" | ||
} | ||
session_prefix "" { | ||
policy = "write" | ||
} | ||
session_prefix "session/%[1]s" { | ||
policy = "write" | ||
} | ||
key_prefix "preloader/%[1]s" { | ||
policy = "write" | ||
} | ||
# Consul ACL Role Resource | ||
- name: consul_acl_role | ||
base: | ||
apiVersion: acl.daanvinken.io/v1alpha1 | ||
kind: Role | ||
spec: | ||
forProvider: | ||
name: "placeholder" | ||
description: "ACL Role for service" | ||
serviceIdentities: | ||
- serviceName: "foo" | ||
patches: | ||
- fromFieldPath: "spec.parameters.service" | ||
toFieldPath: "spec.forProvider.name" | ||
transforms: | ||
- type: string | ||
string: | ||
fmt: "role-%s" | ||
# Reference the Policy dynamically based on the unique composite name | ||
- type: FromCompositeFieldPath | ||
fromFieldPath: "metadata.name" | ||
toFieldPath: "spec.forProvider.policies[0]" | ||
transforms: | ||
- type: string | ||
string: | ||
fmt: "policy-%s" | ||
|
||
# Consul ACL Token Resource | ||
- name: consul_acl_token | ||
base: | ||
apiVersion: acl.daanvinken.io/v1alpha1 | ||
kind: Token | ||
spec: | ||
forProvider: | ||
description: "Generated by Crossplane" | ||
patches: | ||
- fromFieldPath: "spec.parameters.service" | ||
toFieldPath: "spec.forProvider.name" | ||
transforms: | ||
- type: string | ||
string: | ||
fmt: "role-%s" | ||
# Reference the Policy dynamically based on the unique composite name | ||
- type: FromCompositeFieldPath | ||
fromFieldPath: "metadata.name" | ||
toFieldPath: "spec.forProvider.policies[0]" | ||
transforms: | ||
- type: string | ||
string: | ||
fmt: "policy-%s" |
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,7 @@ | ||
apiVersion: daanvinken.io/v1 | ||
kind: ConsulServiceACL | ||
metadata: | ||
name: alb-abcdfghi1234 | ||
spec: | ||
parameters: | ||
main_keys: true |
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,7 @@ | ||
apiVersion: daanvinken.io/v1 | ||
kind: ConsulServiceACL | ||
metadata: | ||
name: acr-main | ||
spec: | ||
parameters: | ||
main_keys: true |
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,8 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- composition.yaml | ||
- consulserviceacl.yaml | ||
- consulserviceacl-2.yaml | ||
- xrd.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,29 @@ | ||
apiVersion: apiextensions.crossplane.io/v1 | ||
kind: CompositeResourceDefinition | ||
metadata: | ||
name: consulserviceacls.daanvinken.io | ||
spec: | ||
group: daanvinken.io | ||
names: | ||
kind: ConsulServiceACL | ||
plural: consulserviceacls | ||
claimNames: | ||
kind: ConsulServiceACL | ||
plural: consulserviceacls | ||
versions: | ||
- name: v1 | ||
served: true | ||
referenceable: true | ||
schema: | ||
openAPIV3Schema: | ||
type: object | ||
properties: | ||
spec: | ||
type: object | ||
properties: | ||
parameters: | ||
type: object | ||
properties: | ||
main_keys: | ||
type: boolean | ||
description: "Flag to include main keys in the ACL policy" |
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,45 @@ | ||
apiVersion: acl.daanvinken.io/v1alpha1 | ||
kind: Token | ||
metadata: | ||
annotations: | ||
meta.upbound.io/example-id: acl/v1alpha1/token | ||
name: node-token | ||
spec: | ||
forProvider: | ||
description: my test token | ||
local: true | ||
policies: | ||
- agent | ||
--- | ||
apiVersion: acl.daanvinken.io/v1alpha1 | ||
kind: Policy | ||
metadata: | ||
annotations: | ||
meta.upbound.io/example-id: acl/v1alpha1/token | ||
labels: | ||
testing.upbound.io/example-name: agent | ||
name: agent | ||
spec: | ||
forProvider: | ||
name: agent | ||
rules: | | ||
node_prefix "" { | ||
policy = "read" | ||
} | ||
--- | ||
apiVersion: acl.daanvinken.io/v1alpha1 | ||
kind: Role | ||
metadata: | ||
annotations: | ||
meta.upbound.io/example-id: acl/v1alpha1/role | ||
labels: | ||
testing.upbound.io/example-name: read | ||
name: read | ||
spec: | ||
forProvider: | ||
description: bar | ||
name: foo | ||
policies: | ||
- agent | ||
serviceIdentities: | ||
- serviceName: foo |
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
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