Skip to content

Commit

Permalink
[tlse] tls for PlacementAPI pod configuration
Browse files Browse the repository at this point in the history
Public/Internal service cert secrets and the CA bundle secret
can be passed to configure httpd virtual hosts for tls termination.
The certs are mounted to in
var/lib/config-data/tls/certs/%s.crt|key and a CA bundle to
/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem.
Server cert and key are intended to be moved by kolla to
/etc/pki/tls/certs|private.

Depends-On: openstack-k8s-operators/lib-common#428
Depends-On: openstack-k8s-operators/openstack-operator#625

Signed-off-by: Veronika Fisarova <[email protected]>
  • Loading branch information
Deydra71 committed Jan 17, 2024
1 parent 37b1972 commit faceda0
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 58 deletions.
2 changes: 1 addition & 1 deletion config/samples/placement_v1beta1_placementtls.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: placement.openstack.org/v1beta1
kind: PlacementAPI
metadata:
name: placement-tls
name: placement
spec:
serviceUser: placement
customServiceConfig: |
Expand Down
2 changes: 1 addition & 1 deletion tests/kuttl/common/tls_certificates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ metadata:
data:
ca.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJlekNDQVNLZ0F3SUJBZ0lRTkhER1lzQnM3OThpYkREN3EvbzJsakFLQmdncWhrak9QUVFEQWpBZU1Sd3cKR2dZRFZRUURFeE55YjI5MFkyRXRhM1YwZEd3dGNIVmliR2xqTUI0WERUSTBNREV4TlRFd01UVXpObG9YRFRNMApNREV4TWpFd01UVXpObG93SGpFY01Cb0dBMVVFQXhNVGNtOXZkR05oTFd0MWRIUnNMWEIxWW14cFl6QlpNQk1HCkJ5cUdTTTQ5QWdFR0NDcUdTTTQ5QXdFSEEwSUFCRDc4YXZYcWhyaEM1dzhzOVdrZDRJcGJlRXUwM0NSK1hYVWQKa0R6T1J5eGE5d2NjSWREaXZiR0pqSkZaVFRjVm1ianExQk1Zc2pyM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UZmUHg4Qm9YQXgKRkt5T2ZzSytQei9uSkl0R2lHMVNMWFJ0S041ZGRnR3N5eUh5SitqY1ZBYk9UMFNJWnZ4TUJva0NEOGk3Y1Q3Ygo3aHErVUlNSDBkVzU1NEg0NVh4TmZJek9FaSs5dktHTllFc3gyZFJROG5PTDVnTVUyWEt6eVllcVgzd3JiRXR5CkR0cXpzUE9IMkMySiswU0FNaHY5ZXdLQmdRQ2szeWs5TUwvaUNWUk9rTmNybTdtRk5xeS9rQ2dleU43eTRDeUoKTS9RbllrZHYwSjZmRWJrZU96QzJ3TXBrRmtuL1hVR3RqSVN6YUV5STlnS0ZnaXVGL1hWL3orWmhTQllncFl6eAoxR0xIK3ZDbWxIMU4wTjkzRFFKcng3ZTFoc3NhOVhXQS85ZVg5VU96UzFTMWt3V2hvc2haeXdhN29rU1FVaXVPCmlVQ1hZUUtCZ1FEUVZUVHc3WUY3QzNTVmg5OWRObUdTaHV2LzZ2aTJmNDlOMklGMURNQ1haaEpoOUVZck9TV2kKY05oakxGRFhmdzVlZlFURWU3Ykx5bTJGVDd0YnZFSm5USHFyakVuUDRUWExqZnczL3RiQ3RxWVNZRlRqdThFUApadHVwd21ZWjhFVU1pSnVHS2l2SExmSjk2dy8xR21BOHVCZUVtV05YRW9FUU1ySmxuM3g5d3c9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
14 changes: 0 additions & 14 deletions tests/kuttl/tests/placement_deploy_tls/00-assert.yaml

This file was deleted.

53 changes: 11 additions & 42 deletions tests/kuttl/tests/placement_deploy_tls/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,14 @@
apiVersion: placement.openstack.org/v1beta1
kind: PlacementAPI
apiVersion: v1
kind: Secret
metadata:
name: placement
spec:
tls:
api:
internal:
secretName: cert-internal-svc
public:
secretName: cert-public-svc
caBundleSecretName: combined-ca-bundle
name: cert-internal-svc
---
apiVersion: apps/v1
kind: Deployment
apiVersion: v1
kind: Secret
metadata:
name: placement
spec:
replicas: 1
template:
metadata:
labels:
service: keystone
spec:
containers:
volumeMounts:
- mountPath: /var/lib/config-data/tls/certs/internal.crt
name: internal-tls-certs
readOnly: true
subPath: tls.crt
- mountPath: /var/lib/config-data/tls/private/internal.key
name: internal-tls-certs
readOnly: true
subPath: tls.key
- mountPath: /var/lib/config-data/tls/certs/public.crt
name: public-tls-certs
readOnly: true
subPath: tls.crt
- mountPath: /var/lib/config-data/tls/private/public.key
name: public-tls-certs
readOnly: true
subPath: tls.key
- mountPath: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
name: combined-ca-bundle
readOnly: true
name: cert-public-svc
---
apiVersion: v1
kind: Secret
metadata:
name: combined-ca-bundle
63 changes: 63 additions & 0 deletions tests/kuttl/tests/placement_deploy_tls/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: placement.openstack.org/v1beta1
kind: PlacementAPI
metadata:
finalizers:
- PlacementAPI
name: placement
spec:
customServiceConfig: |
[DEFAULT]
debug = true
databaseInstance: openstack
databaseUser: placement
debug:
dbSync: false
service: false
passwordSelectors:
database: PlacementDatabasePassword
service: PlacementPassword
preserveJobs: false
replicas: 1
secret: osp-secret
serviceUser: placement
tls:
api:
internal:
secretName: cert-internal-svc
public:
secretName: cert-public-svc
caBundleSecretName: combined-ca-bundle
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: placement
spec:
replicas: 1
template:
metadata:
labels:
service: placement
spec:
containers:
volumeMounts:
- mountPath: /var/lib/config-data/tls/certs
name: internal-tls-certs
readOnly: true
subPath: tls.crt
- mountPath: /var/lib/config-data/tls/private
name: internal-tls-certs
readOnly: true
subPath: tls.key
- mountPath: /var/lib/config-data/tls/certs
name: public-tls-certs
readOnly: true
subPath: tls.crt
- mountPath: /var/lib/config-data/tls/private
name: public-tls-certs
readOnly: true
subPath: tls.key
- mountPath: /etc/pki/ca-trust/extracted/pem
name: combined-ca-bundle
readOnly: true
subPath: tls-ca-bundle.pem

0 comments on commit faceda0

Please sign in to comment.