Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit 4a58efe

Browse files
authored
fix #129 ensure gcpmanager is included by default (#131)
1 parent c617681 commit 4a58efe

File tree

7 files changed

+142
-6
lines changed

7 files changed

+142
-6
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

22
# Image URL to use all building/pushing image targets
3-
IMG ?= docker.io/substratusai/controller-manager:v0.6.4-alpha
3+
VERSION ?= v0.6.5-alpha
4+
IMG ?= docker.io/substratusai/controller-manager:${VERSION}
5+
IMG_GCPMANAGER ?= docker.io/substratusai/gcp-manager:${VERSION}
6+
47
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
58
ENVTEST_K8S_VERSION = 1.26.1
69

@@ -176,6 +179,7 @@ uninstall-crds: manifests kustomize ## Uninstall CRDs from the K8s cluster speci
176179

177180
install/kubernetes/system.yaml: manifests kustomize
178181
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
182+
cd config/gcpmanager && $(KUSTOMIZE) edit set image gcp-manager=${IMG_GCPMANAGER}
179183
$(KUSTOMIZE) build config/default > install/kubernetes/system.yaml
180184

181185
RUN_SUBSTRATUS_INSTALLER := docker run -it \

config/default/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ resources:
1111
- ../crd
1212
- ../rbac
1313
- ../manager
14+
- ../gcpmanager
1415
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
1516
# crd/kustomization.yaml
1617
#- ../webhook

config/gcpmanager/gcp-manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spec:
2525
- name: gcp-manager
2626
# use this when running via skaffold
2727
# image: us-central1-docker.pkg.dev/substratus-ai-001/substratus/gcpmanager:latest
28-
image: substratusai/gcp-manager:v0.6.3-alpha
28+
image: gcp-manager:latest
2929
imagePullPolicy: Always
3030
ports:
3131
- containerPort: 10080

config/gcpmanager/kustomization.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
resources:
2+
- gcp-manager.yaml
3+
- bootstrapper-job.yaml
4+
apiVersion: kustomize.config.k8s.io/v1beta1
5+
kind: Kustomization
6+
images:
7+
- name: gcp-manager
8+
newName: docker.io/substratusai/gcp-manager
9+
newTag: v0.6.5-alpha

config/manager/kustomization.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ kind: Kustomization
55
images:
66
- name: controller
77
newName: docker.io/substratusai/controller-manager
8-
newTag: v0.6.4-alpha
8+
newTag: v0.6.5-alpha
9+
- name: gcp-manager
10+
newName: docker.io/substratusai/gcp-manager
11+
newTag: v0.6.5-alpha

install/kubernetes/system.yaml

Lines changed: 122 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,18 @@ metadata:
994994
name: controller-manager
995995
namespace: substratus
996996
---
997+
apiVersion: v1
998+
kind: ServiceAccount
999+
metadata:
1000+
name: gcp-manager
1001+
namespace: substratus
1002+
---
1003+
apiVersion: v1
1004+
kind: ServiceAccount
1005+
metadata:
1006+
name: gcp-manager-bootstrapper
1007+
namespace: substratus
1008+
---
9971009
apiVersion: rbac.authorization.k8s.io/v1
9981010
kind: Role
9991011
metadata:
@@ -1040,6 +1052,21 @@ rules:
10401052
- patch
10411053
---
10421054
apiVersion: rbac.authorization.k8s.io/v1
1055+
kind: Role
1056+
metadata:
1057+
name: service-account-annotator
1058+
namespace: substratus
1059+
rules:
1060+
- apiGroups:
1061+
- ""
1062+
resources:
1063+
- serviceaccounts
1064+
verbs:
1065+
- get
1066+
- patch
1067+
- update
1068+
---
1069+
apiVersion: rbac.authorization.k8s.io/v1
10431070
kind: ClusterRole
10441071
metadata:
10451072
creationTimestamp: null
@@ -1286,6 +1313,20 @@ subjects:
12861313
namespace: substratus
12871314
---
12881315
apiVersion: rbac.authorization.k8s.io/v1
1316+
kind: RoleBinding
1317+
metadata:
1318+
name: service-account-annotator-binding
1319+
namespace: substratus
1320+
roleRef:
1321+
apiGroup: rbac.authorization.k8s.io
1322+
kind: Role
1323+
name: service-account-annotator
1324+
subjects:
1325+
- kind: ServiceAccount
1326+
name: gcp-manager-bootstrapper
1327+
namespace: substratus
1328+
---
1329+
apiVersion: rbac.authorization.k8s.io/v1
12891330
kind: ClusterRoleBinding
12901331
metadata:
12911332
labels:
@@ -1347,6 +1388,19 @@ spec:
13471388
selector:
13481389
control-plane: controller-manager
13491390
---
1391+
apiVersion: v1
1392+
kind: Service
1393+
metadata:
1394+
name: gcp-manager
1395+
namespace: substratus
1396+
spec:
1397+
ports:
1398+
- port: 10080
1399+
protocol: TCP
1400+
targetPort: 10080
1401+
selector:
1402+
app: gcp-manager
1403+
---
13501404
apiVersion: apps/v1
13511405
kind: Deployment
13521406
metadata:
@@ -1421,7 +1475,7 @@ spec:
14211475
envFrom:
14221476
- configMapRef:
14231477
name: system
1424-
image: docker.io/substratusai/controller-manager:v0.6.4-alpha
1478+
image: docker.io/substratusai/controller-manager:v0.6.5-alpha
14251479
livenessProbe:
14261480
httpGet:
14271481
path: /healthz
@@ -1451,3 +1505,70 @@ spec:
14511505
runAsNonRoot: true
14521506
serviceAccountName: controller-manager
14531507
terminationGracePeriodSeconds: 10
1508+
---
1509+
apiVersion: apps/v1
1510+
kind: Deployment
1511+
metadata:
1512+
name: gcp-manager
1513+
namespace: substratus
1514+
spec:
1515+
replicas: 1
1516+
selector:
1517+
matchLabels:
1518+
app: gcp-manager
1519+
template:
1520+
metadata:
1521+
labels:
1522+
app: gcp-manager
1523+
spec:
1524+
containers:
1525+
- image: docker.io/substratusai/gcp-manager:v0.6.5-alpha
1526+
imagePullPolicy: Always
1527+
livenessProbe:
1528+
failureThreshold: 3
1529+
initialDelaySeconds: 15
1530+
periodSeconds: 20
1531+
successThreshold: 1
1532+
tcpSocket:
1533+
port: 10080
1534+
timeoutSeconds: 5
1535+
name: gcp-manager
1536+
ports:
1537+
- containerPort: 10080
1538+
resources:
1539+
limits:
1540+
cpu: 500m
1541+
memory: 128Mi
1542+
requests:
1543+
cpu: 10m
1544+
memory: 64Mi
1545+
serviceAccountName: gcp-manager
1546+
terminationGracePeriodSeconds: 10
1547+
---
1548+
apiVersion: batch/v1
1549+
kind: Job
1550+
metadata:
1551+
name: annotate-gcp-manager-sa
1552+
namespace: substratus
1553+
spec:
1554+
backoffLimit: 2
1555+
template:
1556+
spec:
1557+
containers:
1558+
- command:
1559+
- /bin/bash
1560+
- -c
1561+
- |
1562+
# Get the project ID
1563+
PROJECT_ID=$(gcloud config get-value project)
1564+
# Get the current region
1565+
REGION=$(curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/zone | awk -F '/' '{print $4}' | sed 's/-[a-z]$//')
1566+
# Set the annotation value
1567+
ANNOTATION_VALUE="substratus-gcp-manager@${PROJECT_ID}.iam.gserviceaccount.com"
1568+
# Annotate the service account
1569+
kubectl annotate serviceaccount -n substratus gcp-manager iam.gke.io/gcp-service-account=${ANNOTATION_VALUE}
1570+
image: google/cloud-sdk:latest
1571+
name: gcloud
1572+
restartPolicy: OnFailure
1573+
serviceAccountName: gcp-manager-bootstrapper
1574+
ttlSecondsAfterFinished: 120

install/scripts/gcp-up.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,4 @@ if [ "$INSTALL_OPERATOR" == "yes" ]; then
4444
kubectl apply -f kubernetes/namespace.yaml
4545
kubectl apply -f kubernetes/config.yaml
4646
kubectl apply -f kubernetes/system.yaml
47-
kubectl apply -f config/gcpmanager/bootstrapper-job.yaml
48-
kubectl apply -f config/gcpmanager/gcp-manager.yaml
4947
fi

0 commit comments

Comments
 (0)