Skip to content

Commit

Permalink
Add sample for secondary cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
199201shubhamsahu committed Feb 22, 2024
1 parent e39833c commit 1e16308
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: alloydb.cnrm.cloud.google.com/v1beta1
kind: AlloyDBCluster
metadata:
name: alloydbcluster-dep-secondary
spec:
location: us-east1
networkConfig:
networkRef:
name: alloydbcluster-dep-secondary
projectRef:
external: ${PROJECT_ID?}
automatedBackupPolicy:
backupWindow: 3600s
encryptionConfig:
kmsKeyNameRef:
name: alloydbcluster-dep-secondary
enabled: true
labels:
source: kcc
location: us-east1
timeBasedRetention:
retentionPeriod: 43200s
weeklySchedule:
daysOfWeek: [MONDAY]
startTimes:
- hours: 4
minutes: 0
seconds: 0
nanos: 0
encryptionConfig:
kmsKeyNameRef:
name: alloydbcluster-dep-secondary
initialUser:
user: "postgres"
password:
value: "postgres"
---
apiVersion: alloydb.cnrm.cloud.google.com/v1beta1
kind: AlloyDBCluster
metadata:
name: alloydbcluster-sample-secondary
spec:
location: us-west1
networkConfig:
networkRef:
name: alloydbcluster-dep-secondary
projectRef:
external: ${PROJECT_ID?}
clusterType: "SECONDARY"
secondaryConfig:
primaryClusterName: projects/${PROJECT_ID?}/locations/us-east1/clusters/alloydbcluster-dep-secondary
deletionPolicy: "FORCE"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeAddress
metadata:
name: alloydbcluster-dep-secondary
spec:
location: global
addressType: INTERNAL
networkRef:
name: alloydbcluster-dep-secondary
prefixLength: 16
purpose: VPC_PEERING
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeNetwork
metadata:
name: alloydbcluster-dep-secondary


Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMPartialPolicy
metadata:
name: alloydbcluster-dep-secondary
spec:
resourceRef:
apiVersion: kms.cnrm.cloud.google.com/v1beta1
kind: KMSCryptoKey
name: alloydbcluster-dep-secondary
bindings:
- role: roles/cloudkms.cryptoKeyEncrypterDecrypter
members:
- memberFrom:
serviceIdentityRef:
name: alloydbcluster-dep-secondary
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kms.cnrm.cloud.google.com/v1beta1
kind: KMSCryptoKey
metadata:
labels:
source: kcc-alloydbcluster-sample
name: alloydbcluster-dep-secondary
spec:
keyRingRef:
name: alloydbcluster-dep-secondary
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kms.cnrm.cloud.google.com/v1beta1
kind: KMSKeyRing
metadata:
name: alloydbcluster-dep-secondary
spec:
location: us-east1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: servicenetworking.cnrm.cloud.google.com/v1beta1
kind: ServiceNetworkingConnection
metadata:
name: alloydbcluster-dep-secondary
spec:
networkRef:
name: alloydbcluster-dep-secondary
reservedPeeringRanges:
- external: alloydbcluster-dep-secondary
service: servicenetworking.googleapis.com
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1
kind: ServiceIdentity
metadata:
name: alloydbcluster-dep-secondary
spec:
projectRef:
external: ${PROJECT_ID?}
resourceID: alloydb.googleapis.com

0 comments on commit 1e16308

Please sign in to comment.