Skip to content

Commit

Permalink
feat: ✨ Namespace: Defining namespace for each manifest
Browse files Browse the repository at this point in the history
Here we are specifying the "namespace" field into the menifests accordingly to it purpose.
  • Loading branch information
kevencript committed Mar 21, 2023
1 parent 4fcf9f1 commit c7be60e
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 4 deletions.
1 change: 1 addition & 0 deletions k8s/configmap-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: configmap-app-env
namespace: server
data:
NAME: "Gabriel Costa"
AGE: "23"
1 change: 1 addition & 0 deletions k8s/configmap-injection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: configmap-app-injection
namespace: server
data:
config: |
Gabriel, Fulano, Ciclano
Expand Down
1 change: 1 addition & 0 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: go-http-app
namespace: server
labels:
app: go-http-app
tier: backend
Expand Down
1 change: 1 addition & 0 deletions k8s/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: go-http-app-hpa
namespace: server
spec:
scaleTargetRef:
apiVersion: apps/v1
Expand Down
1 change: 1 addition & 0 deletions k8s/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress
namespace: server
annotations:
# Define which ingress class this manifest will use
kubernetes.io/ingress.class: "nginx"
Expand Down
1 change: 1 addition & 0 deletions k8s/mysql-headless-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: mysql-headless
namespace: database
spec:
clusterIP: None
selector:
Expand Down
1 change: 1 addition & 0 deletions k8s/mysql-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Secret
metadata:
name: mysql-root-password
namespace: database
type: Opaque
data:
password: YWRtaW4K
4 changes: 0 additions & 4 deletions k8s/namespace.yaml

This file was deleted.

22 changes: 22 additions & 0 deletions k8s/namespaces/deployment-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: server
spec:
selector:
matchLabels:
app: server
template:
metadata:
labels:
app: server
spec:
containers:
- name: server
image: wesleywillians/hello-express
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 3000
1 change: 1 addition & 0 deletions k8s/persistent-volume-claim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: example-pvc
namespace: database
spec:
resources:
requests:
Expand Down
1 change: 1 addition & 0 deletions k8s/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Secret
metadata:
name: secret-app
namespace: server
type: Opaque
data:
USER: Z2FicmllbAo=
Expand Down
1 change: 1 addition & 0 deletions k8s/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: go-http-app-service
namespace: server
labels:
app: go-http-app
tier: backend
Expand Down
1 change: 1 addition & 0 deletions k8s/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql-example
namespace: database
spec:
selector:
matchLabels:
Expand Down

0 comments on commit c7be60e

Please sign in to comment.