Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit 7d42ada

Browse files
authored
Merge pull request #93 from tsunamishaun/feat/agent-pool-name
Lookup Agent Pool ID By Name
2 parents f9a615f + 5bd0e65 commit 7d42ada

File tree

5 files changed

+108
-57
lines changed

5 files changed

+108
-57
lines changed

api/v1alpha1/workspace_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ type WorkspaceSpec struct {
141141
// Omit namespace prefix in workspace name
142142
// +optional
143143
OmitNamespacePrefix bool `json:"omitNamespacePrefix,omitempty"`
144+
// Specifies the agent pool name we wish to use.
145+
// +optional
146+
AgentPoolName string `json:"agentPoolName,omitempty"`
144147
}
145148

146149
// WorkspaceStatus defines the observed state of Workspace

config/crd/bases/app.terraform.io_workspaces.yaml

Lines changed: 24 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,10 @@ spec:
2222
description: Workspace is the Schema for the workspaces API
2323
properties:
2424
apiVersion:
25-
description: 'APIVersion defines the versioned schema of this representation
26-
of an object. Servers should convert recognized schemas to the latest
27-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
25+
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
2826
type: string
2927
kind:
30-
description: 'Kind is a string value representing the REST resource this
31-
object represents. Servers may infer this from the endpoint the client
32-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
28+
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
3329
type: string
3430
metadata:
3531
type: object
@@ -39,6 +35,9 @@ spec:
3935
agentPoolID:
4036
description: Specifies the agent pool ID we wish to use.
4137
type: string
38+
agentPoolName:
39+
description: Specifies the agent pool name we wish to use.
40+
type: string
4241
module:
4342
description: Module source and version to use
4443
nullable: true
@@ -135,22 +134,18 @@ spec:
135134
description: File path within operator pod to load workspace secrets
136135
type: string
137136
sshKeyID:
138-
description: SSH Key ID. This key must already exist in the TF Cloud
139-
organization. This can either be the user assigned name of the SSH
140-
Key, or the system assigned ID.
137+
description: SSH Key ID. This key must already exist in the TF Cloud organization. This can either be the user assigned name of the SSH Key, or the system assigned ID.
141138
type: string
142139
terraformVersion:
143-
description: Terraform version used for this workspace. The default
144-
is `latest`.
140+
description: Terraform version used for this workspace. The default is `latest`.
145141
type: string
146142
variables:
147143
description: Variables as inputs to module
148144
items:
149145
description: Variable denotes an input to the module
150146
properties:
151147
environmentVariable:
152-
description: EnvironmentVariable denotes if this variable should
153-
be created as environment variable
148+
description: EnvironmentVariable denotes if this variable should be created as environment variable
154149
type: boolean
155150
hcl:
156151
description: String input should be an HCL-formatted variable
@@ -159,15 +154,13 @@ spec:
159154
description: Variable name
160155
type: string
161156
sensitive:
162-
description: Variable is a secret and should be retrieved from
163-
file
157+
description: Variable is a secret and should be retrieved from file
164158
type: boolean
165159
value:
166160
description: Variable value
167161
type: string
168162
valueFrom:
169-
description: Source for the variable's value. Cannot be used if
170-
value is not empty.
163+
description: Source for the variable's value. Cannot be used if value is not empty.
171164
properties:
172165
configMapKeyRef:
173166
description: Selects a key of a ConfigMap.
@@ -176,49 +169,37 @@ spec:
176169
description: The key to select.
177170
type: string
178171
name:
179-
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
180-
TODO: Add other useful fields. apiVersion, kind, uid?'
172+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
181173
type: string
182174
optional:
183-
description: Specify whether the ConfigMap or its key
184-
must be defined
175+
description: Specify whether the ConfigMap or its key must be defined
185176
type: boolean
186177
required:
187178
- key
188179
type: object
189180
fieldRef:
190-
description: 'Selects a field of the pod: supports metadata.name,
191-
metadata.namespace, metadata.labels, metadata.annotations,
192-
spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP,
193-
status.podIPs.'
181+
description: 'Selects a field of the pod: supports metadata.name, metadata.namespace, metadata.labels, metadata.annotations, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.'
194182
properties:
195183
apiVersion:
196-
description: Version of the schema the FieldPath is written
197-
in terms of, defaults to "v1".
184+
description: Version of the schema the FieldPath is written in terms of, defaults to "v1".
198185
type: string
199186
fieldPath:
200-
description: Path of the field to select in the specified
201-
API version.
187+
description: Path of the field to select in the specified API version.
202188
type: string
203189
required:
204190
- fieldPath
205191
type: object
206192
resourceFieldRef:
207-
description: 'Selects a resource of the container: only resources
208-
limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage,
209-
requests.cpu, requests.memory and requests.ephemeral-storage)
210-
are currently supported.'
193+
description: 'Selects a resource of the container: only resources limits and requests (limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.'
211194
properties:
212195
containerName:
213-
description: 'Container name: required for volumes, optional
214-
for env vars'
196+
description: 'Container name: required for volumes, optional for env vars'
215197
type: string
216198
divisor:
217199
anyOf:
218200
- type: integer
219201
- type: string
220-
description: Specifies the output format of the exposed
221-
resources, defaults to "1"
202+
description: Specifies the output format of the exposed resources, defaults to "1"
222203
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
223204
x-kubernetes-int-or-string: true
224205
resource:
@@ -231,16 +212,13 @@ spec:
231212
description: Selects a key of a secret in the pod's namespace
232213
properties:
233214
key:
234-
description: The key of the secret to select from. Must
235-
be a valid secret key.
215+
description: The key of the secret to select from. Must be a valid secret key.
236216
type: string
237217
name:
238-
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
239-
TODO: Add other useful fields. apiVersion, kind, uid?'
218+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
240219
type: string
241220
optional:
242-
description: Specify whether the Secret or its key must
243-
be defined
221+
description: Specify whether the Secret or its key must be defined
244222
type: boolean
245223
required:
246224
- key
@@ -253,23 +231,20 @@ spec:
253231
type: object
254232
type: array
255233
vcs:
256-
description: Details of the VCS repository we want to connect to the
257-
workspace
234+
description: Details of the VCS repository we want to connect to the workspace
258235
nullable: true
259236
properties:
260237
branch:
261238
description: The repository branch to use
262239
type: string
263240
ingress_submodules:
264-
description: Whether submodules should be fetched when cloning the
265-
VCS repository (Defaults to false)
241+
description: Whether submodules should be fetched when cloning the VCS repository (Defaults to false)
266242
type: boolean
267243
repo_identifier:
268244
description: A reference to your VCS repository in the format org/repo
269245
type: string
270246
token_id:
271-
description: Token ID of the VCS Connection (OAuth Connection Token)
272-
to use https://www.terraform.io/docs/cloud/vcs
247+
description: Token ID of the VCS Connection (OAuth Connection Token) to use https://www.terraform.io/docs/cloud/vcs
273248
type: string
274249
required:
275250
- repo_identifier

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ require (
1515
k8s.io/apimachinery v0.18.6
1616
k8s.io/client-go v10.0.0+incompatible
1717
sigs.k8s.io/controller-runtime v0.6.3
18+
sigs.k8s.io/controller-tools v0.3.0 // indirect
1819
)
1920

2021
// Pinned to kubernetes-1.16.2

0 commit comments

Comments
 (0)