brusnika-stage: upgrade IAM with SpiceDB schema initialization
This commit is contained in:
parent
090763162b
commit
36f0fadb2f
@ -45,7 +45,7 @@ spec:
|
||||
|
||||
image:
|
||||
name:
|
||||
_default: cr.yandex/crp3ccidau046kdj8g9q/iams:contour_29754513
|
||||
_default: cr.yandex/crp3ccidau046kdj8g9q/iams:contour_d5c05e7e
|
||||
pullPolicy:
|
||||
_default: IfNotPresent
|
||||
|
||||
@ -64,11 +64,26 @@ spec:
|
||||
port:
|
||||
_default: 8080
|
||||
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 0
|
||||
maxSurge: 1
|
||||
|
||||
probes:
|
||||
liveness:
|
||||
enabled: false
|
||||
readiness:
|
||||
enabled: false
|
||||
enabled: true
|
||||
httpGet:
|
||||
path:
|
||||
_default: /health
|
||||
port:
|
||||
_default: 8080
|
||||
periodSeconds:
|
||||
_default: 5
|
||||
timeoutSeconds:
|
||||
_default: 3
|
||||
|
||||
service:
|
||||
enabled: true
|
||||
@ -184,7 +199,20 @@ spec:
|
||||
value:
|
||||
_default: "ams-sync"
|
||||
|
||||
- name: SPICEDB_ENDPOINT
|
||||
value:
|
||||
_default: spicedb.spicedb.svc.cluster.local:50051
|
||||
|
||||
- name: SPICEDB_INSECURE
|
||||
value:
|
||||
_default: "true"
|
||||
|
||||
secretEnvs:
|
||||
- name: SPICEDB_TOKEN
|
||||
secretName:
|
||||
_default: spicedb-secret
|
||||
secretKey: grpc-preshared-key
|
||||
|
||||
- name: DB_DSN
|
||||
secretName:
|
||||
_default: "iams-secret"
|
||||
@ -214,3 +242,54 @@ spec:
|
||||
gitlabUri: ""
|
||||
gitlabJobUrl: ""
|
||||
owner: ""
|
||||
postRenderers:
|
||||
- kustomize:
|
||||
patches:
|
||||
- target:
|
||||
kind: Deployment
|
||||
name: iam-backend
|
||||
patch: |
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: iam-backend
|
||||
namespace: iam
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
checksum/spicedb-schema: 72606779239bef9fe18170545d8fb3d70581581048aeea55a390d414197f1ce6
|
||||
spec:
|
||||
initContainers:
|
||||
- name: spicedb-schema
|
||||
image: ghcr.io/authzed/zed:v1.2.0
|
||||
command:
|
||||
- /usr/local/bin/zed
|
||||
args:
|
||||
- --insecure
|
||||
- --skip-version-check
|
||||
- --max-retries
|
||||
- '60'
|
||||
- schema
|
||||
- write
|
||||
- /schema/iam.zed
|
||||
env:
|
||||
- name: ZED_ENDPOINT
|
||||
value: spicedb.spicedb.svc.cluster.local:50051
|
||||
- name: ZED_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: spicedb-secret
|
||||
key: grpc-preshared-key
|
||||
volumeMounts:
|
||||
- name: spicedb-schema
|
||||
mountPath: /schema
|
||||
readOnly: true
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 32Mi
|
||||
volumes:
|
||||
- name: spicedb-schema
|
||||
configMap:
|
||||
name: iam-spicedb-schema
|
||||
|
||||
@ -3,4 +3,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: iam
|
||||
resources:
|
||||
- backend.yaml
|
||||
- backend.yaml
|
||||
- spicedb-schema.yaml
|
||||
|
||||
29
apps/iam/brusnika-stage/spicedb-schema.yaml
Normal file
29
apps/iam/brusnika-stage/spicedb-schema.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: iam-spicedb-schema
|
||||
namespace: iam
|
||||
data:
|
||||
iam.zed: "definition auth_group {\n\trelation grants: django_permission\n}\n\n//\
|
||||
\ Org structure. department \u0431\u0435\u0437 parent \u043C\u0435\u0436\u0434\
|
||||
\u0443 department.\ndefinition department {\n\trelation tenant: tenant\n\trelation\
|
||||
\ member: user\n\trelation service_account: service_account\n\trelation groups:\
|
||||
\ auth_group\n\tpermission group_grants = groups->grants\n}\n\ndefinition django_permission\
|
||||
\ {}\n\ndefinition position {\n\trelation tenant: tenant\n\trelation department:\
|
||||
\ department\n\trelation holder: user\n\trelation service_account: service_account\n\
|
||||
\trelation groups: auth_group\n\trelation scoped_resource: resource\n\tpermission\
|
||||
\ group_grants = groups->grants\n}\n\ndefinition resource {\n\trelation tenant:\
|
||||
\ tenant\n\trelation parent: resource\n\n\trelation read: service_account | service_account#member\n\
|
||||
\trelation write: service_account | service_account#member\n\trelation admin:\
|
||||
\ service_account | service_account#member\n\trelation view: service_account |\
|
||||
\ service_account#member\n\n\tpermission inherited_read = read + write + admin\
|
||||
\ + parent->inherited_read\n\tpermission inherited_write = write + admin + parent->inherited_write\n\
|
||||
\tpermission inherited_admin = admin + parent->inherited_admin\n\n\tpermission\
|
||||
\ allow_read = inherited_read + view + tenant->unrestricted\n\tpermission allow_write\
|
||||
\ = inherited_write\n\tpermission allow_admin = inherited_admin\n}\n\ndefinition\
|
||||
\ service_account {\n\trelation direct_member: user\n\tpermission member = direct_member\n\
|
||||
}\n\ndefinition tenant {\n\trelation unrestricted: service_account | service_account#member\n\
|
||||
}\n\ndefinition user {\n\trelation direct: django_permission\n\trelation member:\
|
||||
\ auth_group\n\trelation holder: position\n\trelation department_member: department\n\
|
||||
\tpermission global_grant = direct + member->grants + holder->group_grants + department_member->group_grants\n\
|
||||
\tpermission resource_position_grant = holder->group_grants\n}\n"
|
||||
Loading…
Reference in New Issue
Block a user