Skip to content

Commit

Permalink
feat(gke): add config_sync (fleet) example (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody authored Jan 8, 2025
1 parent f248b0d commit bea1926
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 0 deletions.
38 changes: 38 additions & 0 deletions gke/enterprise/config_sync/git/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright 2024-2025 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.
*/

# [START gke_enterprise_config_sync_git]
resource "google_gke_hub_feature" "default" {
name = "configmanagement"
location = "global"

fleet_default_member_config {
configmanagement {
config_sync {
# The field `enabled` was introduced in Terraform version 5.41.0, and
# needs to be set to `true` explicitly to install Config Sync.
enabled = true
git {
sync_repo = "REPO"
sync_branch = "BRANCH"
policy_dir = "DIRECTORY"
secret_type = "SECRET"
}
}
}
}
}
# [END gke_enterprise_config_sync_git]
21 changes: 21 additions & 0 deletions gke/enterprise/config_sync/git/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024-2025 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.

# The kubernetes_manifest resource can only be used with pre-existing clusters.
apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintTest
metadata:
name: config_sync_git
spec:
skip: true
37 changes: 37 additions & 0 deletions gke/enterprise/config_sync/oci/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright 2024-2025 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.
*/

# [START gke_enterprise_config_sync_oci]
resource "google_gke_hub_feature" "configmanagement_feature_member" {
name = "configmanagement"
location = "global"

fleet_default_member_config {
configmanagement {
config_sync {
# The field `enabled` was introduced in Terraform version 5.41.0, and
# needs to be set to `true` explicitly to install Config Sync.
enabled = true
oci {
sync_repo = "REPO"
policy_dir = "DIRECTORY"
secret_type = "SECRET"
}
}
}
}
}
# [END gke_enterprise_config_sync_oci]
21 changes: 21 additions & 0 deletions gke/enterprise/config_sync/oci/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024-2025 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.

# The kubernetes_manifest resource can only be used with pre-existing clusters.
apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintTest
metadata:
name: config_sync_oci
spec:
skip: true

0 comments on commit bea1926

Please sign in to comment.