Skip to content

Commit 7d29b46

Browse files
authored
Merge pull request #199 from ritazh/bump-yaml-0.0.10
Update crd, yaml, chart for v0.0.10
2 parents af21863 + 93ac593 commit 7d29b46

15 files changed

+279
-20
lines changed

README.md

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ The Secrets Store CSI driver `secrets-store.csi.k8s.io` allows Kubernetes to mou
1515
- Supports multiple secrets stores as providers. Multiple providers can run in the same cluster simultaneously.
1616
- Supports pod portability with the SecretProviderClass CRD
1717
- Supports windows containers (Kubernetes version v1.18+)
18+
- Supports sync with Kubernetes Secrets (Secrets Store CSI Driver v0.0.10+)
1819

1920
#### Table of Contents
2021

2122
- [How It Works](#how-it-works)
2223
- [Demo](#demo)
2324
- [Usage](#usage)
2425
- [Providers](#providers)
25-
- [Azure Key Vault Provider](https://github.com/Azure/secrets-store-csi-driver-provider-azure) - Supports linux and windows
26-
- [HashiCorp Vault Provider](https://github.com/hashicorp/secrets-store-csi-driver-provider-vault) - Supports linux
27-
- [Adding a New Provider via the Provider Interface](#adding-a-new-provider-via-the-provider-interface)
26+
- [Azure Key Vault Provider](https://github.com/Azure/secrets-store-csi-driver-provider-azure) - Supports Linux and Windows
27+
- [HashiCorp Vault Provider](https://github.com/hashicorp/secrets-store-csi-driver-provider-vault) - Supports Linux
28+
- [Adding a New Provider via the Provider Interface](#criteria-for-supported-providers)
2829
- [Testing](#testing)
2930
- [Unit Tests](#unit-tests)
3031
- [End-to-end Tests](#end-to-end-tests)
@@ -121,6 +122,91 @@ Select a provider from the following list, then follow the installation steps fo
121122
- [Azure Provider](https://github.com/Azure/secrets-store-csi-driver-provider-azure#usage)
122123
- [Vault Provider](https://github.com/hashicorp/secrets-store-csi-driver-provider-vault)
123124

125+
### Create your own SecretProviderClass Object
126+
127+
To use the Secrets Store CSI driver, create a `SecretProviderClass` custom resource to provide driver configurations and provider-specific parameters to the CSI driver.
128+
129+
A `SecretProviderClass` custom resource should have the following components:
130+
```yaml
131+
apiVersion: secrets-store.csi.x-k8s.io/v1alpha1
132+
kind: SecretProviderClass
133+
metadata:
134+
name: my-provider
135+
spec:
136+
provider: vault # accepted provider options: azure or vault
137+
parameters: # provider-specific parameters
138+
```
139+
140+
Here is a sample [`SecretProviderClass` custom resource](https://github.com/kubernetes-sigs/secrets-store-csi-driver/blob/master/test/bats/tests/vault_v1alpha1_secretproviderclass.yaml)
141+
142+
### Update your Deployment Yaml
143+
144+
To ensure your application is using the Secrets Store CSI driver, update your deployment yaml to use the `secrets-store.csi.k8s.io` driver and reference the `SecretProviderClass` resource created in the previous step.
145+
146+
```yaml
147+
volumes:
148+
- name: secrets-store-inline
149+
csi:
150+
driver: secrets-store.csi.k8s.io
151+
readOnly: true
152+
volumeAttributes:
153+
secretProviderClass: "my-provider"
154+
```
155+
156+
Here is a sample [deployment yaml](https://github.com/kubernetes-sigs/secrets-store-csi-driver/blob/master/test/bats/tests/nginx-pod-vault-inline-volume-secretproviderclass.yaml) using the Secrets Store CSI driver.
157+
158+
### Secret Content is Mounted on Pod Start
159+
On pod start and restart, the driver will call the provider binary to retrieve the secret content from the external Secrets Store you have specified in the `SecretProviderClass` custom resource. Then the content will be mounted to the container's file system.
160+
161+
To validate, once the pod is started, you should see the new mounted content at the volume path specified in your deployment yaml.
162+
163+
```bash
164+
kubectl exec -it nginx-secrets-store-inline ls /mnt/secrets-store/
165+
foo
166+
```
167+
168+
### [OPTIONAL] Sync with Kubernetes Secrets
169+
170+
In some cases, you may want to create a Kubernetes Secret to mirror the mounted content. Use the optional `secretObjects` field to define the desired state of the synced Kubernetes secret objects.
171+
172+
A `SecretProviderClass` custom resource should have the following components:
173+
```yaml
174+
apiVersion: secrets-store.csi.x-k8s.io/v1alpha1
175+
kind: SecretProviderClass
176+
metadata:
177+
name: my-provider
178+
spec:
179+
provider: vault # accepted provider options: azure or vault
180+
parameters: # provider-specific parameters
181+
secretObjects: # [OPTIONAL] SecretObject defines the desired state of synced K8s secret objects
182+
- data:
183+
- key: username # data field to populate
184+
objectName: foo1 # name of the object to sync
185+
secretName: foosecret # name of the Kubernetes Secret object
186+
type: Opaque # type of the Kubernetes Secret object e.g. Opaque, kubernetes.io/tls
187+
```
188+
> NOTE: Here is the list of [supported Kubernetes Secret types](https://github.com/kubernetes-sigs/secrets-store-csi-driver/blob/master/pkg/secrets-store/utils.go#L660-L675).
189+
190+
Here is a sample [`SecretProviderClass` custom resource](https://github.com/kubernetes-sigs/secrets-store-csi-driver/blob/master/test/bats/tests/vault_synck8s_v1alpha1_secretproviderclass.yaml) that syncs Kubernetes secrets.
191+
192+
### [OPTIONAL] Set ENV VAR
193+
194+
Once the secret is created, you may wish to set an ENV VAR in your deployment to reference the new Kubernetes secret.
195+
196+
```yaml
197+
spec:
198+
containers:
199+
- image: nginx
200+
name: nginx
201+
env:
202+
- name: SECRET_USERNAME
203+
valueFrom:
204+
secretKeyRef:
205+
name: foosecret
206+
key: username
207+
```
208+
Here is a sample [deployment yaml](https://github.com/kubernetes-sigs/secrets-store-csi-driver/blob/master/test/bats/tests/nginx-deployment-synck8s.yaml) that creates an ENV VAR from the synced Kubernetes secret.
209+
124210

125211
## Providers
126212

charts/index.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
apiVersion: v1
22
entries:
33
secrets-store-csi-driver:
4+
- apiVersion: v1
5+
appVersion: 0.0.10
6+
created: "2020-05-04T13:43:34.653627-07:00"
7+
description: A Helm chart to install the SecretsStore CSI Driver inside a Kubernetes
8+
cluster.
9+
digest: 9fae95e4611c9c120ed12505e735680b70ed133ea987fd32db05046cb45eda9e
10+
icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png
11+
kubeVersion: '>=1.15.0-0'
12+
maintainers:
13+
- email: ritazh@microsoft.com
14+
name: Rita Zhang
15+
name: secrets-store-csi-driver
16+
sources:
17+
- https://github.com/kubernetes-sigs/secrets-store-csi-driver
18+
urls:
19+
- https://raw.githubusercontent.com/kubernetes-sigs/secrets-store-csi-driver/master/charts/secrets-store-csi-driver-0.0.10.tgz
20+
version: 0.0.10
421
- apiVersion: v1
522
appVersion: 0.0.9
623
created: "2020-04-28T22:05:38.049737+01:00"
@@ -18,4 +35,4 @@ entries:
1835
urls:
1936
- https://raw.githubusercontent.com/kubernetes-sigs/secrets-store-csi-driver/master/charts/secrets-store-csi-driver-0.0.9.tgz
2037
version: 0.0.9
21-
generated: "2020-04-28T22:05:38.04544+01:00"
38+
generated: "2020-05-04T13:43:34.652813-07:00"
4.51 KB
Binary file not shown.

charts/secrets-store-csi-driver/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
name: secrets-store-csi-driver
3-
version: 0.0.9
4-
appVersion: 0.0.9
3+
version: 0.0.10
4+
appVersion: 0.0.10
55
kubeVersion: ">=1.15.0-0"
66
description: A Helm chart to install the SecretsStore CSI Driver inside a Kubernetes cluster.
77
icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png

charts/secrets-store-csi-driver/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ The following table lists the configurable parameters of the csi-secrets-store-p
2525
| `fullnameOverride` | String to fully override secrets-store-csi-driver.fullname template with a string | `""` |
2626
| `linux.image.repository` | Linux image repository | `docker.io/deislabs/secrets-store-csi` |
2727
| `linux.image.pullPolicy` | Linux image pull policy | `Always` |
28-
| `linux.image.tag` | Linux image tag | `v0.0.9` |
28+
| `linux.image.tag` | Linux image tag | `v0.0.10` |
2929
| `linux.enabled` | Install secrets store csi driver on linux nodes | true |
3030
| `windows.image.repository` | Windows image repository | `mcr.microsoft.com/k8s/csi/secrets-store/driver` |
3131
| `windows.image.pullPolicy` | Windows image pull policy | `IfNotPresent` |
32-
| `windows.image.tag` | Windows image tag | `v0.0.9` |
32+
| `windows.image.tag` | Windows image tag | `v0.0.10` |
3333
| `windows.enabled` | Install secrets store csi driver on windows nodes | false |
3434
| `logLevel.debug` | Enable debug logging | true |
3535
| `livenessProbe.port` | Liveness probe port | `9808` |

charts/secrets-store-csi-driver/templates/secrets-store.csi.x-k8s.io_secretproviderclasses.yaml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
apiVersion: apiextensions.k8s.io/v1beta1
44
kind: CustomResourceDefinition
55
metadata:
6+
annotations:
7+
controller-gen.kubebuilder.io/version: v0.2.4
8+
creationTimestamp: null
69
name: secretproviderclasses.secrets-store.csi.x-k8s.io
710
spec:
811
group: secrets-store.csi.x-k8s.io
@@ -11,7 +14,7 @@ spec:
1114
listKind: SecretProviderClassList
1215
plural: secretproviderclasses
1316
singular: secretproviderclass
14-
scope: ""
17+
scope: Namespaced
1518
validation:
1619
openAPIV3Schema:
1720
description: SecretProviderClass is the Schema for the secretproviderclasses
@@ -40,10 +43,51 @@ spec:
4043
provider:
4144
description: Configuration for provider name
4245
type: string
46+
secretObjects:
47+
items:
48+
description: SecretObject defines the desired state of synced K8s
49+
secret objects
50+
properties:
51+
data:
52+
items:
53+
description: SecretObjectData defines the desired state of synced
54+
K8s secret object data
55+
properties:
56+
key:
57+
description: data field to populate
58+
type: string
59+
objectName:
60+
description: name of the object to sync
61+
type: string
62+
type: object
63+
type: array
64+
secretName:
65+
description: name of the K8s secret object
66+
type: string
67+
type:
68+
description: type of K8s secret object
69+
type: string
70+
type: object
71+
type: array
4372
type: object
4473
status:
4574
description: SecretProviderClassStatus defines the observed state of SecretProviderClass
75+
properties:
76+
byPod:
77+
items:
78+
description: ByPodStatus defines the state of SecretProviderClass
79+
as seen by an individual controller
80+
properties:
81+
id:
82+
description: id of the pod that wrote the status
83+
type: string
84+
namespace:
85+
description: namespace of the pod that wrote the status
86+
type: string
87+
type: object
88+
type: array
4689
type: object
90+
type: object
4791
version: v1alpha1
4892
versions:
4993
- name: v1alpha1

charts/secrets-store-csi-driver/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ linux:
22
enabled: true
33
image:
44
repository: docker.io/deislabs/secrets-store-csi
5-
tag: v0.0.9
5+
tag: v0.0.10
66
pullPolicy: Always
77

88
windows:
99
enabled: false
1010
image:
1111
repository: mcr.microsoft.com/k8s/csi/secrets-store/driver
12-
tag: v0.0.9
12+
tag: v0.0.10
1313
pullPolicy: IfNotPresent
1414

1515
logLevel:

deploy/secrets-store-csi-driver-windows.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ spec:
4343
- name: registration-dir
4444
mountPath: C:\registration
4545
- name: secrets-store
46-
image: mcr.microsoft.com/k8s/csi/secrets-store/driver:v0.0.9
46+
image: mcr.microsoft.com/k8s/csi/secrets-store/driver:v0.0.10
4747
args:
4848
- "--debug=true"
4949
- "--endpoint=$(CSI_ENDPOINT)"

deploy/secrets-store-csi-driver.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spec:
4444
- name: registration-dir
4545
mountPath: /registration
4646
- name: secrets-store
47-
image: docker.io/deislabs/secrets-store-csi:v0.0.9
47+
image: docker.io/deislabs/secrets-store-csi:v0.0.10
4848
args:
4949
- "--debug=true"
5050
- "--endpoint=$(CSI_ENDPOINT)"

deploy/secrets-store.csi.x-k8s.io_secretproviderclasses.yaml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
apiVersion: apiextensions.k8s.io/v1beta1
44
kind: CustomResourceDefinition
55
metadata:
6+
annotations:
7+
controller-gen.kubebuilder.io/version: v0.2.4
8+
creationTimestamp: null
69
name: secretproviderclasses.secrets-store.csi.x-k8s.io
710
spec:
811
group: secrets-store.csi.x-k8s.io
@@ -11,7 +14,7 @@ spec:
1114
listKind: SecretProviderClassList
1215
plural: secretproviderclasses
1316
singular: secretproviderclass
14-
scope: ""
17+
scope: Namespaced
1518
validation:
1619
openAPIV3Schema:
1720
description: SecretProviderClass is the Schema for the secretproviderclasses
@@ -40,10 +43,51 @@ spec:
4043
provider:
4144
description: Configuration for provider name
4245
type: string
46+
secretObjects:
47+
items:
48+
description: SecretObject defines the desired state of synced K8s
49+
secret objects
50+
properties:
51+
data:
52+
items:
53+
description: SecretObjectData defines the desired state of synced
54+
K8s secret object data
55+
properties:
56+
key:
57+
description: data field to populate
58+
type: string
59+
objectName:
60+
description: name of the object to sync
61+
type: string
62+
type: object
63+
type: array
64+
secretName:
65+
description: name of the K8s secret object
66+
type: string
67+
type:
68+
description: type of K8s secret object
69+
type: string
70+
type: object
71+
type: array
4372
type: object
4473
status:
4574
description: SecretProviderClassStatus defines the observed state of SecretProviderClass
75+
properties:
76+
byPod:
77+
items:
78+
description: ByPodStatus defines the state of SecretProviderClass
79+
as seen by an individual controller
80+
properties:
81+
id:
82+
description: id of the pod that wrote the status
83+
type: string
84+
namespace:
85+
description: namespace of the pod that wrote the status
86+
type: string
87+
type: object
88+
type: array
4689
type: object
90+
type: object
4791
version: v1alpha1
4892
versions:
4993
- name: v1alpha1

pkg/secrets-store/secrets-store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type SecretsStore struct {
3636
}
3737

3838
var (
39-
vendorVersion = "0.0.9"
39+
vendorVersion = "0.0.10"
4040
)
4141

4242
// GetDriver returns a new secrets store driver

secretProviderClass/api/v1alpha1/secretproviderclass_types.go

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,44 @@ const (
1919

2020
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2121

22+
// SecretObjectData defines the desired state of synced K8s secret object data
23+
type SecretObjectData struct {
24+
// name of the object to sync
25+
ObjectName string `json:"objectName,omitempty"`
26+
// data field to populate
27+
Key string `json:"key,omitempty"`
28+
}
29+
30+
// SecretObject defines the desired state of synced K8s secret objects
31+
type SecretObject struct {
32+
// name of the K8s secret object
33+
SecretName string `json:"secretName,omitempty"`
34+
// type of K8s secret object
35+
Type string `json:"type,omitempty"`
36+
Data []*SecretObjectData `json:"data,omitempty"`
37+
}
38+
2239
// SecretProviderClassSpec defines the desired state of SecretProviderClass
2340
type SecretProviderClassSpec struct {
2441
// Configuration for provider name
2542
Provider Provider `json:"provider,omitempty"`
2643
// Configuration for specific provider
27-
Parameters map[string]string `json:"parameters,omitempty"`
44+
Parameters map[string]string `json:"parameters,omitempty"`
45+
SecretObjects []*SecretObject `json:"secretObjects,omitempty"`
46+
}
47+
48+
// ByPodStatus defines the state of SecretProviderClass as seen by
49+
// an individual controller
50+
type ByPodStatus struct {
51+
// id of the pod that wrote the status
52+
ID string `json:"id,omitempty"`
53+
// namespace of the pod that wrote the status
54+
Namespace string `json:"namespace,omitempty"`
2855
}
2956

3057
// SecretProviderClassStatus defines the observed state of SecretProviderClass
3158
type SecretProviderClassStatus struct {
59+
ByPod []*ByPodStatus `json:"byPod,omitempty"`
3260
}
3361

3462
// +kubebuilder:object:root=true

0 commit comments

Comments
 (0)