Proposal: Configuration as resource
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 静か
- 技術スタック
- yaml
調査の方向性
この issue ではファイルやテストが指定されていません。まず、設定ドキュメントのリソース検出と関連する #611 の提案を確認し、その後、既存の dsc config resolve の作業を追ってください。完了とするには、再利用可能なドキュメント、パラメーター処理、検出とバージョニング、およびリソース展開について合意された設計が必要です。
索引モデルが issue の本文から書いたものです。
説明
Summary of the new feature / enhancement
As an infrastructure engineer,
I want to define a reusable configuration document that my coworkers can specify like a resource in their configuration documents,
So that we can provide an abstraction over a subset of configuration for readability, composability, and maintainability.
This feature would enable similar functionality for DSC as Puppet defined types, enabling users to define reusable "resources" in the form of a configuration document. This would let a user combine several related resource instances into a single definition that can be parameterized and used in different contexts.
In configuration management, users often find themselves reusing a few low-level resources repeatedly for different subsets of configuration. For example, ensuring a specific version of a package is installed, setting the service for that package, and providing some optional configuration overrides for it.
Proposed technical implementation details (optional)
We could extend the definition for a configuration document to indicate that the document is meant to be reusable as a resource. When a configuration document is used as a resource, it's subject to the normal semantics for discovery, versioning, and so on.
The following snippet shows an example of a hypothetical configuration document as a resource. The field names are placeholders for clarity.
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
manifest:
type: TailspinToys/Service
description: Installs and configures the TSToy service on Windows machines.
version: 1.2.3
author: TailspinToys
tags:
- tstoy
- Windows
parameters:
version:
description: Specifies the version of TSToy to ensure is installed.
type: string
defaultValue: "1.2.3"
packageSource:
description: Specifies the source from which to install the TSToy package.
type: string
defaultValue: winget
updateAutomatically:
description: Indicates whether TSToy should check for updates when it starts.
type: bool
defaultValue: true
updateFrequency:
description: Specifies how often TSToy should check for updates.
type: string
allowedValues:
- daily
- weekly
- monthly
defaultValue: daily
directive:
resourceDiscovery: duringDeployment
variables:
frequency:
daily: 1
weekly: 7
monthly: 30
resources:
- name: Install TSToy
type: Microsoft.WinGet/Package
properties:
version: "[parameters('version')]"
id: tstoy
source: "[parameters('packageSource')]"
- name: TSToy machine settings
type: TailspinToys.Service/Settings
properties:
scope: machine
updateAutomatically: "[parameters('updateAutomatically')]"
updateFrequency: >-
[tryGet(
variables('frequency'),
parameters('updateFrequency')
)]
dependsOn:
- "[resourceId('Microsoft.WinGet/Package','Install TSToy')]"
- name: Enable TSToy service
type: Microsoft.Windows/Service
properties:
name: tstoy
state: running
startMode: automatic
dependsOn:
- "[resourceId('TailspinToys.Service/Settings','TSToy machine settings')]"
In this example, the configuration-document-as-resource metadata is placed under the manifest field. Minimally, users need to give the document a fully qualified type name and version.
While this example is a little contrived, this resource uses a mix of built-in resources (Microsoft.Windows/Service), other public resources (Microsoft.WinGet/Package), and a package published by the same author (TailspinToys.Service/Settings, which is "actually" installed as part of the package). It shows how you can take a relatively complex set of resources to surface a neater resource surface for end users. The alternative option for people would be to develop a resource that handles all of these components together, but that's more fragile and many users won't want to fully author a resource to compose configuration at this relatively low level.
The following snippet shows an instance of this configuration-document resource in an actual configuration:
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Setup TSToy
type: TailspinToys/Service
properties:
updateAutomatically: true
updateFrequency: weekly
Considerations
- We can't perfectly replicate a resource instance schema from the parameter definitions - might be useful to support a
schemafield that applies to the parameters (either in themanifestfield or per-parameter) to clarify validation requirements. In the example above, theversionproperty is just a string that defaults to1.0.0. More correctly it should be a semantic version, but that isn't representable in the current data model. - Unless we add a field to enumerate operations, we have to infer available operations by inspecting the resources defined in the configuration.
- There are further potential complications, especially around using adapted resources, but I think they are resolvable.
- Enabling resources to be developed this way raises the importance of a
dsc config resolvecommand that "expands" the node graph to show the full set of resources that will be applied. - This proposal in some ways mirrors #611, though it's more limited - extendable resources enables you to do relatively complex processing and then hand off all or some of the actual system-modifying logic to another resource. In this model, you're limited to what you can express in a configuration document. I think this proposal still covers numerous use cases.
- 主要言語
- Rust
- スター
- 536
- フォーク
- 76
- 平均マージ
- 1日 20時間
- マージ済み PR(30日)
- 15
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PowerShell/DSC のほかの issue
-
"apt install dsc" will install the preview release instead of stable対応中かも @SteveL-MSFT が今日担当しました。 オープンIssue-Bug Need-Review
PowerShell/DSC#1746 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Issue-Enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
PowerShell/DSC#1737 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
PowerShell/DSC#1736 ·
メンテナーはふだん 1 日以内に返信
-
`directives.version` is checked against dsc-lib's crate version (3.2.0), not the running dsc version対応中かも @michaeltlombardi が 4 日前に担当しました。 オープンIssue-Bug
難易度 3/5 半日 初心者へのやさしさ 74/100
PowerShell/DSC#1735 · コメント 1 件 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Make it impossible to accidentally define a nonfunctional secret extension対応中かも @Gijsreyn が 1 日前に担当しました。 オープンIssue-Enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
PowerShell/DSC#1729 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
[Feature]: [P3] engine-rs: the package source hash should ignore line endings and untracked filesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
maniator/verticopolis#880 ·
メンテナーはふだん 1 日以内に返信
-
IO.get_env on Node truncates names at embedded NUL対応中かも @Yi-111-a が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
HigherOrderCO/Bend#1449 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信