Menu Close
4.8.2.2. 사용자 정의 바인딩 데이터 구성
애플리케이션 개발자는 다음과 같은 상황에서 사용자 정의 바인딩 데이터를 작성할 수 있습니다.
- 백업 서비스는 바인딩 데이터를 노출하지 않습니다.
- 노출된 값은 워크로드에서 예상한 대로 필요한 형식으로 사용할 수 없습니다.
예를 들어 지원 서비스 CR에서 호스트, 포트 및 데이터베이스 사용자를 바인딩 데이터로 노출하지만 워크로드에서 바인딩 데이터를 연결 문자열로 사용해야 하는 경우를 고려해 보십시오. 백업 서비스를 나타내는 Kubernetes 리소스에서 속성을 사용하여 사용자 지정 바인딩 데이터를 구성할 수 있습니다.
예제
apiVersion: binding.operators.coreos.com/v1alpha1 kind: ServiceBinding metadata: name: spring-petclinic-rest namespace: my-postgresql spec: services: - group: postgres-operator.crunchydata.com version: v1beta1 kind: PostgresCluster name: hippo 1 id: postgresDB 2 - group: "" version: v1 kind: Secret name: hippo-pguser-hippo id: postgresSecret application: name: spring-petclinic-rest group: apps version: v1 resource: deployments mappings: ## From the database service - name: JDBC_URL value: 'jdbc:postgresql://{{ .postgresDB.metadata.annotations.proxy }}:{{ .postgresDB.spec.port }}/{{ .postgresDB.metadata.name }}' ## From both the services! - name: CREDENTIALS value: '{{ .postgresDB.metadata.name }}{{ translationService.postgresSecret.data.password }}' ## Generate JSON - name: DB_JSON 3 value: {{ json .postgresDB.status }} 4