From 34df7a153ac8f9b517ab7cdd06deb3db5ea5c458 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Thu, 15 Jun 2023 11:21:56 +0200 Subject: [PATCH] clean(structure): using MYAPPLICATION instead of app --- main.mk | 5 +++- .../Dockerfile | 0 .../Dockerfile | 0 misc/k8s/kind/kind-cluster.yaml | 2 +- .../configurations/cnpg-cluster.yaml | 0 .../kustomization.yaml | 12 ++++---- .../MYAPPLICATION-cnpg-cluster.yaml} | 10 +++---- .../k8s/kustomization/base/kustomization.yaml | 6 ++-- .../MYAPPLICATION-kube/kustomization.yaml | 6 ++++ .../resources/MYAPPLICATION-deployment.yaml} | 28 +++++++++---------- .../resources/MYAPPLICATION-service.yaml} | 8 +++--- .../resources/app-kube/kustomization.yaml | 6 ---- .../overlays/dev/kustomization.yaml | 4 +-- ...aml => MYAPPLICATION-update-replicas.yaml} | 4 +-- .../overlays/dev/resources/ingress.yaml | 6 ++-- .../overlays/dev/resources/namespace.yaml | 2 +- skaffold.yaml | 4 +-- 17 files changed, 53 insertions(+), 50 deletions(-) rename misc/images/{app-kube => MYAPPLICATION-kube}/Dockerfile (100%) rename misc/images/{app-standalone => MYAPPLICATION-standalone}/Dockerfile (100%) rename misc/k8s/kustomization/base/components/{app-cnpg => MYAPPLICATION-cnpg}/configurations/cnpg-cluster.yaml (100%) rename misc/k8s/kustomization/base/components/{app-cnpg => MYAPPLICATION-cnpg}/kustomization.yaml (66%) rename misc/k8s/kustomization/base/components/{app-cnpg/resources/app-cnpg-cluster.yaml => MYAPPLICATION-cnpg/resources/MYAPPLICATION-cnpg-cluster.yaml} (54%) create mode 100644 misc/k8s/kustomization/base/resources/MYAPPLICATION-kube/kustomization.yaml rename misc/k8s/kustomization/base/resources/{app-kube/resources/app-deployment.yaml => MYAPPLICATION-kube/resources/MYAPPLICATION-deployment.yaml} (58%) rename misc/k8s/kustomization/base/resources/{app-kube/resources/app-service.yaml => MYAPPLICATION-kube/resources/MYAPPLICATION-service.yaml} (50%) delete mode 100644 misc/k8s/kustomization/base/resources/app-kube/kustomization.yaml rename misc/k8s/kustomization/overlays/dev/patches/{update-replicas-for-app.yaml => MYAPPLICATION-update-replicas.yaml} (56%) diff --git a/main.mk b/main.mk index 49e6499..3327adc 100644 --- a/main.mk +++ b/main.mk @@ -36,7 +36,6 @@ define release_image docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG) endef - #list: build: ${IMAGES_DIR}/* @for name in $(basename $(notdir $^)); do \ @@ -74,4 +73,8 @@ tools/bin/bash_unit: mkdir -p tools/bin cd tools/bin && bash <(curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh) +up: + skaffold dev -p dev --default-repo ${IMAGE_REPO} + + ##include recipes/*.mk diff --git a/misc/images/app-kube/Dockerfile b/misc/images/MYAPPLICATION-kube/Dockerfile similarity index 100% rename from misc/images/app-kube/Dockerfile rename to misc/images/MYAPPLICATION-kube/Dockerfile diff --git a/misc/images/app-standalone/Dockerfile b/misc/images/MYAPPLICATION-standalone/Dockerfile similarity index 100% rename from misc/images/app-standalone/Dockerfile rename to misc/images/MYAPPLICATION-standalone/Dockerfile diff --git a/misc/k8s/kind/kind-cluster.yaml b/misc/k8s/kind/kind-cluster.yaml index 5ac7351..923fafb 100644 --- a/misc/k8s/kind/kind-cluster.yaml +++ b/misc/k8s/kind/kind-cluster.yaml @@ -1,6 +1,6 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 -name: mse-dev +name: dev-cluster networking: podSubnet: "10.110.0.0/16" serviceSubnet: "10.115.0.0/16" diff --git a/misc/k8s/kustomization/base/components/app-cnpg/configurations/cnpg-cluster.yaml b/misc/k8s/kustomization/base/components/MYAPPLICATION-cnpg/configurations/cnpg-cluster.yaml similarity index 100% rename from misc/k8s/kustomization/base/components/app-cnpg/configurations/cnpg-cluster.yaml rename to misc/k8s/kustomization/base/components/MYAPPLICATION-cnpg/configurations/cnpg-cluster.yaml diff --git a/misc/k8s/kustomization/base/components/app-cnpg/kustomization.yaml b/misc/k8s/kustomization/base/components/MYAPPLICATION-cnpg/kustomization.yaml similarity index 66% rename from misc/k8s/kustomization/base/components/app-cnpg/kustomization.yaml rename to misc/k8s/kustomization/base/components/MYAPPLICATION-cnpg/kustomization.yaml index 747a149..f66d9fe 100644 --- a/misc/k8s/kustomization/base/components/app-cnpg/kustomization.yaml +++ b/misc/k8s/kustomization/base/components/MYAPPLICATION-cnpg/kustomization.yaml @@ -8,24 +8,24 @@ configurations: - ./configurations/cnpg-cluster.yaml resources: -- ./resources/app-cnpg-cluster.yaml +- ./resources/MYAPPLICATION-cnpg-cluster.yaml secretgenerator: -- name: app-postgres-admin +- name: MYAPPLICATION-postgres-admin type: secret literals: - username=postgres - password=notsosecret -- name: app-postgres-user +- name: MYAPPLICATION-postgres-user type: Secret literals: - - username=app + - username=MYAPPLICATION - password=NotSoSecretButThisIsBad vars: -- name: APP_DATABASE_SERVICE_NAME +- name: MYAPPLICATION_DATABASE_SERVICE_NAME objref: - name: app-postgres + name: MYAPPLICATION-postgres kind: Cluster apiVersion: postgresql.cnpg.io/v1 fieldref: diff --git a/misc/k8s/kustomization/base/components/app-cnpg/resources/app-cnpg-cluster.yaml b/misc/k8s/kustomization/base/components/MYAPPLICATION-cnpg/resources/MYAPPLICATION-cnpg-cluster.yaml similarity index 54% rename from misc/k8s/kustomization/base/components/app-cnpg/resources/app-cnpg-cluster.yaml rename to misc/k8s/kustomization/base/components/MYAPPLICATION-cnpg/resources/MYAPPLICATION-cnpg-cluster.yaml index a6d977f..94c9e00 100644 --- a/misc/k8s/kustomization/base/components/app-cnpg/resources/app-cnpg-cluster.yaml +++ b/misc/k8s/kustomization/base/components/MYAPPLICATION-cnpg/resources/MYAPPLICATION-cnpg-cluster.yaml @@ -1,17 +1,17 @@ apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: - name: app-postgres + name: MYAPPLICATION-postgres spec: instances: 3 primaryUpdateStrategy: unsupervised superuserSecret: - name: app-postgres-admin + name: MYAPPLICATION-postgres-admin bootstrap: initdb: - database: app - owner: app + database: MYAPPLICATION + owner: MYAPPLICATION secret: - name: app-postgres-user + name: MYAPPLICATION-postgres-user storage: size: 20Gi diff --git a/misc/k8s/kustomization/base/kustomization.yaml b/misc/k8s/kustomization/base/kustomization.yaml index c577b80..7c35edb 100644 --- a/misc/k8s/kustomization/base/kustomization.yaml +++ b/misc/k8s/kustomization/base/kustomization.yaml @@ -1,10 +1,10 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namePrefix: app- +namePrefix: MYAPPLICATION- components: -- components/app-cnpg +- components/MYAPPLICATION-cnpg resources: -- resources/app-kube +- resources/MYAPPLICATION-kube diff --git a/misc/k8s/kustomization/base/resources/MYAPPLICATION-kube/kustomization.yaml b/misc/k8s/kustomization/base/resources/MYAPPLICATION-kube/kustomization.yaml new file mode 100644 index 0000000..880026b --- /dev/null +++ b/misc/k8s/kustomization/base/resources/MYAPPLICATION-kube/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- ./resources/MYAPPLICATION-service.yaml +- ./resources/MYAPPLICATION-deployment.yaml diff --git a/misc/k8s/kustomization/base/resources/app-kube/resources/app-deployment.yaml b/misc/k8s/kustomization/base/resources/MYAPPLICATION-kube/resources/MYAPPLICATION-deployment.yaml similarity index 58% rename from misc/k8s/kustomization/base/resources/app-kube/resources/app-deployment.yaml rename to misc/k8s/kustomization/base/resources/MYAPPLICATION-kube/resources/MYAPPLICATION-deployment.yaml index e1d2014..3721a59 100644 --- a/misc/k8s/kustomization/base/resources/app-kube/resources/app-deployment.yaml +++ b/misc/k8s/kustomization/base/resources/MYAPPLICATION-kube/resources/MYAPPLICATION-deployment.yaml @@ -2,26 +2,26 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - io.kompose.service: app - name: app + io.kompose.service: MYAPPLICATION + name: MYAPPLICATION spec: replicas: 3 selector: matchLabels: - io.kompose.service: app + io.kompose.service: MYAPPLICATION strategy: type: Recreate template: metadata: labels: - io.kompose.service: app + io.kompose.service: MYAPPLICATION spec: restartPolicy: Always containers: - - image: reg.cadoles.com/cadoles/app-kube + - image: reg.cadoles.com/cadoles/MYAPPLICATION-kube imagePullPolicy: Always - name: app-php-fpm + name: MYAPPLICATION-php-fpm args: ["/usr/sbin/php-fpm81", "-F", "-e"] resources: {} env: @@ -33,22 +33,22 @@ spec: value: 128m - name: PHP_FPM_LOG_LEVEL value: warning - - name: APP_DATABASE_SERVICE_NAME - value: $(APP_DATABASE_SERVICE_NAME)-rw - - image: reg.cadoles.com/cadoles/app-kube + - name: MYAPPLICATION_DATABASE_SERVICE_NAME + value: $(MYAPPLICATION_DATABASE_SERVICE_NAME)-rw + - image: reg.cadoles.com/cadoles/MYAPPLICATION-kube imagePullPolicy: Always - name: app-nginx + name: MYAPPLICATION-nginx args: ["/usr/sbin/nginx"] env: - - name: NGINX_APP_UPSTREAM_BACKEND_SERVER + - name: NGINX_MYAPPLICATION_UPSTREAM_BACKEND_SERVER value: 127.0.0.1:9000 - - name: NGINX_APP_ROOT + - name: NGINX_MYAPPLICATION_ROOT value: "/public" - - name: NGINX_APP_PHP_INDEX + - name: NGINX_MYAPPLICATION_PHP_INDEX value: "/index.php" - name: NGINX_ERROR_LOG_LEVEL value: "warn" - - name: NGINX_APP_PHP_NON_FILE_PATTERN + - name: NGINX_MYAPPLICATION_PHP_NON_FILE_PATTERN value: "^/index\\.php(/|$)" ports: - containerPort: 8080 diff --git a/misc/k8s/kustomization/base/resources/app-kube/resources/app-service.yaml b/misc/k8s/kustomization/base/resources/MYAPPLICATION-kube/resources/MYAPPLICATION-service.yaml similarity index 50% rename from misc/k8s/kustomization/base/resources/app-kube/resources/app-service.yaml rename to misc/k8s/kustomization/base/resources/MYAPPLICATION-kube/resources/MYAPPLICATION-service.yaml index de8d1f2..4887dd7 100644 --- a/misc/k8s/kustomization/base/resources/app-kube/resources/app-service.yaml +++ b/misc/k8s/kustomization/base/resources/MYAPPLICATION-kube/resources/MYAPPLICATION-service.yaml @@ -2,13 +2,13 @@ apiVersion: v1 kind: Service metadata: labels: - io.kompose.service: app - name: app + io.kompose.service: MYAPPLICATION + name: MYAPPLICATION spec: type: ClusterIP ports: - - name: app-http + - name: MYAPPLICATION-http port: 80 targetPort: 8080 selector: - io.kompose.service: app + io.kompose.service: MYAPPLICATION diff --git a/misc/k8s/kustomization/base/resources/app-kube/kustomization.yaml b/misc/k8s/kustomization/base/resources/app-kube/kustomization.yaml deleted file mode 100644 index b45e866..0000000 --- a/misc/k8s/kustomization/base/resources/app-kube/kustomization.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -resources: -- ./resources/app-service.yaml -- ./resources/app-deployment.yaml diff --git a/misc/k8s/kustomization/overlays/dev/kustomization.yaml b/misc/k8s/kustomization/overlays/dev/kustomization.yaml index c2689b1..bf798dc 100644 --- a/misc/k8s/kustomization/overlays/dev/kustomization.yaml +++ b/misc/k8s/kustomization/overlays/dev/kustomization.yaml @@ -1,6 +1,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: app-dev +namespace: MYAPPLICATION-dev resources: - ../../base @@ -8,7 +8,7 @@ resources: - resources/ingress.yaml patches: -- path: patches/update-replicas-for-app.yaml +- path: patches/MYAPPLICATION-update-replicas.yaml - path: patches/add-registry-pull-secret.yaml target: kind: Deployment diff --git a/misc/k8s/kustomization/overlays/dev/patches/update-replicas-for-app.yaml b/misc/k8s/kustomization/overlays/dev/patches/MYAPPLICATION-update-replicas.yaml similarity index 56% rename from misc/k8s/kustomization/overlays/dev/patches/update-replicas-for-app.yaml rename to misc/k8s/kustomization/overlays/dev/patches/MYAPPLICATION-update-replicas.yaml index 534ee66..342f4b5 100644 --- a/misc/k8s/kustomization/overlays/dev/patches/update-replicas-for-app.yaml +++ b/misc/k8s/kustomization/overlays/dev/patches/MYAPPLICATION-update-replicas.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - io.kompose.service: app - name: app + io.kompose.service: MYAPPLICATION + name: MYAPPLICATION spec: replicas: 1 diff --git a/misc/k8s/kustomization/overlays/dev/resources/ingress.yaml b/misc/k8s/kustomization/overlays/dev/resources/ingress.yaml index aa88fe3..256c5d0 100644 --- a/misc/k8s/kustomization/overlays/dev/resources/ingress.yaml +++ b/misc/k8s/kustomization/overlays/dev/resources/ingress.yaml @@ -1,7 +1,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: app + name: MYAPPLICATION annotations: nginx.ingress.kubernetes.io/proxy-body-size: "138m" nginx.ingress.kubernetes.io/enable-cors: "true" #cf 01 @@ -9,13 +9,13 @@ metadata: spec: ingressClassName: nginx rules: - - host: app.dev.local + - host: MYAPPLICATION.dev.local http: paths: - path: / pathType: Prefix backend: service: - name: app + name: MYAPPLICATION port: number: 8080 diff --git a/misc/k8s/kustomization/overlays/dev/resources/namespace.yaml b/misc/k8s/kustomization/overlays/dev/resources/namespace.yaml index d96e58f..04c104f 100644 --- a/misc/k8s/kustomization/overlays/dev/resources/namespace.yaml +++ b/misc/k8s/kustomization/overlays/dev/resources/namespace.yaml @@ -1,4 +1,4 @@ apiVersion: v1 kind: Namespace metadata: - name: app-dev + name: MYAPPLICATION-dev diff --git a/skaffold.yaml b/skaffold.yaml index 2786aa8..519bf13 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -29,7 +29,7 @@ build: sha256: {} artifacts: - - image: reg.cadoles.com/cadoles/app-kube + - image: reg.cadoles.com/cadoles/MYAPPLICATION-kube context: . sync: infer: @@ -41,7 +41,7 @@ build: - composer.json - composer.lock kaniko: - dockerfile: misc/images/app-kube/Dockerfile + dockerfile: misc/images/MYAPPLICATION-kube/Dockerfile cache: {} deploy: