Skip to content

Commit

Permalink
Updatee: rename krm entities
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Lamirault <[email protected]>
  • Loading branch information
nlamirault committed Oct 5, 2021
1 parent be495cb commit d884d4b
Show file tree
Hide file tree
Showing 15 changed files with 145 additions and 125 deletions.
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ kind-delete: guard-ENV ## Delete a local Kubernetes cluster (ENV=xxx)
@echo -e "$(OK_COLOR)[$(APP)] Create Kubernetes cluster ${SERVICE}$(NO_COLOR)"
@kind delete cluster --name=$(CLUSTER)

.PHONY: kind-kube-credentials
kind-kube-credentials: guard-ENV ## Credentials for Kind (ENV=xxx)
@kubectl config use-context $(KUBE_CONTEXT)


# ====================================
# K U B E R N E T E S
# ====================================
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,32 @@ Build cloud platform using [Kubernetes Resources Model](https://github.com/kuber
❯ make crossplane-infra CLOUD=aws ACTION=apply
```

### GCP

* Cloud provider configuration:

```shell
> make crossplane-gcp-credentials GCP_PROJECT_ID=myproject-prod GCP_SERVICE_ACCOUNT_NAME=kubernetes-krm
```

* Install Crossplane provider:

```shell
> make crossplane-provider CLOUD=gcp ACTION=apply
```

* Setup Crossplane configuration:

```shell
❯ make crossplane-config CLOUD=gcp ACTION=apply
```

* Deploy infrastructure:

```shell
❯ make crossplane-infra CLOUD=aws ACTION=apply
```

## Contributing

See [CONTRIBUTING.md](./CONTRIBUTING.md)
Expand Down
2 changes: 1 addition & 1 deletion krm/gcp/config/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./aws-config.yaml
- ./gcp-config.yaml

namespace: crossplane-system

Expand Down
6 changes: 3 additions & 3 deletions krm/gcp/config/labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ kind: LabelTransformer
metadata:
name: labels
labels:
app.kubernetes.io/name: portefaix-krm-gcp
app.kubernetes.io/instance: portefaix-krm-gcp-app
app.kubernetes.io/name: portefaix-krm
app.kubernetes.io/instance: portefaix-krm-app
app.kubernetes.io/component: krm-crossplane
app.kubernetes.io/version: v0.1.0
app.kubernetes.io/part-of: portefaix-krm-gcp
app.kubernetes.io/part-of: portefaix-krm
app.kubernetes.io/managed-by: kustomize
portefaix.xyz/version: v0.19.0
crossplane.io/version: v0.14.0
Expand Down
22 changes: 11 additions & 11 deletions krm/gcp/infra/bucket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@
apiVersion: storage.gcp.crossplane.io/v1alpha3
kind: Bucket
metadata:
name: portefaix-krm-gcp
name: portefaix-krm
annotations:
crossplane.io/external-name: portefaix-krm-gcp-bucket
crossplane.io/external-name: portefaix-krm-bucket
spec:
location: EU
storageClass: MULTI_REGIONAL
providerConfigRef:
name: portefaix-gcp
name: crossplane-gcp
labels:
made-by: crossplane
deletionPolicy: Delete
---
apiVersion: storage.gcp.crossplane.io/v1alpha1
kind: BucketPolicy
metadata:
name: portefaix-krm-gcp
name: portefaix-krm
spec:
forProvider:
bucketRef:
name: portefaix-krm-gcp
name: portefaix-krm
policy:
bindings:
# - role: roles/storage.legacyBucketOwner
Expand All @@ -47,21 +47,21 @@ spec:
# - "projectViewer:<gcp-project>"
- role: roles/storage.objectAdmin
serviceAccountMemberRefs:
- name: portefaix-krm-gcp
- name: portefaix-krm
providerConfigRef:
name: portefaix-gcp
name: crossplane-gcp
---
apiVersion: storage.gcp.crossplane.io/v1alpha1
kind: BucketPolicyMember
metadata:
name: portefaix-krm-gcp
name: portefaix-krm
spec:
forProvider:
bucketRef:
name: portefaix-krm-gcp
name: portefaix-krm
# member: serviceAccount:<my-sa-email>
serviceAccountMemberRef:
name: portefaix-krm-gcp
name: portefaix-krm
role: roles/storage.objectAdmin
providerConfigRef:
name: portefaix-gcp
name: crossplane-gcp
6 changes: 3 additions & 3 deletions krm/gcp/infra/cloudsql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
apiVersion: database.gcp.crossplane.io/v1beta1
kind: CloudSQLInstance
metadata:
name: portefaix-krm-gcp
name: portefaix-krm
spec:
forProvider:
databaseVersion: POSTGRES_11
Expand All @@ -25,8 +25,8 @@ spec:
tier: db-custom-1-3840
dataDiskSizeGb: 20
providerConfigRef:
name: portefaix-gcp
name: crossplane-gcp
writeConnectionSecretToRef:
name: portefaix-krm-gcp-cloudsql
name: portefaix-krm-cloudsql
namespace: crossplane-system
deletionPolicy: Delete
8 changes: 4 additions & 4 deletions krm/gcp/infra/firewall.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
apiVersion: compute.gcp.crossplane.io/v1alpha1
kind: Firewall
metadata:
name: portefaix-krm-gcp
name: portefaix-krm
spec:
forProvider:
description: "Portefaix KRM Crossplane"
allowed:
- IPProtocol: tcp
ports: ["80", "443"]
- IPProtocol: icmp
sourceRanges: ["10.0.0.0/24"]
sourceRanges: ["10.11.0.0/20"]
networkRef:
name: portefaix-krm-gcp
name: portefaix-krm
providerConfigRef:
name: portefaix-gcp
name: crossplane-gcp
90 changes: 55 additions & 35 deletions krm/gcp/infra/gke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
apiVersion: container.gcp.crossplane.io/v1beta2
kind: Cluster
metadata:
name: portefaix-krm-gcp
name: portefaix-krm
spec:
forProvider:
# initialClusterVersion: "1.21"
releaseChannel:
channel: REGULAR
location: eu-west1
location: europe-west1-c
masterAuth:
# setting this master auth user name enables basic auth so that a client (e.g.,
# provider-helm), can connect with the generated kubeconfig from the connection secret
Expand All @@ -34,6 +32,9 @@ spec:
addonsConfig:
cloudRunConfig:
disabled: true
loadBalancerType: LOAD_BALANCER_TYPE_UNSPECIFIED
configConnectorConfig:
enabled: false
dnsCacheConfig:
enabled: true
gcePersistentDiskCsiDriverConfig:
Expand All @@ -42,53 +43,68 @@ spec:
disabled: true
httpLoadBalancing:
disabled: true
istioConfig:
disabled: true
auth: "AUTH_NONE"
kalmConfig:
enabled: false
kubernetesDashboard:
disabled: true
networkPolicyConfig:
disabled: false
autopilot:
enabled: false
binaryAuthorization:
enabled: false
confidentialNodes:
enabled: false
# defaultMaxPodsConstraint:
# maxPodsPerNode: 110
maintenancePolicy:
window:
dailyMaintenanceWindow:
legacyAbac:
enabled: false
network: portefaix-krm-gcp
networkRef:
name: portefaix-krm
subnetworkRef:
name: portefaix-krm
networkPolicy:
enabled: true
provider: CALICO
podSecurityPolicyConfig:
enabled: false
releaseChannel:
channel: REGULAR
# resourceLabels:
# service: kubernetes
# role: cluster
# made-by: crossplane
# workloadIdentityConfig:
# workloadPool: portefaix-krm #.svc.id.goog
writeConnectionSecretToRef:
name: portefaix-krm-gcp-gke
name: portefaix-krm-gke
namespace: crossplane-system
providerConfigRef:
name: portefaix-gcp
name: crossplane-gcp
---
apiVersion: container.gcp.crossplane.io/v1beta1
kind: NodePool
metadata:
name: portefaix-krm-gcp-core
name: portefaix-krm-core
spec:
forProvider:
autoscaling:
autoprovisioned: false
enabled: true
maxNodeCount: 3
minNodeCount: 0
maxNodeCount: 4
minNodeCount: 2
clusterRef:
name: portefaix-krm-gcp
name: portefaix-krm
config:
machineType: n1-standard-1
sandboxConfig:
type: gvisor
diskSizeGb: 120
diskType: pd-ssd
imageType: cos_containerd
labels:
made-by: crossplane
# labels:
# service: kubernetes
# role: node
# made-by: crossplane
tags:
- kubernetes
- nodes
Expand All @@ -99,19 +115,19 @@ spec:
- "https://www.googleapis.com/auth/servicecontrol"
- "https://www.googleapis.com/auth/service.management.readonly"
- "https://www.googleapis.com/auth/trace.append"
initialNodeCount: 1
initialNodeCount: 2
locations:
- "eu-west1-b"
- europe-west1-c
management:
autoRepair: true
autoUpgrade: true
providerConfigRef:
name: portefaix-gcp
name: crossplane-gcp
---
apiVersion: container.gcp.crossplane.io/v1beta1
kind: NodePool
metadata:
name: portefaix-krm-gcp-ops
name: portefaix-krm-ops
spec:
forProvider:
autoscaling:
Expand All @@ -120,16 +136,18 @@ spec:
maxNodeCount: 3
minNodeCount: 0
clusterRef:
name: portefaix-krm-gcp
name: portefaix-krm
config:
machineType: n1-standard-1
sandboxConfig:
type: gvisor
diskSizeGb: 120
diskType: pd-ssd
imageType: cos_containerd
labels:
made-by: crossplane
# labels:
# service: kubernetes
# role: node
# made-by: crossplane
tags:
- kubernetes
- nodes
Expand All @@ -142,17 +160,17 @@ spec:
- "https://www.googleapis.com/auth/trace.append"
initialNodeCount: 0
locations:
- "eu-west1-b"
- europe-west1-c
management:
autoRepair: true
autoUpgrade: true
providerConfigRef:
name: portefaix-gcp
name: crossplane-gcp
---
apiVersion: container.gcp.crossplane.io/v1beta1
kind: NodePool
metadata:
name: portefaix-krm-gcp-misc
name: portefaix-krm-misc
spec:
forProvider:
autoscaling:
Expand All @@ -161,16 +179,18 @@ spec:
maxNodeCount: 3
minNodeCount: 0
clusterRef:
name: portefaix-krm-gcp
name: portefaix-krm
config:
machineType: n1-standard-1
sandboxConfig:
type: gvisor
diskSizeGb: 120
diskType: pd-ssd
imageType: cos_containerd
labels:
made-by: crossplane
# labels:
# service: kubernetes
# role: node
# made-by: crossplane
tags:
- kubernetes
- nodes
Expand All @@ -184,9 +204,9 @@ spec:
- "https://www.googleapis.com/auth/trace.append"
initialNodeCount: 0
locations:
- "eu-west1-b"
- europe-west1-c
management:
autoRepair: true
autoUpgrade: true
providerConfigRef:
name: portefaix-gcp
name: crossplane-gcp
Loading

0 comments on commit d884d4b

Please sign in to comment.