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 コードとしてのポリシー

第9章 jsPolicyとKubernetes

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

第1章では、要因や基準に基づいてPaCソリューションを選択するという考え方を紹介し、PaC選択に役立つスコアカードを紹介した。そのスコアカードの最初の3つの選択基準は、組織との連携に使われる。この章では、ポリシー言語などのソリューションの基礎となるテクノロジーを、組織の能力、戦略、標準に適合させることに焦点を当てる。新技術を組織能力との連携に合わせることで、新しいソリューションがもたらすかもしれないマイナスの混乱を最小限に抑えることができる。

jsPolicyはJavaScriptを活用し、Kubernetesポリシーを記述することで、理解しやすく保守しやすい、効果的なKubernetesポリシーを実現する。それが、本書でjsPolicyについて書くことにした理由だ。JavaScriptはどこにでもある。確かに、ウェブブラウザで始まり、今でもウェブユーザ体験の不可欠な一部だが、Node.jsのようにサーバ上でも動作する。

JavaScriptと、TypeScriptのようなJavaScriptにコンパイルまたはトランスパイルする言語は、さまざまな業界の多くの組織で使われている。私は20年以上前にJavaScriptを使い始めたが、今でも必要なときに簡単に手に取ることができる。そのような共通の知識と経験を活用するPaCソリューションを選択することで、組織は新しい言語構文の学習曲線を避けることができる。さらに、険しい学習曲線を避けることができれば、より生産的で迅速な作業が可能になる。これが、Loft Labsによって導入され、現在もサポートされているプロジェクト、jsPolicyの約束だ。以下のリンクは、、jsPolicyについてより多くの情報を得るのに役立つ:

jsPolicyは、本書で初めて、非常によく知られたプログラミング言語であるJavaScriptをネイティブポリシー言語として使用したPaCソリューションである。この章では、これまでのKubernetes PaCソリューションと同様にjsPolicyの概要を説明しつつ、jsPolicy特有の点を指摘する。

jsPolicyはまた、GoogleのオープンソースJavaScriptとWebAssemblyエンジンであるV8 JavaScriptエンジンを使用している。 V8エンジンはC++で書かれており、Chromeのようなウェブブラウザや、CouchbaseのようなJSONベースのNoSQLデータベースでのパフォーマンスを向上させるために高度に最適化されている。

さっそく、Kubernetes 1.26にjsPolicyをインストールし、minikubeで実行してみよう。

インストール

jsPolicyを使い始めるために、私はjsPolicyクイックスタートガイドに従った。前の章でやったように、Makefileで使えるようにjsPolicyコマンドをShellスクリプトでラップし、DevOps自動化を簡単にした。 以下のスクリプトはjsPolicyをインストールする:

#!/usr/bin/env bash
# error handling
set -e
trap 'catch ...
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