The Automation Broker works in conjunction with the Kubernetes Service Catalog to make services and applications easily deployable. An end user selects a service to be provisioned, selects a "plan" that describes the level of service (small, large, paid, free, persistent, ephemeral, etc), and then provides any required parameters. In this scenario, Helm charts can be utilized in two possible ways.
- The Automation Broker's "helm registry adapter" can inspect a chart repository and make each discovered chart available as a service class. The chart's
values.yaml
file is made available as a single parameter for a single default plan. - The tool
helm2bundle
creates a Service Bundle image that includes a specific chart. The image can be modified like any service bundle, including changes to metadata such as those inapb.yml
.
This post explores how to use Ansible Automation with the latter option to extend the behavior of a helm bundle.
Terms
service bundle - a container image that represents a service class's metadata and behavior.
helm bundle - a service bundle that contains a helm chart.
APB - aka Ansible Playbook bundle, a service bundle that uses Ansible Automation.
Automate Chart Input
Helm charts, which take input as a free-form yaml file, can take advantage of Ansible Automation by being included in a helm bundle that is based on the helm-ansible-base
image.
For example, the stable/redis
chart has a setting in its values.yml
that always needs to be changed in order to run in OpenShift. These are the steps to set that automatically based on Ansible facts.
Make the helm bundle
$ helm fetch stable/redis
$ helm2bundle redis-1.1.12.tar.gz
Create overrides template
The helm-ansible-base
image knows to look for a file called overrides.yml.j2
. If found, it gets rendered using ansible facts and then passed into helm as a settings file. It should be a subset of the values that are settable for the chart, as described in the chart's values.yaml
file.
Ours should look like this:
---
{% set secenabled = false if (cluster == "openshift") else true %}
## Pod Security Context
securityContext:
enabled: {{ secenabled }}
Change the Dockerfile
Set the base image in the Dockerfile
to helm-ansible-base
, and add the overrides template file.
FROM ansibleplaybookbundle/helm-ansible-base
LABEL "com.redhat.apb.spec"=""
COPY redis-1.1.12.tgz /opt/chart.tgz
COPY overrides.yml.j2 /opt/overrides.yml.j2
ENTRYPOINT ["entrypoint.sh"]
Summary
If you build and use that Helm Bundle to provision Redis, it will create a new fact based on the value of an existing fact, and then use the new fact to render a helm settings file. Ansible made it easy for us to dynamically configure this setting. While this example is relatively trivial, the same technique can be employed to do much more sophisticated configuration.
In the next blog post, we will use a similar technique to add rich parameters to a helm bundle, so that the user input experience is easier than editing yaml.
저자 소개
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
오리지널 쇼
엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리
제품
- Red Hat Enterprise Linux
- Red Hat OpenShift Enterprise
- Red Hat Ansible Automation Platform
- 클라우드 서비스
- 모든 제품 보기
툴
체험, 구매 & 영업
커뮤니케이션
Red Hat 소개
Red Hat은 Linux, 클라우드, 컨테이너, 쿠버네티스 등을 포함한 글로벌 엔터프라이즈 오픈소스 솔루션 공급업체입니다. Red Hat은 코어 데이터센터에서 네트워크 엣지에 이르기까지 다양한 플랫폼과 환경에서 기업의 업무 편의성을 높여 주는 강화된 기능의 솔루션을 제공합니다.