Skip to content

Commit f261d71

Browse files
authored
Saasruntime autogen release (#15061)
1 parent 53b4fe1 commit f261d71

File tree

3 files changed

+422
-0
lines changed

3 files changed

+422
-0
lines changed
Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
# Copyright 2024 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
---
15+
name: Release
16+
description: A version to be propagated and deployed to Units. It points to a specific version of a Blueprint that can be applied to Units, for example, via a Rollout.
17+
base_url: projects/{{project}}/locations/{{location}}/releases
18+
update_mask: true
19+
self_link: projects/{{project}}/locations/{{location}}/releases/{{release_id}}
20+
create_url: projects/{{project}}/locations/{{location}}/releases?releaseId={{release_id}}
21+
update_verb: PATCH
22+
id_format: projects/{{project}}/locations/{{location}}/releases/{{release_id}}
23+
import_format:
24+
- projects/{{project}}/locations/{{location}}/releases/{{release_id}}
25+
min_version: beta
26+
examples:
27+
- name: saas_runtime_release_basic
28+
primary_resource_id: "example"
29+
min_version: "beta"
30+
vars:
31+
saas_name: example-saas
32+
unitkind_name: example-unitkind
33+
release_name: example-release
34+
previous_release_name: previous-release
35+
test_env_vars:
36+
project: "PROJECT_NAME"
37+
bootstrap_iam:
38+
- member: "serviceAccount:service-{project_number}@gcp-sa-saasservicemgmt.iam.gserviceaccount.com"
39+
role: "roles/saasservicemgmt.serviceAgent"
40+
autogen_async: false
41+
autogen_status: UmVsZWFzZQ==
42+
parameters:
43+
- name: location
44+
type: String
45+
description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.
46+
immutable: true
47+
url_param_only: true
48+
required: true
49+
- name: releaseId
50+
type: String
51+
description: The ID value for the new release.
52+
immutable: true
53+
url_param_only: true
54+
required: true
55+
properties:
56+
- name: annotations
57+
type: KeyValueAnnotations
58+
description: |-
59+
Annotations is an unstructured key-value map stored with a resource that
60+
may be set by external tools to store and retrieve arbitrary metadata.
61+
They are not queryable and should be preserved when modifying objects.
62+
63+
More info: https://kubernetes.io/docs/user-guide/annotations
64+
- name: blueprint
65+
type: NestedObject
66+
description: |-
67+
Blueprints are OCI Images that contain all of the artifacts needed to
68+
provision a unit. Metadata such as, type of the engine used to actuate the
69+
blueprint (e.g. terraform, helm etc) and version will come from the image
70+
manifest. If the hostname is omitted, it will be assumed to be the regional
71+
path to Artifact Registry (eg. us-east1-docker.pkg.dev).
72+
properties:
73+
- name: engine
74+
type: String
75+
description: Type of the engine used to actuate the blueprint. e.g. terraform, helm etc.
76+
output: true
77+
- name: package
78+
type: String
79+
description: |-
80+
URI to a blueprint used by the Unit (required unless unitKind or release is
81+
set).
82+
immutable: true
83+
- name: version
84+
type: String
85+
description: Version metadata if present on the blueprint.
86+
output: true
87+
- name: createTime
88+
type: String
89+
description: The timestamp when the resource was created.
90+
output: true
91+
- name: etag
92+
type: String
93+
description: |-
94+
An opaque value that uniquely identifies a version or
95+
generation of a resource. It can be used to confirm that the client
96+
and server agree on the ordering of a resource being written.
97+
output: true
98+
- name: inputVariableDefaults
99+
type: Array
100+
description: Mapping of input variables to default values. Maximum 100
101+
item_type:
102+
type: NestedObject
103+
properties:
104+
- name: type
105+
type: Enum
106+
description: "Name of a supported variable type. Supported types are STRING, INT, BOOL."
107+
enum_values:
108+
- "TYPE_UNSPECIFIED"
109+
- "STRING"
110+
- "INT"
111+
- "BOOL"
112+
immutable: true
113+
- name: value
114+
type: String
115+
description: String encoded value for the variable.
116+
- name: variable
117+
type: String
118+
description: Name of the variable from actuation configs.
119+
immutable: true
120+
required: true
121+
- name: inputVariables
122+
type: Array
123+
description: |-
124+
List of input variables declared on the blueprint and can be present with
125+
their values on the unit spec
126+
output: true
127+
item_type:
128+
type: NestedObject
129+
properties:
130+
- name: type
131+
type: Enum
132+
description: "Name of a supported variable type. Supported types are STRING, INT, BOOL."
133+
enum_values:
134+
- "TYPE_UNSPECIFIED"
135+
- "STRING"
136+
- "INT"
137+
- "BOOL"
138+
immutable: true
139+
- name: value
140+
type: String
141+
description: String encoded value for the variable.
142+
- name: variable
143+
type: String
144+
description: Name of the variable from actuation configs.
145+
immutable: true
146+
required: true
147+
- name: labels
148+
type: KeyValueLabels
149+
description: |-
150+
The labels on the resource, which can be used for categorization.
151+
similar to Kubernetes resource labels.
152+
- name: name
153+
type: String
154+
description: |-
155+
Identifier. The resource name (full URI of the resource) following the standard naming
156+
scheme:
157+
158+
"projects/{project}/locations/{location}/releases/{release}"
159+
output: true
160+
- name: outputVariables
161+
type: Array
162+
description: |-
163+
List of output variables declared on the blueprint and can be present with
164+
their values on the unit status
165+
output: true
166+
item_type:
167+
type: NestedObject
168+
properties:
169+
- name: type
170+
type: Enum
171+
description: "Name of a supported variable type. Supported types are STRING, INT, BOOL."
172+
enum_values:
173+
- "TYPE_UNSPECIFIED"
174+
- "STRING"
175+
- "INT"
176+
- "BOOL"
177+
immutable: true
178+
- name: value
179+
type: String
180+
description: String encoded value for the variable.
181+
- name: variable
182+
type: String
183+
description: Name of the variable from actuation configs.
184+
immutable: true
185+
required: true
186+
- name: releaseRequirements
187+
type: NestedObject
188+
description: Set of requirements to be fulfilled on the Unit when using this Release.
189+
properties:
190+
- name: upgradeableFromReleases
191+
type: Array
192+
description: |-
193+
A list of releases from which a unit can be upgraded to this one
194+
(optional). If left empty no constraints will be applied. When provided,
195+
unit upgrade requests to this release will check and enforce this
196+
constraint.
197+
item_type:
198+
type: String
199+
- name: uid
200+
type: String
201+
description: |-
202+
The unique identifier of the resource. UID is unique in the time
203+
and space for this resource within the scope of the service. It is
204+
typically generated by the server on successful creation of a resource
205+
and must not be changed. UID is used to uniquely identify resources
206+
with resource name reuses. This should be a UUID4.
207+
output: true
208+
- name: unitKind
209+
type: String
210+
description: |-
211+
Reference to the UnitKind this Release corresponds to (required and
212+
immutable once created).
213+
immutable: true
214+
required: true
215+
- name: updateTime
216+
type: String
217+
description: |-
218+
The timestamp when the resource was last updated. Any
219+
change to the resource made by users must refresh this value.
220+
Changes to a resource made by the service should refresh this value.
221+
output: true
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
resource "google_saas_runtime_saas" "example_saas" {
2+
provider = google-beta
3+
saas_id = "{{index $.Vars "saas_name"}}"
4+
location = "global"
5+
6+
locations {
7+
name = "us-central1"
8+
}
9+
}
10+
11+
resource "google_saas_runtime_unit_kind" "example_unitkind" {
12+
provider = google-beta
13+
location = "global"
14+
unit_kind_id = "{{index $.Vars "unitkind_name"}}"
15+
saas = google_saas_runtime_saas.example_saas.id
16+
}
17+
18+
resource "google_saas_runtime_release" "example_previous" {
19+
provider = google-beta
20+
location = "global"
21+
release_id = "{{index $.Vars "previous_release_name"}}"
22+
unit_kind = google_saas_runtime_unit_kind.example_unitkind.id
23+
blueprint {
24+
package = "us-central1-docker.pkg.dev/ci-test-project-188019/test-repo/tf-test-easysaas-alpha-image@sha256:7992fdbaeaf998ecd31a7f937bb26e38a781ecf49b24857a6176c1e9bfc299ee"
25+
}
26+
}
27+
28+
resource "google_saas_runtime_release" "{{$.PrimaryResourceId}}" {
29+
provider = google-beta
30+
location = "global"
31+
release_id = "{{index $.Vars "release_name"}}"
32+
unit_kind = google_saas_runtime_unit_kind.example_unitkind.id
33+
blueprint {
34+
package = "us-central1-docker.pkg.dev/ci-test-project-188019/test-repo/tf-test-easysaas-beta-image@sha256:7bba0fa85b2956df7768f7b32e715b6fe11f4f4193e2a70a35bf3f286a6cdf9e"
35+
}
36+
input_variable_defaults {
37+
variable = "name"
38+
value = "test"
39+
type = "STRING"
40+
}
41+
}

0 commit comments

Comments
 (0)