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

Commit

Permalink
Add app namespace (#26)
Browse files Browse the repository at this point in the history
* updated prod K8s scripts to not delete / create namespace

* updated prod K8s scripts to not delete / create namespace

* create `akkastress` namespace in AKS Pulumi stack

* cleaned up deployment
  • Loading branch information
Aaronontheweb authored Apr 19, 2022
1 parent d4ae079 commit 85a30d5
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 9 deletions.
3 changes: 1 addition & 2 deletions k8s/prod/deployAll.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ set location=%~dp0/environment

echo "Deploying K8s resources from [%location%] into namespace [%namespace%]"

echo "Creating Namespaces..."
kubectl create ns "%namespace%"
REM namespace is created via Pulumi in production

echo "Using namespace [%namespace%] going forward..."

Expand Down
31 changes: 29 additions & 2 deletions k8s/prod/destroyAll.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
@echo off
REM destroys all K8s services in "phobos-web" namespace
REM destroys all K8s services in "akkastress" namespace
REM we don't destroy the namespace itself since it contains the Azure Storage secrets we need for Akka.Persistence.Azure

kubectl delete ns akkastress
set namespace=akkastress
set location=%~dp0/environment

echo "Destroying K8s resources from [%location%] in namespace [%namespace%]"

echo "Using namespace [%namespace%] going forward..."

echo "Creating configurations from YAML files in [%location%/configs]"
for %%f in (%location%/configs/*.yaml) do (
echo "Deploying %%~nxf"
kubectl delete -f "%location%/configs/%%~nxf" -n "%namespace%"
)

echo "Creating environment-specific services from YAML files in [%location%]"
for %%f in (%location%/*.yaml) do (
echo "Deploying %%~nxf"
kubectl delete -f "%location%/%%~nxf" -n "%namespace%"
)

echo "Creating all services..."
for %%f in (%~dp0/services/*.yaml) do (
echo "Deploying %%~nxf"
kubectl delete -f "%~dp0/services/%%~nxf" -n "%namespace%"
)

echo "All services started... Printing K8s output.."
kubectl get all -n "%namespace%"
6 changes: 3 additions & 3 deletions k8s/prod/services/prod-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ spec:
emptyDir: {}
containers:
- name: frontend
image: akkalargescaleimagesdd1c690b.azurecr.io/akkadotnet.frontend:0.4.1
image: akkalargescaleimages64b06635.azurecr.io/akkadotnet.frontend:0.4.3
env:
- name: POD_NAME
valueFrom:
Expand Down Expand Up @@ -207,7 +207,7 @@ spec:
emptyDir: {}
containers:
- name: backend
image: akkalargescaleimagesdd1c690b.azurecr.io/akkadotnet.backend:0.4.1
image: akkalargescaleimages64b06635.azurecr.io/akkadotnet.backend:0.4.3
env:
- name: POD_NAME
valueFrom:
Expand All @@ -220,7 +220,7 @@ spec:
- name: StressOptions__PersistenceOptions__AzureStorageConnectionString
valueFrom:
secretKeyRef:
name: azure-storage-connection
name: azure-connection-string
key: AzureConnectionString
envFrom:
- configMapRef:
Expand Down
23 changes: 22 additions & 1 deletion prod/aks-cluster/MyStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,27 @@ public MyStack()
}
}, k8sCustomResourceOptions);

var appnamespace = new Pulumi.Kubernetes.Core.V1.Namespace("akkastress", new NamespaceArgs()
{
Metadata = new ObjectMetaArgs(){
Name = "akkastress"
},
ApiVersion = "v1",
Kind = "Namespace"
}, k8sCustomResourceOptions);

var appNamespaceProvider = new Pulumi.Kubernetes.Provider("k8s-akkastress-provider", new Pulumi.Kubernetes.ProviderArgs()
{
KubeConfig = KubeConfig,
Namespace = appnamespace.Metadata.Apply(c => c.Name)
});

var k8sCustomAppResourceOptions = new CustomResourceOptions
{
Provider = appNamespaceProvider,
};

// need to create this resource in the `akkastress` namespace
var azureConnectionStringSecret = new Pulumi.Kubernetes.Core.V1.Secret("azure-storage-secret", new SecretArgs()
{
StringData =
Expand All @@ -234,7 +255,7 @@ public MyStack()
{
Name = "azure-connection-string"
}
});
}, k8sCustomAppResourceOptions);
}

[Output("kubeconfig")] public Output<string> KubeConfig { get; set; }
Expand Down
7 changes: 7 additions & 0 deletions prod/apm-kubernetes/install-helm-charts.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
REM installs all Helm charts

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add datalust https://helm.datalust.co
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Copyright>Copyright © 2022 Petabridge</Copyright>
<Authors>Petabridge</Authors>
<VersionPrefix>0.4.3</VersionPrefix>
<PackageReleaseNotes>• Testing deployments.</PackageReleaseNotes>
<PackageReleaseNotes>• Bumped Akka.Remote max-frame-size to 1mb%2C buffer sizes to 2mb.</PackageReleaseNotes>
<PackageIconUrl>
</PackageIconUrl>
<PackageProjectUrl>
Expand Down

0 comments on commit 85a30d5

Please sign in to comment.