Unverified Commit acd02914 authored by Gary van Woerkens's avatar Gary van Woerkens Committed by GitHub
Browse files

fix: No k8s (#548)



* feat: Switch to no-k8s mode.

* Change regiter job extend.

* Remove custom register job.

* Use Kaniko.

* Rename configmap files.

* Enable Kapp.

* Use autodevops no-k8s tagged version.

* Update .gitlab-ci.yml

* Update autodevops version.

* Update .socialgouv config.

* Update autodevops version.

* Update autodevops version.

* fix: upgrade docker and gitlab-ci
Co-authored-by: Julien Bouquillon's avatarJulien Bouquillon <julien.bouquillon@sg.social.gouv.fr>
parent 87279599
Pipeline #109635 canceled with stages
in 1 minute and 27 seconds
include:
- project: SocialGouv/gitlab-ci-yml
file: /autodevops.yml
ref: v22.0.0
ref: v22.1.8
variables:
AUTO_DEVOPS_KANIKO: "🐕"
AUTO_DEVOPS_ENABLE_KAPP: "😱"
AUTO_DEVOPS_RELEASE_AUTO: "🔖"
# AUTO_DEVOPS_PRODUCTION_AUTO: "🚀"
AUTO_DEVOPS_PRODUCTION_AUTO: "🚀"
# NOTE(douglasduteil): No install :(
# sharing the node_modules is too slow...
......@@ -46,11 +48,3 @@ Build:
expire_in: 1 day
paths:
- out
# NOTE(julienbouquillon): use custom register job
# By default, kosko-charts use a "/app" for default docker images names
# TODO: discuss
Register image:
extends: .autodevops_register_image
variables:
IMAGE_NAME: $CI_REGISTRY_IMAGE/app
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`kosko generate --dev 1`] = `
"---
metadata:
annotations:
field.cattle.io/creatorId: gitlab
field.cattle.io/projectId: 'c-bd7z2:p-2qlgk'
git/branch: master
git/remote: >-
https://gitlab-ci-token:[MASKED]@gitlab.factory.social.gouv.fr/SocialGouv/work-in-france.git
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: master-dev2
app.gitlab.com/env.name: master-dev2
labels:
azure-pg-admin-user: work-in-france
application: master-dev2-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
name: work-in-france-50-master-dev2
apiVersion: v1
kind: Namespace
---
metadata:
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: master-dev2
app.gitlab.com/env.name: master-dev2
labels:
app: app
application: master-dev2-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
component: nginx
name: app
namespace: work-in-france-50-master-dev2
spec:
replicas: 1
selector:
matchLabels:
app: app
template:
metadata:
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: master-dev2
app.gitlab.com/env.name: master-dev2
labels:
app: app
application: master-dev2-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
component: nginx
spec:
containers:
- image: >-
registry.gitlab.factory.social.gouv.fr/socialgouv/work-in-france/app:0123456789abcdefghijklmnopqrstuvwxyz0123
livenessProbe:
failureThreshold: 6
httpGet:
path: /index.html
port: http
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 5
name: app
ports:
- containerPort: 80
name: http
readinessProbe:
failureThreshold: 15
httpGet:
path: /index.html
port: http
initialDelaySeconds: 0
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 32Mi
startupProbe:
failureThreshold: 12
httpGet:
path: /index.html
port: http
periodSeconds: 5
envFrom:
- configMapRef:
name: app-configmap
apiVersion: apps/v1
kind: Deployment
---
metadata:
name: app-configmap
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: master-dev2
app.gitlab.com/env.name: master-dev2
labels:
application: master-dev2-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
namespace: work-in-france-50-master-dev2
data:
BACKOFFICE_API_URL: 'https://work-in-france-backoffice.fabrique.social.gouv.fr'
DS_AGGREGATOR_API_URL: 'https://wif.ds-aggregator.fabrique.social.gouv.fr'
apiVersion: v1
kind: ConfigMap
---
metadata:
labels:
app: app
application: master-dev2-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
name: app
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: master-dev2
app.gitlab.com/env.name: master-dev2
namespace: work-in-france-50-master-dev2
spec:
ports:
- name: http
port: 80
targetPort: 80
selector:
app: app
type: ClusterIP
apiVersion: v1
kind: Service
---
metadata:
annotations:
kubernetes.io/ingress.class: nginx
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: master-dev2
app.gitlab.com/env.name: master-dev2
labels:
app: app
application: master-dev2-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
name: app
namespace: work-in-france-50-master-dev2
spec:
rules:
- host: master-dev2-work-in-france.dev2.fabrique.social.gouv.fr
http:
paths:
- backend:
serviceName: app
servicePort: 80
path: /
tls:
- hosts:
- master-dev2-work-in-france.dev2.fabrique.social.gouv.fr
secretName: wildcard-crt
apiVersion: extensions/v1beta1
kind: Ingress
"
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`kosko generate --preprod 1`] = `
"---
metadata:
annotations:
field.cattle.io/creatorId: gitlab
field.cattle.io/projectId: 'c-bd7z2:p-2qlgk'
git/branch: v1.2.3
git/remote: >-
https://gitlab-ci-token:[MASKED]@gitlab.factory.social.gouv.fr/SocialGouv/work-in-france.git
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: preprod-dev2
app.gitlab.com/env.name: preprod-dev2
labels:
azure-pg-admin-user: work-in-france
application: v1-2-3-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
name: work-in-france-50-preprod-dev2
apiVersion: v1
kind: Namespace
---
metadata:
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: preprod-dev2
app.gitlab.com/env.name: preprod-dev2
labels:
app: app
application: v1-2-3-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
component: nginx
name: app
namespace: work-in-france-50-preprod-dev2
spec:
replicas: 1
selector:
matchLabels:
app: app
template:
metadata:
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: preprod-dev2
app.gitlab.com/env.name: preprod-dev2
labels:
app: app
application: v1-2-3-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
component: nginx
spec:
containers:
- image: >-
registry.gitlab.factory.social.gouv.fr/socialgouv/work-in-france/app:1.2.3
livenessProbe:
failureThreshold: 6
httpGet:
path: /index.html
port: http
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 5
name: app
ports:
- containerPort: 80
name: http
readinessProbe:
failureThreshold: 15
httpGet:
path: /index.html
port: http
initialDelaySeconds: 0
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 32Mi
startupProbe:
failureThreshold: 12
httpGet:
path: /index.html
port: http
periodSeconds: 5
envFrom:
- configMapRef:
name: app-configmap
apiVersion: apps/v1
kind: Deployment
---
metadata:
name: app-configmap
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: preprod-dev2
app.gitlab.com/env.name: preprod-dev2
labels:
application: v1-2-3-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
namespace: work-in-france-50-preprod-dev2
data:
BACKOFFICE_API_URL: 'https://work-in-france-backoffice.fabrique.social.gouv.fr'
DS_AGGREGATOR_API_URL: 'https://wif.ds-aggregator.fabrique.social.gouv.fr'
apiVersion: v1
kind: ConfigMap
---
metadata:
labels:
app: app
application: v1-2-3-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
name: app
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: preprod-dev2
app.gitlab.com/env.name: preprod-dev2
namespace: work-in-france-50-preprod-dev2
spec:
ports:
- name: http
port: 80
targetPort: 80
selector:
app: app
type: ClusterIP
apiVersion: v1
kind: Service
---
metadata:
annotations:
kubernetes.io/ingress.class: nginx
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: preprod-dev2
app.gitlab.com/env.name: preprod-dev2
labels:
app: app
application: v1-2-3-work-in-france
owner: work-in-france
team: work-in-france
cert: wildcard
name: app
namespace: work-in-france-50-preprod-dev2
spec:
rules:
- host: preprod-work-in-france.dev2.fabrique.social.gouv.fr
http:
paths:
- backend:
serviceName: app
servicePort: 80
path: /
tls:
- hosts:
- preprod-work-in-france.dev2.fabrique.social.gouv.fr
secretName: wildcard-crt
apiVersion: extensions/v1beta1
kind: Ingress
"
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`kosko generate --prod 1`] = `
"---
metadata:
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: prod2
app.gitlab.com/env.name: prod2
labels:
app: app
application: work-in-france
owner: work-in-france
team: work-in-france
component: nginx
name: app
namespace: work-in-france
spec:
replicas: 1
selector:
matchLabels:
app: app
template:
metadata:
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: prod2
app.gitlab.com/env.name: prod2
labels:
app: app
application: work-in-france
owner: work-in-france
team: work-in-france
component: nginx
spec:
containers:
- image: >-
registry.gitlab.factory.social.gouv.fr/socialgouv/work-in-france/app:1.2.3
livenessProbe:
failureThreshold: 6
httpGet:
path: /index.html
port: http
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 5
name: app
ports:
- containerPort: 80
name: http
readinessProbe:
failureThreshold: 15
httpGet:
path: /index.html
port: http
initialDelaySeconds: 0
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 32Mi
startupProbe:
failureThreshold: 12
httpGet:
path: /index.html
port: http
periodSeconds: 5
envFrom:
- configMapRef:
name: app-configmap
apiVersion: apps/v1
kind: Deployment
---
metadata:
name: app-configmap
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: prod2
app.gitlab.com/env.name: prod2
labels:
application: work-in-france
owner: work-in-france
team: work-in-france
namespace: work-in-france
data:
BACKOFFICE_API_URL: 'https://work-in-france-backoffice.fabrique.social.gouv.fr'
DS_AGGREGATOR_API_URL: 'https://wif.ds-aggregator.fabrique.social.gouv.fr'
apiVersion: v1
kind: ConfigMap
---
metadata:
labels:
app: app
application: work-in-france
owner: work-in-france
team: work-in-france
name: app
annotations:
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: prod2
app.gitlab.com/env.name: prod2
namespace: work-in-france
spec:
ports:
- name: http
port: 80
targetPort: 80
selector:
app: app
type: ClusterIP
apiVersion: v1
kind: Service
---
metadata:
annotations:
kubernetes.io/ingress.class: nginx
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
kubernetes.io/tls-acme: 'true'
app.gitlab.com/app: socialgouv-work-in-france
app.gitlab.com/env: prod2
app.gitlab.com/env.name: prod2
labels:
app: app
application: work-in-france
owner: work-in-france
team: work-in-france
name: app
namespace: work-in-france
spec:
rules:
- host: work-in-france.fabrique.social.gouv.fr
http:
paths:
- backend:
serviceName: app
servicePort: 80
path: /
tls:
- hosts:
- work-in-france.fabrique.social.gouv.fr
secretName: app-crt
apiVersion: extensions/v1beta1
kind: Ingress
"
`;
//
import { getEnvManifests } from "@socialgouv/kosko-charts/testing";
import { project } from "@socialgouv/kosko-charts/testing/fake/gitlab-ci.env";
jest.setTimeout(1000 * 60);
test("kosko generate --dev", async () => {
expect(
await getEnvManifests("dev", "", {
...project("work-in-france").dev,
KUBE_NAMESPACE: "work-in-france-50-master-dev2",
RANCHER_PROJECT_ID: "c-bd7z2:p-2qlgk",
})
).toMatchSnapshot();
});
//
import { getEnvManifests } from "@socialgouv/kosko-charts/testing";
import { project } from "@socialgouv/kosko-charts/testing/fake/gitlab-ci.env";
jest.setTimeout(1000 * 60);
test("kosko generate --preprod", async () => {
expect(
await getEnvManifests("preprod", "", {
...project("work-in-france").preprod,
KUBE_NAMESPACE: "work-in-france-50-preprod-dev2",
RANCHER_PROJECT_ID: "c-bd7z2:p-2qlgk",
})
).toMatchSnapshot();
});
//
import { getEnvManifests } from "@socialgouv/kosko-charts/testing";
import { project } from "@socialgouv/kosko-charts/testing/fake/gitlab-ci.env";
jest.setTimeout(1000 * 60);
test("kosko generate --prod", async () => {
expect(
await getEnvManifests("prod", "'!(_*)'", {
...project("work-in-france").prod,
})
).toMatchSnapshot();
});
import { createNamespace } from "@socialgouv/kosko-charts/components/namespace";
const manifests = createNamespace();
export default manifests;
import env from "@kosko/env";
import { create } from "@socialgouv/kosko-charts/components/nginx";
const manifests = create("app", {
env
});
export default manifests;
../prod/app.configmap.yaml
\ No newline at end of file
../prod/app.configmap.yaml
\ No newline at end of file
components = ["*"]
require = ["ts-node/register"]
{
"babel": {
"plugins": [
[
"@babel/plugin-transform-modules-commonjs"
]
]