Skip to Content
コードとしてのポリシー
book

コードとしてのポリシー

by Jimmy Ray
March 2025
Intermediate to advanced
556 pages
9h 13m
Japanese
O'Reilly Media, Inc.
Audio summary available
Content preview from コードとしてのポリシー

第6章. MagTapeとKubernetes

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

この章では、OPAとRegoに支えられたT-Mobile発のOSS PaCプロジェクト、MagTapeに焦点を当てる。MagTapeはOPAをラップし拡張している。デザインパターンの文脈では、MagTapeはDecoratorデザインパターンを適用し、基礎となるOPAの実装を変更することなくOPAに追加機能を与えている。

MagTapeの拡張機能の目的は、Webhooksを介してSlackに統合する通知レイヤーを含むビジネスワークフローを追加することだ。 OPAのデコレーターorラッパーとして、MagTapeはプロキシのようにKubernetes APIサーバとOPAサービスの間で演算子を動作させる。MagTapeは、OPAサービス統合のためにinitコンテナを使って間接レイヤーを構成する。

プロジェクトのインサイトによると、マグテープ・プロジェクトへの貢献のほとんどは2020年に行われた。2021年と2022年にもいくつかあったが、プロジェクトはあまり活発ではないようだ。このことは、MagTapeインストールが現在使用するように設定されているOPAとkube-mgmtのバージョンが比較的古いことからもわかる。とはいえ、本書でMagTapeを取り上げたのは、KubernetesでOPAを使用するための興味深いアイデアやベストプラクティスを公開するためだ。それではさっそく、MagTapeがどのようにインストールされ、設定されるのかを探ってみよう。

MagTapeのインストールとアンインストール

MagTapeは簡単にインストールでき、 以下のインストールYAMLファイルを使ってアンインストールできる:

# Download install YAML
$ curl -O \
https://raw.githubusercontent.com/tmobile/magtape/v2.4.0/deploy/install.yaml 

MagTapeのインストールとアンインストールの手順はプロジェクトのREADME.mdで発見できるが、私はインストール・マニフェストをダウンロードし、自分のニーズに合わせて修正することにした。

MagTapeは古いプロジェクトで、最後のの更新は2年以上前である。第1章で述べたPaCソリューションの選択基準を踏まえると、これは読者にとって即座に赤信号となるはずであり、私もそう思う。 実際、Docker Hubから最新のMagTapeコンテナを取り出した後、docker scout quickviewを実行して、この古いコンテナ・イメージに含まれるCVEについて調べてみた。 以下の出力には驚かなかった:

 # Docker scout quickview of MagTape container image $ docker scout quickview tmobile/magtape:v2.4.0 ✓ Image stored for indexing ✓ Indexed 93 packages Target │ tmobile/magtape:v2.4.0 │ 1C 33H 20M 1L digest │ e545b933cb3c │ Base image │ python:3-alpine │ 1C 9H 4M 0L Refreshed ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

クラウドアプリケーションアーキテクチャパターン

クラウドアプリケーションアーキテクチャパターン

Kyle Brown, Bobby Woolf, Joseph Yoder
初めてのGraphQL ―Webサービスを作って学ぶ新世代API

初めてのGraphQL ―Webサービスを作って学ぶ新世代API

Eve Porcello, Alex Banks, 尾崎 沙耶, あんどうやすし

Publisher Resources

ISBN: 9798341627093