Skip to content

Commit 8c4144d

Browse files
Fix cloud settings schema (#521)
1 parent 1edb64b commit 8c4144d

File tree

4 files changed

+126
-12
lines changed

4 files changed

+126
-12
lines changed

assets/src/generated/graphql.ts

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,16 @@ export type AwsCloudAttributes = {
299299
region?: InputMaybe<Scalars['String']['input']>;
300300
};
301301

302+
/** aws specific cloud configuration */
303+
export type AwsCloudSettings = {
304+
__typename?: 'AwsCloudSettings';
305+
region?: Maybe<Scalars['String']['output']>;
306+
};
307+
308+
export type AwsNodeCloudAttributes = {
309+
launchTemplateId?: InputMaybe<Scalars['String']['input']>;
310+
};
311+
302312
export type AwsSettingsAttributes = {
303313
accessKeyId: Scalars['String']['input'];
304314
secretAccessKey: Scalars['String']['input'];
@@ -311,6 +321,15 @@ export type AzureCloudAttributes = {
311321
subscriptionId?: InputMaybe<Scalars['String']['input']>;
312322
};
313323

324+
/** azure-specific cluster cloud configuration */
325+
export type AzureCloudSettings = {
326+
__typename?: 'AzureCloudSettings';
327+
location?: Maybe<Scalars['String']['output']>;
328+
network?: Maybe<Scalars['String']['output']>;
329+
resourceGroup?: Maybe<Scalars['String']['output']>;
330+
subscriptionId?: Maybe<Scalars['String']['output']>;
331+
};
332+
314333
export type AzureSettingsAttributes = {
315334
clientId: Scalars['ID']['input'];
316335
clientSecret: Scalars['String']['input'];
@@ -440,10 +459,12 @@ export type CloudProviderSettingsAttributes = {
440459
gcp?: InputMaybe<GcpSettingsAttributes>;
441460
};
442461

443-
/** cloud specific settings for a node pool */
462+
/** the cloud configuration for a cluster */
444463
export type CloudSettings = {
445464
__typename?: 'CloudSettings';
446-
aws?: Maybe<AwsCloud>;
465+
aws?: Maybe<AwsCloudSettings>;
466+
azure?: Maybe<AzureCloudSettings>;
467+
gcp?: Maybe<GcpCloudSettings>;
447468
};
448469

449470
export type CloudSettingsAttributes = {
@@ -504,6 +525,8 @@ export type Cluster = {
504525
service?: Maybe<ServiceDeployment>;
505526
/** any errors which might have occurred during the bootstrap process */
506527
serviceErrors?: Maybe<Array<Maybe<ServiceError>>>;
528+
/** the cloud settings for this cluster (for instance its aws region) */
529+
settings?: Maybe<CloudSettings>;
507530
/** the status of the cluster as seen from the CAPI operator, since some clusters can be provisioned without CAPI, this can be null */
508531
status?: Maybe<ClusterStatus>;
509532
/** key/value tags to filter clusters */
@@ -1128,6 +1151,14 @@ export type GcpCloudAttributes = {
11281151
region?: InputMaybe<Scalars['String']['input']>;
11291152
};
11301153

1154+
/** gcp specific cluster cloud configuration */
1155+
export type GcpCloudSettings = {
1156+
__typename?: 'GcpCloudSettings';
1157+
network?: Maybe<Scalars['String']['output']>;
1158+
project?: Maybe<Scalars['String']['output']>;
1159+
region?: Maybe<Scalars['String']['output']>;
1160+
};
1161+
11311162
export type GcpSettingsAttributes = {
11321163
applicationCredentials: Scalars['String']['input'];
11331164
};
@@ -1671,6 +1702,12 @@ export type Node = {
16711702
status: NodeStatus;
16721703
};
16731704

1705+
/** cloud specific settings for a node pool */
1706+
export type NodeCloudSettings = {
1707+
__typename?: 'NodeCloudSettings';
1708+
aws?: Maybe<AwsCloud>;
1709+
};
1710+
16741711
export type NodeCondition = {
16751712
__typename?: 'NodeCondition';
16761713
message?: Maybe<Scalars['String']['output']>;
@@ -1691,7 +1728,7 @@ export type NodeMetric = {
16911728
export type NodePool = {
16921729
__typename?: 'NodePool';
16931730
/** cloud specific settings for the node groups */
1694-
cloudSettings?: Maybe<CloudSettings>;
1731+
cloudSettings?: Maybe<NodeCloudSettings>;
16951732
/** internal id for this node pool */
16961733
id: Scalars['ID']['output'];
16971734
insertedAt?: Maybe<Scalars['DateTime']['output']>;
@@ -1713,7 +1750,7 @@ export type NodePool = {
17131750
};
17141751

17151752
export type NodePoolAttributes = {
1716-
cloudSettings?: InputMaybe<CloudSettingsAttributes>;
1753+
cloudSettings?: InputMaybe<NodePoolCloudAttributes>;
17171754
instanceType: Scalars['String']['input'];
17181755
labels?: InputMaybe<Scalars['Map']['input']>;
17191756
maxSize: Scalars['Int']['input'];
@@ -1722,6 +1759,10 @@ export type NodePoolAttributes = {
17221759
taints?: InputMaybe<Array<InputMaybe<TaintAttributes>>>;
17231760
};
17241761

1762+
export type NodePoolCloudAttributes = {
1763+
aws?: InputMaybe<AwsNodeCloudAttributes>;
1764+
};
1765+
17251766
export type NodeSpec = {
17261767
__typename?: 'NodeSpec';
17271768
podCidr?: Maybe<Scalars['String']['output']>;

lib/console/deployments/compatibilities/schema.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ defmodule Console.Deployments.Compatibilities.AddOn do
6565
end
6666
end
6767

68-
def find_version([%{version: first} = v1, %{version: second} = v2 | rest], version) do
68+
def find_version([%{version: first} = v1, %{version: second} = v2 | rest], version) when is_binary(first) and is_binary(second) do
6969
first = clean_version(first)
7070
second = clean_version(second)
7171

lib/console/graphql/deployments/cluster.ex

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ defmodule Console.GraphQl.Deployments.Cluster do
5454
field :instance_type, non_null(:string)
5555
field :labels, :map
5656
field :taints, list_of(:taint_attributes)
57-
field :cloud_settings, :cloud_settings_attributes
57+
field :cloud_settings, :node_pool_cloud_attributes
5858
end
5959

6060
input_object :taint_attributes do
@@ -86,6 +86,14 @@ defmodule Console.GraphQl.Deployments.Cluster do
8686
field :network, :string
8787
end
8888

89+
input_object :node_pool_cloud_attributes do
90+
field :aws, :aws_node_cloud_attributes
91+
end
92+
93+
input_object :aws_node_cloud_attributes do
94+
field :launch_template_id, :string
95+
end
96+
8997
input_object :cluster_provider_attributes do
9098
field :name, non_null(:string)
9199
field :namespace, :string
@@ -170,7 +178,7 @@ defmodule Console.GraphQl.Deployments.Cluster do
170178
field :current_version, :string, description: "current k8s version as told to us by the deployment operator"
171179
field :handle, :string, description: "a short, unique human readable name used to identify this cluster and does not necessarily map to the cloud resource name"
172180
field :installed, :boolean, description: "whether the deploy operator has been registered for this cluster"
173-
181+
field :settings, :cloud_settings, description: "the cloud settings for this cluster (for instance its aws region)"
174182
field :kas_url, :string, description: "the url of the kas server you can access this cluster from", resolve: fn
175183
_, _, _ -> {:ok, Console.Deployments.Clusters.kas_proxy_url()}
176184
end
@@ -235,7 +243,7 @@ defmodule Console.GraphQl.Deployments.Cluster do
235243
field :spot, :boolean, description: "whether this is a spot pool or not"
236244
field :labels, :map, description: "kubernetes labels to apply to the nodes in this pool, useful for node selectors"
237245
field :taints, list_of(:taint), description: "any taints you'd want to apply to a node, for eg preventing scheduling on spot instances"
238-
field :cloud_settings, :cloud_settings, description: "cloud specific settings for the node groups"
246+
field :cloud_settings, :node_cloud_settings, description: "cloud specific settings for the node groups"
239247

240248
timestamps()
241249
end
@@ -247,8 +255,35 @@ defmodule Console.GraphQl.Deployments.Cluster do
247255
field :effect, non_null(:string)
248256
end
249257

250-
@desc "cloud specific settings for a node pool"
258+
@desc "the cloud configuration for a cluster"
251259
object :cloud_settings do
260+
field :aws, :aws_cloud_settings
261+
field :gcp, :gcp_cloud_settings
262+
field :azure, :azure_cloud_settings
263+
end
264+
265+
@desc "aws specific cloud configuration"
266+
object :aws_cloud_settings do
267+
field :region, :string
268+
end
269+
270+
@desc "gcp specific cluster cloud configuration"
271+
object :gcp_cloud_settings do
272+
field :project, :string
273+
field :network, :string
274+
field :region, :string
275+
end
276+
277+
@desc "azure-specific cluster cloud configuration"
278+
object :azure_cloud_settings do
279+
field :location, :string
280+
field :subscription_id, :string
281+
field :resource_group, :string
282+
field :network, :string
283+
end
284+
285+
@desc "cloud specific settings for a node pool"
286+
object :node_cloud_settings do
252287
field :aws, :aws_cloud
253288
end
254289

schema/schema.graphql

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ input NodePoolAttributes {
12701270
instanceType: String!
12711271
labels: Map
12721272
taints: [TaintAttributes]
1273-
cloudSettings: CloudSettingsAttributes
1273+
cloudSettings: NodePoolCloudAttributes
12741274
}
12751275

12761276
input TaintAttributes {
@@ -1302,6 +1302,14 @@ input AzureCloudAttributes {
13021302
network: String
13031303
}
13041304

1305+
input NodePoolCloudAttributes {
1306+
aws: AwsNodeCloudAttributes
1307+
}
1308+
1309+
input AwsNodeCloudAttributes {
1310+
launchTemplateId: String
1311+
}
1312+
13051313
input ClusterProviderAttributes {
13061314
name: String!
13071315
namespace: String
@@ -1426,6 +1434,9 @@ type Cluster {
14261434
"whether the deploy operator has been registered for this cluster"
14271435
installed: Boolean
14281436

1437+
"the cloud settings for this cluster (for instance its aws region)"
1438+
settings: CloudSettings
1439+
14291440
"the url of the kas server you can access this cluster from"
14301441
kasUrl: String
14311442

@@ -1518,7 +1529,7 @@ type NodePool {
15181529
taints: [Taint]
15191530

15201531
"cloud specific settings for the node groups"
1521-
cloudSettings: CloudSettings
1532+
cloudSettings: NodeCloudSettings
15221533

15231534
insertedAt: DateTime
15241535

@@ -1532,8 +1543,35 @@ type Taint {
15321543
effect: String!
15331544
}
15341545

1535-
"cloud specific settings for a node pool"
1546+
"the cloud configuration for a cluster"
15361547
type CloudSettings {
1548+
aws: AwsCloudSettings
1549+
gcp: GcpCloudSettings
1550+
azure: AzureCloudSettings
1551+
}
1552+
1553+
"aws specific cloud configuration"
1554+
type AwsCloudSettings {
1555+
region: String
1556+
}
1557+
1558+
"gcp specific cluster cloud configuration"
1559+
type GcpCloudSettings {
1560+
project: String
1561+
network: String
1562+
region: String
1563+
}
1564+
1565+
"azure-specific cluster cloud configuration"
1566+
type AzureCloudSettings {
1567+
location: String
1568+
subscriptionId: String
1569+
resourceGroup: String
1570+
network: String
1571+
}
1572+
1573+
"cloud specific settings for a node pool"
1574+
type NodeCloudSettings {
15371575
aws: AwsCloud
15381576
}
15391577

0 commit comments

Comments
 (0)