Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
coilysiren committed Nov 20, 2023
1 parent 21c2dd5 commit 4df0aea
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
80 changes: 40 additions & 40 deletions infrastructure/kubeconfig.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
annotations:
cloud.google.com/neg: '{"ingress":true}'
finalizers:
- service.kubernetes.io/load-balancer-cleanup
labels:
- apiVersion: v1
kind: Service
metadata:
annotations:
cloud.google.com/neg: '{"ingress":true}'
finalizers:
- service.kubernetes.io/load-balancer-cleanup
labels:
app: application
name: application
spec:
allocateLoadBalancerNodePorts: true
externalTrafficPolicy: Cluster
internalTrafficPolicy: Cluster
ports:
- port: 80
targetPort: 8080
selector:
app: application
type: LoadBalancer
- apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: application
name: application
spec:
replicas: 1
selector:
matchLabels:
app: application
name: application
spec:
allocateLoadBalancerNodePorts: true
externalTrafficPolicy: Cluster
internalTrafficPolicy: Cluster
ports:
- port: 80
targetPort: 8080
selector:
app: application
type: LoadBalancer
- apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: application
name: application
spec:
replicas: 1
selector:
matchLabels:
template:
metadata:
labels:
app: application
template:
metadata:
labels:
app: application
spec:
containers:
- image: us-central1-docker.pkg.dev/root-territory-384205/repository/gke-test-2:dns-0e11769-kai
name: application
ports:
- containerPort: 8080
spec:
containers:
- image: us-central1-docker.pkg.dev/root-territory-384205/repository/gke-test-2:dns-21c2dd5-kai
name: application
ports:
- containerPort: 8080
kind: List
metadata:
resourceVersion: ""
resourceVersion: ''
6 changes: 3 additions & 3 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ def get_kubeconfig(self) -> str:
with open(self.kubeconfig, "r", encoding="utf-8") as _file:
return yaml.safe_load(_file.read())

def update_image(self, kubeconfig: dict) -> dict:
def update_image(self, kubeconfig: dict, image: str) -> dict:
for item in kubeconfig["items"]:
if item["kind"] == "Deployment":
item["spec"]["template"]["spec"]["containers"][0]["image"] = f"{self.docker_repo}:{self.version}"
item["spec"]["template"]["spec"]["containers"][0]["image"] = image
return kubeconfig

def write_kubeconfig(self, value: str) -> None:
Expand Down Expand Up @@ -150,7 +150,7 @@ def deploy(ctx: [invoke.Context, Context]):

# deploy to k8s cluster
kubeconfig = ctx.get_kubeconfig()
kubeconfig = ctx.update_image(kubeconfig)
kubeconfig = ctx.update_image(kubeconfig, f"{ctx.docker_repo}:{ctx.version}")
ctx.write_kubeconfig(kubeconfig)
ctx.run(f"kubectl apply -f {ctx.kubeconfig}")

Expand Down

0 comments on commit 4df0aea

Please sign in to comment.