Skip to content

Commit 32602a8

Browse files
committed
from justinsb/kpt-samples
1 parent dfdb45e commit 32602a8

File tree

12 files changed

+383
-0
lines changed

12 files changed

+383
-0
lines changed

infra/environment/Kptfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: kpt.dev/v1
2+
kind: Kptfile
3+
metadata:
4+
name: environment
5+
annotations:
6+
config.kubernetes.io/local-config: "true"
7+
info:
8+
description: environment
9+
pipeline:
10+
mutators:
11+
- image: set-name-prefix
12+
- image: generator-configconnectorcontext
13+
- image: bind-gcp-resources

infra/environment/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# environment

infra/environment/folder.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Create an environment folder to hold the new project.
2+
apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1
3+
kind: Folder
4+
metadata:
5+
name: environments
6+
namespace: config-control
7+
spec:
8+
displayName: environments
9+
folderRef:
10+
name: root

infra/environment/kcc.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: Namespace
17+
metadata:
18+
name: packagename
19+
annotations:
20+
cnrm.cloud.google.com/project-id: googleprojectid
21+
22+
---
23+
24+
apiVersion: core.cnrm.cloud.google.com/v1beta1
25+
kind: ConfigConnectorContext
26+
metadata:
27+
name: configconnectorcontext.core.cnrm.cloud.google.com
28+
namespace: packagename
29+
spec:
30+
googleServiceAccount: [email protected]
31+
32+
---
33+
34+
apiVersion: v1
35+
kind: ServiceAccount
36+
metadata:
37+
name: cnrm-controller-manager-packagename
38+
namespace: cnrm-system
39+
annotations:
40+
config.kubernetes.io/local-config: generated
41+
ownerReferences:
42+
- apiVersion: core.cnrm.cloud.google.com/v1beta1
43+
kind: ConfigConnectorContext
44+
name: configconnectorcontext.core.cnrm.cloud.google.com
45+
namespace: packagename
46+
47+
---
48+
49+
apiVersion: iam.cnrm.cloud.google.com/v1beta1
50+
kind: IAMServiceAccount
51+
metadata:
52+
name: packagename-cc-robot
53+
namespace: config-control
54+
annotations:
55+
cnrm.cloud.google.com/project-id: googleprojectid
56+
spec:
57+
displayName: ConfigConnector ServiceAccount
58+
resourceID: cc-robot
59+
60+
---
61+
62+
apiVersion: porch.kpt.dev/v1alpha1
63+
kind: WorkloadIdentityBinding
64+
metadata:
65+
name: packagename-cnrm-controller-manager
66+
namespace: config-control
67+
spec:
68+
resourceRef:
69+
apiVersion: iam.cnrm.cloud.google.com/v1beta1
70+
kind: IAMServiceAccount
71+
name: packagename-cc-robot
72+
serviceAccountRef:
73+
name: cnrm-controller-manager-packagename
74+
namespace: cnrm-system
75+
76+
---
77+
78+
apiVersion: iam.cnrm.cloud.google.com/v1beta1
79+
kind: IAMPolicyMember
80+
metadata:
81+
name: packagename-cc-robot
82+
namespace: config-control
83+
spec:
84+
memberFrom:
85+
serviceAccountRef:
86+
name: packagename-cc-robot
87+
role: roles/owner
88+
resourceRef:
89+
apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1
90+
kind: Project
91+
name: packagename
92+
---
93+
apiVersion: rbac.authorization.k8s.io/v1
94+
kind: RoleBinding
95+
metadata:
96+
name: "packagename-cnrm:cnrm-viewer"
97+
namespace: config-control
98+
subjects:
99+
- kind: ServiceAccount
100+
namespace: cnrm-system
101+
name: cnrm-controller-manager-packagename
102+
roleRef:
103+
kind: ClusterRole
104+
name: cnrm-viewer
105+
apiGroup: rbac.authorization.k8s.io

infra/environment/project.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1
16+
kind: Folder
17+
metadata:
18+
name: packagename
19+
namespace: config-control
20+
spec:
21+
displayName: packagename
22+
folderRef:
23+
name: environments
24+
namepace: environments-ns
25+
26+
---
27+
28+
apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1
29+
kind: Project
30+
metadata:
31+
name: packagename
32+
namespace: config-control
33+
spec:
34+
name: packagename
35+
folderRef:
36+
name: environments
37+
billingAccountRef:
38+
#name: default
39+
# TODO: Is there a BillingAccount ref?
40+
external: 016C6E-5D5038-702920
41+
resourceID: googleprojectid
42+
43+
44+
---
45+
46+
# We need to enable some services so we can enable other services
47+
48+
apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1
49+
kind: Service
50+
metadata:
51+
annotations:
52+
cnrm.cloud.google.com/deletion-policy: "abandon"
53+
name: packagename-serviceusage
54+
namespace: config-control
55+
spec:
56+
resourceID: serviceusage.googleapis.com
57+
projectRef:
58+
name: packagename

infra/environment/rbac.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: iam.cnrm.cloud.google.com/v1beta1
16+
kind: IAMPartialPolicy
17+
metadata:
18+
name: packagename-editors
19+
namespace: config-control
20+
spec:
21+
# TODO: Replace with group?
22+
bindings:
23+
- members:
24+
- member: user:[email protected]
25+
role: roles/editor
26+
- members:
27+
- member: user:[email protected]
28+
role: roles/container.admin
29+
resourceRef:
30+
apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1
31+
kind: Project
32+
name: packagename

infra/environment/services.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1
16+
kind: Service
17+
metadata:
18+
annotations:
19+
cnrm.cloud.google.com/deletion-policy: "abandon"
20+
name: container.googleapis.com
21+
namespace: packagename
22+
23+
---
24+
25+
# Needed to grant GCP IAM permissions on projects
26+
apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1
27+
kind: Service
28+
metadata:
29+
annotations:
30+
cnrm.cloud.google.com/deletion-policy: "abandon"
31+
name: cloudresourcemanager.googleapis.com
32+
namespace: packagename

infra/gkecluster/Kptfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: kpt.dev/v1
2+
kind: Kptfile
3+
metadata:
4+
name: gkecluster
5+
annotations:
6+
config.kubernetes.io/local-config: "true"
7+
info:
8+
description: sample description
9+
pipeline:
10+
mutators:
11+
- image: gcr.io/justinsb-root-20220725/set-name-prefix
12+
- image: gcr.io/justinsb-root-20220725/generator-configconnectorcontext
13+
- image: gcr.io/justinsb-root-20220725/bind-gcp-resources

infra/gkecluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# gkecluster

infra/gkecluster/bindings.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# # Copyright 2022 Google LLC
2+
# #
3+
# # Licensed under the Apache License, Version 2.0 (the "License");
4+
# # you may not use this file except in compliance with the License.
5+
# # You may obtain a copy of the License at
6+
# #
7+
# # http://www.apache.org/licenses/LICENSE-2.0
8+
# #
9+
# # Unless required by applicable law or agreed to in writing, software
10+
# # distributed under the License is distributed on an "AS IS" BASIS,
11+
# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# # See the License for the specific language governing permissions and
13+
# # limitations under the License.
14+
15+
apiVersion: v1
16+
kind: Namespace
17+
metadata:
18+
name: binding
19+
annotations:
20+
config.kubernetes.io/local-config: "binding"
21+
22+
---
23+
24+
apiVersion: resourcemanager.cnrm.cloud.google.com/v1beta1
25+
kind: Project
26+
metadata:
27+
name: binding
28+
namespace: config-control
29+
annotations:
30+
config.kubernetes.io/local-config: "binding"

0 commit comments

Comments
 (0)