Skip to content

Commit 7cf1266

Browse files
committed
VEP 100: Introduce metaData and MetaDataSecretRef feild for adding custom medata to the cloud-init
Signed-off-by: olalekan odukoya <[email protected]>
1 parent 10313a4 commit 7cf1266

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# VEP #100: Introduce Custom Metadata to Cloud-init
2+
3+
## Release Signoff Checklist
4+
Items marked with (R) are required *prior to targeting to a milestone / release*.
5+
- [X] (R) Enhancement issue created, which links to VEP dir in [kubevirt/enhancements] (not the initial VEP PR)
6+
- [ ] (R) Target version is explicitly mentioned and approved
7+
- [ ] (R) Graduation criteria filled
8+
9+
## Overview
10+
This VEP proposes enhancing KubeVirt's cloud-init metadata support by enabling users to add custom metadata to cloud-init.
11+
This addresses missing functionality for users to be able to add custom values to the cloud-init metadata.
12+
13+
## Motivation
14+
KubeVirt's cloud-init support previously did not allow users to add custom values to the metadata.
15+
This prevented users from passing application-specific information to their VMs through cloud-init.
16+
Issue https://github.com/kubevirt/kubevirt/issues/15836 the motivation behind this VEP.
17+
18+
## Goals
19+
- Enable users to add custom metadata fields to cloud-init through the metaData field in both `NoCloud` and `ConfigDrive` configurations
20+
- Implement `MetaData` in the `CloudInitNoCloudSource` and `CloudInitConfigDriveSource` struct to allow users add custom metadata to the cloud-init
21+
- Implement `MetaDataSecretRef` in the `CloudInitNoCloudSource` and `CloudInitConfigDriveSource` struct to allow users to reference Kubernetes secrets containing custom metadata
22+
- Ensure custom metadata is properly merged with standard metadata fields (instance-id, local-hostname, instance-type, etc.) that KubeVirt automatically generates
23+
24+
## Non Goals
25+
26+
27+
## Definition of Users
28+
VM owners and workload developers who need to pass custom metadata to their virtual machines
29+
through cloud-init for application configuration, environment-specific settings, or runtime parameters.
30+
This includes developers deploying applications that require custom configuration data accessible via cloud-init metadata,
31+
such as environment variables, application settings, or deployment-specific parameters.
32+
Cluster administrators may be indirectly impacted as they need to understand the new
33+
metadata capabilities and potentially create secrets for users,
34+
but they are not the primary users of this functionality.
35+
36+
## User Stories
37+
- As a VM owner, I want to add custom metadata fields to my cloud-init configuration
38+
so that my applications can access application-specific configuration data.
39+
- As a VM owner, I want to reference Kubernetes secrets containing
40+
custom metadata so that I can securely pass sensitive configuration data to my VMs.
41+
42+
## Repos
43+
- kubevirt/kubevirt (core API)
44+
45+
## Design
46+
Enhance `CloudInitNoCloudSource` and `CloudInitConfigDriveSource` with `MetaData` field as `map[string]string `and `MetaDataSecretRef` for secret references.
47+
Secret resolution reads custom metadata and merges with standard fields.
48+
49+
## API Examples
50+
```yaml
51+
volumes:
52+
- name: cloudinitdisk
53+
cloudInitNoCloud:
54+
userData: |
55+
#cloud-config
56+
package_update: true
57+
metaData:
58+
app_name: "my-application"
59+
environment: "production"
60+
cost_center: "12345"
61+
```
62+
63+
```yaml
64+
volumes:
65+
- name: cloudinitdisk
66+
cloudInitNoCloud:
67+
userData: |
68+
#cloud-config
69+
package_update: true
70+
metaDataSecretRef:
71+
name: my-metadata-secret
72+
---
73+
apiVersion: v1
74+
kind: Secret
75+
metadata:
76+
name: my-metadata-secret
77+
type: Opaque
78+
stringData:
79+
metadata: |
80+
app_name: "my-application"
81+
environment: "production"
82+
cost_center: "12345"
83+
```
84+
85+
## Alternatives
86+
87+
## Scalability
88+
89+
## Update/Rollback Compatibility
90+
- New field is optional; existing VMIs remain unaffected.
91+
- On downgrade, projected volumes fall back to errors or no-op.
92+
## Functional Testing Approach
93+
- Unit tests: API validation, struct marshaling, metadata merging.
94+
- Integration tests: Deploy VM/VMI with custom metadata, verify metadata is accessible in guest.
95+
## Implementation History
96+
- October 17, 2024: Implementation completed and PR submitted.
97+
- October 19, 2024: VEP drafted (after reviewer feedback indicated VEP was required for API changes).
98+
## Graduation Requirements
99+
### Alpha
100+
- Custom metadata support implemented.
101+
- MetaData functionality complete.
102+
- MetaDataSecretRef functionality complete.
103+
### Beta
104+
- Full IRSA support.
105+
### GA
106+

0 commit comments

Comments
 (0)