Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix routing /2 #6105

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/_docs_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
else
cat >> "$GITHUB_ENV" <<EOF
WERF_RELEASE=werfio-documentation-${{ inputs.env }}
WERF_SET_GITHUB_REF=global.github_ref=v1.2.3-dev
WERF_SET_GITHUB_REF=global.github_ref=main
EOF
fi

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/docs_deploy_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
deploy-test:
uses: ./.github/workflows/_docs_deploy.yml
with:
persistent: true
env: test
secrets:
kubeConfig: ${{ secrets.KUBECONFIG_BASE64_DEV }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/docs_deploy_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
deploy-test:
uses: ./.github/workflows/_docs_deploy.yml
with:
persistent: true
env: test
secrets:
kubeConfig: ${{ secrets.KUBECONFIG_BASE64_DEV }}
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,7 @@

### Docs

* New docs for running werf in container (experimental): [https://werf.io/documentation/v1.2.46/advanced/ci_cd/run_in_container/run_in_docker_container.html](https://werf.io/documentation/v1.2.46/advanced/ci_cd/run_in_container/run_in_docker_container.html).
* New docs for running werf in container (experimental): [https://werf.io/docs/v1.2.46/advanced/ci_cd/run_in_container/run_in_docker_container.html](https://werf.io/docs/v1.2.46/advanced/ci_cd/run_in_container/run_in_docker_container.html).

### Bug Fixes

Expand Down Expand Up @@ -2655,7 +2655,7 @@
* For cleaning custom tags and associated content-based tag are treated as one:
* The cleanup command deletes/keeps all tags following the cleaning policies for content-based tags.
* The cleanup command keeps all when any tag is used in k8s.
* By default, alias tags are not allowed by giterminism, and it is necessary to use [werf-giterminism.yaml](https://werf.io/documentation/v1.2/reference/werf_giterminism_yaml.html) to activate options:
* By default, alias tags are not allowed by giterminism, and it is necessary to use [werf-giterminism.yaml](https://werf.io/docs/v1.2/reference/werf_giterminism_yaml.html) to activate options:
```yaml
giterminismConfigVersion: 1
cli:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ werf is an Open Source project, and we are thrilled to develop and improve it in

## Feedback

The first thing we recommend is to check the existing [issues](https://github.com/werf/werf/issues), [discussion threads](https://github.com/werf/werf/discussions), and [documentation](https://werf.io/documentation/v2/) - there may already be a discussion or solution on your topic. If not, choose the appropriate way to address the issue on [the new issue form](https://github.com/werf/werf/issues/new/choose).
The first thing we recommend is to check the existing [issues](https://github.com/werf/werf/issues), [discussion threads](https://github.com/werf/werf/discussions), and [documentation](https://werf.io/docs/v2/) - there may already be a discussion or solution on your topic. If not, choose the appropriate way to address the issue on [the new issue form](https://github.com/werf/werf/issues/new/choose).

## Contributing code

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ What makes werf special:

## Quickstart

The [quickstart guide](https://werf.io/documentation/quickstart.html) shows how to set up the deployment of an example application (a cool voting app in our case) using werf.
The [quickstart guide](https://werf.io/docs/quickstart.html) shows how to set up the deployment of an example application (a cool voting app in our case) using werf.

## Installation

The [installation guide](https://werf.io/installation.html) helps set up and use werf both locally and in your CI system.

## Documentation

Detailed usage and reference for werf are available in [documentation](https://werf.io/documentation/) in multiple languages.
Detailed usage and reference for werf are available in [documentation](https://werf.io/docs/) in multiple languages.

Developers can get all the necessary knowledge about application delivery in Kubernetes (including basic understanding of K8s primitives) in the [werf guides](https://werf.io/guides.html). They provide ready-to-use examples for popular frameworks, including Node.js (JavaScript), Spring Boot (Java), Django (Python), Rails (Ruby), and Laravel (PHP).

Expand Down
2 changes: 1 addition & 1 deletion cmd/werf/docs/md_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func replaceLinks(s string) string {
links := xurls.Relaxed.FindAllString(s, -1)
for _, link := range links {
linkText := link
for _, prefix := range []string{"werf.io/documentation", "https://werf.io/documentation"} {
for _, prefix := range []string{"werf.io/docs", "https://werf.io/docs"} {
if strings.HasPrefix(link, prefix) {
link = strings.TrimPrefix(link, prefix)
link = fmt.Sprintf("{{ \"%s\" | true_relative_url }}", link)
Expand Down
40 changes: 24 additions & 16 deletions docs/.helm/templates/10-app.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
{{- $_ := set . "Version" ( splitList "/" .Values.global.github_ref | last ) }}
{{- $_ := set . "VersionURLNormalized" ( printf "%s" .Version | lower | replace "+" "-plus-" | replace "_" "-u-" ) }}
{{- $_ := set . "VersionDNSNormalized" ( printf "%s" .Version | lower | replace "+" "-plus-" | replace "_" "-u-" | replace "." "-dot-" ) }}
{{- $refs := list $.Values.global.github_ref }}
{{- if eq $.Values.werf.env "test" }}
{{- $refs = concat $refs (list "v2.0.3" "v1.2.294+fix1") }}
{{- end }}

{{- range $_, $ref := $refs }}

{{- $version := splitList "/" $ref | last }}
{{- $versionDNSNormalized := printf "%s" $version | lower | replace "+" "-plus-" | replace "_" "-u-" | replace "." "-dot-" }}

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
name: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
annotations:
"werf.io/replicas-on-creation": "1"
labels:
service: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
service: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
spec:
minReadySeconds: 5
revisionHistoryLimit: 5
selector:
matchLabels:
service: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
service: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
template:
metadata:
labels:
service: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
service: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
spec:
imagePullSecrets:
- name: github-werfio
priorityClassName: {{ pluck .Values.werf.env .Values.priorityClassName | first | default .Values.priorityClassName._default }}
priorityClassName: {{ pluck $.Values.werf.env $.Values.priorityClassName | first | default $.Values.priorityClassName._default }}
containers:
- name: web
command: ["nginx", "-g", "daemon off;"]
image: {{ index .Values.werf.image "web" }}
{{- include "resources" . | indent 10 }}
image: {{ index $.Values.werf.image "web" }}
{{- include "resources" $ | indent 10 }}
ports:
- containerPort: 80
name: http
Expand All @@ -48,11 +55,11 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
name: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
spec:
clusterIP: None
selector:
service: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
service: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
ports:
- name: http
port: 80
Expand All @@ -61,21 +68,22 @@ spec:
apiVersion: autoscaling.k8s.io/v1beta2
kind: VerticalPodAutoscaler
metadata:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
name: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
spec:
targetRef:
apiVersion: "apps/v1"
kind: Deployment
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
name: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
updatePolicy:
updateMode: "Initial"
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
name: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
spec:
maxUnavailable: 1
selector:
matchLabels:
service: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
service: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
{{- end }}
90 changes: 24 additions & 66 deletions docs/.helm/templates/20-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,80 +1,38 @@
{{- $_ := set . "Version" ( splitList "/" .Values.global.github_ref | last ) }}
{{- if eq .Version "main" }}
{{- $_ := set . "VersionURLNormalized" "v2" }}
{{- else }}
{{- $_ := set . "VersionURLNormalized" ( printf "%s" .Version | lower | replace "+" "-plus-" | replace "_" "-u-" ) }}
{{- end }}
{{- $_ := set . "VersionDNSNormalized" ( printf "%s" .Version | lower | replace "+" "-plus-" | replace "_" "-u-" | replace "." "-dot-" ) }}
{{- $host := pluck .Values.werf.env .Values.host | first | default .Values.host._default }}
{{- if hasPrefix "review" .Values.werf.env }}
{{- $host = ( printf "%s.%s" .Values.werf.env (pluck "dev" .Values.host | first | default .Values.host._default ) | lower ) }}
{{- $refs := list $.Values.global.github_ref }}
{{- if eq $.Values.werf.env "test" }}
{{- $refs = concat $refs (list "v2.0.3" "v1.2.294+fix1") }}
{{- end }}

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}-configurator
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header X-Original-URI $request_uri;

set $configurator_selected_page $1;
{{- range $_, $ref := $refs }}

ssi on;
ssi_silent_errors on;
{{- $version := splitList "/" $ref | last }}
{{- $versionDNSNormalized := printf "%s" $version | lower | replace "+" "-plus-" | replace "_" "-u-" | replace "." "-dot-" }}

{{ include "rewrites" . | indent 6 }}
{{- if eq .Values.werf.env "production" }}
nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
{{- $versionURLNormalized := "" }}
{{- if eq $version "main" }}
{{- $versionURLNormalized = "latest" }}
{{- else }}
nginx.ingress.kubernetes.io/auth-url: http://basic-auth.kube-basic-auth.svc.cluster.local/werfio
{{- $versionURLNormalized = printf "%s" $version | lower | replace "+" "-plus-" | replace "_" "-u-" }}
{{- end }}
spec:
tls:
- hosts:
- {{ $host }}
- ru.{{ $host }}
{{- if eq .Values.werf.env "production" }}
- www.{{ $host }}

{{- $host := pluck $.Values.werf.env $.Values.host | first | default $.Values.host._default }}
{{- if hasPrefix "review" $.Values.werf.env }}
{{- $host = printf "%s.%s" $.Values.werf.env (pluck "dev" $.Values.host | first | default $.Values.host._default ) | lower }}
{{- end }}
secretName: tls-{{ $host }}
rules:
- host: {{ $host }}
http:
paths:
- path: /documentation/{{ .VersionURLNormalized }}/configurator(?:/(.*))?$
pathType: Prefix
backend:
service:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
port:
name: http
- host: ru.{{ $host }}
http:
paths:
- path: /documentation/{{ .VersionURLNormalized }}/configurator(?:/(.*))?$
pathType: Prefix
backend:
service:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
port:
name: http

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
name: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header X-Original-URI $request_uri;

ssi on;
ssi_silent_errors on;

{{ include "rewrites" . | indent 6 }}
{{- if eq .Values.werf.env "production" }}
{{ include "rewrites" $ | indent 6 }}
{{- if eq $.Values.werf.env "production" }}
nginx.ingress.kubernetes.io/from-to-www-redirect: "true"
{{- else }}
nginx.ingress.kubernetes.io/auth-url: http://basic-auth.kube-basic-auth.svc.cluster.local/werfio
Expand All @@ -84,29 +42,29 @@ spec:
- hosts:
- {{ $host }}
- ru.{{ $host }}
{{- if eq .Values.werf.env "production" }}
{{- if eq $.Values.werf.env "production" }}
- www.{{ $host }}
{{- end }}
secretName: tls-{{ $host }}
rules:
- host: {{ $host }}
http:
paths:
- path: /documentation/{{ .VersionURLNormalized }}
- path: /docs/{{ $versionURLNormalized }}/
pathType: Prefix
backend:
service:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
name: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
port:
name: http
- host: ru.{{ $host }}
http:
paths:
- path: /documentation/{{ .VersionURLNormalized }}
- path: /docs/{{ $versionURLNormalized }}/
pathType: Prefix
backend:
service:
name: {{ .Chart.Name }}-{{ .VersionDNSNormalized }}
name: {{ $.Chart.Name }}-{{ $versionDNSNormalized }}
port:
name: http
---
{{- end }}
Loading
Loading