Skip to content

Commit

Permalink
Update composition to also create an accesspolicy (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienduchesne authored Apr 18, 2024
1 parent 7d036ca commit a2c176a
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions package-config-stack/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,86 @@ spec:
fmt: '%s-cloudstackserviceaccounttoken'
type: string
type: FromCompositeFieldPath
# Also create an access policy scoped to the stack (as an example of a stack reference)
- base:
apiVersion: cloud.grafana.crossplane.io/v1alpha1
kind: AccessPolicy
spec:
forProvider:
realm:
- stackSelector:
matchControllerRef: true
type: stack
region: us
scopes:
- metrics:write
- stacks:read
name: cloudaccesspolicy
patches:
- fromFieldPath: spec.parameters.providerName
toFieldPath: spec.providerConfigRef.name
type: FromCompositeFieldPath
- combine:
strategy: string
string:
fmt: '%s-metrics-publish'
variables:
- fromFieldPath: spec.parameters.slug
toFieldPath: spec.forProvider.name
type: CombineFromComposite
- combine:
strategy: string
string:
fmt: '%s-metrics-publish'
variables:
- fromFieldPath: spec.parameters.slug
toFieldPath: spec.forProvider.displayName
type: CombineFromComposite
- fromFieldPath: spec.parameters.region
toFieldPath: spec.forProvider.region
type: FromCompositeFieldPath
- base:
apiVersion: cloud.grafana.crossplane.io/v1alpha1
kind: AccessPolicyToken
spec:
forProvider:
accessPolicySelector:
matchControllerRef: true
region: us
writeConnectionSecretToRef:
namespace: crossplane
connectionDetails:
- fromConnectionSecretKey: attribute.token
name: metricsPublishToken
name: cloudaccesspolicytoken
patches:
- fromFieldPath: spec.parameters.providerName
toFieldPath: spec.providerConfigRef.name
type: FromCompositeFieldPath
- combine:
strategy: string
string:
fmt: '%s-metrics-publish'
variables:
- fromFieldPath: spec.parameters.slug
toFieldPath: spec.forProvider.name
type: CombineFromComposite
- combine:
strategy: string
string:
fmt: '%s-metrics-publish'
variables:
- fromFieldPath: spec.parameters.slug
toFieldPath: spec.forProvider.displayName
type: CombineFromComposite
- fromFieldPath: spec.parameters.region
toFieldPath: spec.forProvider.region
type: FromCompositeFieldPath
- fromFieldPath: metadata.uid
toFieldPath: spec.writeConnectionSecretToRef.name
transforms:
- string:
fmt: '%s-cloudaccesspolicytoken'
type: string
type: FromCompositeFieldPath
writeConnectionSecretsToNamespace: crossplane

0 comments on commit a2c176a

Please sign in to comment.