Add FluxCD version of the nginx app

Add new manifest files to the nginx app to enable FluxCD support.

The new spec will now generate 2 rpms:
- the original one that contains the armada
  version of the nginx app

- a new one that contains the new FluxCD
  version of nginx app

The FluxCD archive will contain the following:
.
├── charts
│   └── ingress-nginx-3.10.1.tgz
├── checksum.md5
├── fluxcd-manifests
│   ├── base
│   │   ├── helmrepository.yaml
│   │   ├── kustomization.yaml
│   │   └── namespace.yaml
│   ├── kustomization.yaml
│   └── nginx-ingress
│       ├── helmrelease.yaml
│       ├── kustomization.yaml
│       ├── nginx-ingress-static-overrides.yaml
│       └── nginx-ingress-system-overrides.yaml
├── metadata.yaml
└── plugins
    └── k8sapp_nginx_ingress_controller-1.0-py2.py3-none-any.whl

The archive components are almost the same
as the armada components, only the armada manifest file
is replaced with the fluxcd-manifests directory.

Story: 2009138
Task: 44452
Change-Id: Iab30290a8889a2849e65e7b10869e97203a3bd34
Signed-off-by: Mihnea Saracin <Mihnea.Saracin@windriver.com>
This commit is contained in:
Mihnea Saracin 2022-02-04 17:32:52 +02:00
parent 851cdece0c
commit 6291d8a7f9
11 changed files with 208 additions and 6 deletions

View File

@ -1 +1,2 @@
stx-nginx-ingress-controller-helm
stx-nginx-ingress-controller-helm-fluxcd

View File

@ -4,6 +4,6 @@ TAR_NAME=helm-charts-ingress-nginx
NGINX_VERSION=0.41.2
TAR="$TAR_NAME-$NGINX_VERSION.tar.gz"
COPY_LIST="${CGCS_BASE}/downloads/$TAR $PKG_BASE/$SRC_DIR/files/* $PKG_BASE/$SRC_DIR/manifests/*"
COPY_LIST="${CGCS_BASE}/downloads/$TAR $PKG_BASE/$SRC_DIR/files/* $PKG_BASE/$SRC_DIR/manifests/* $PKG_BASE/$SRC_DIR/fluxcd-manifests/*"
TIS_PATCH_VER=PKG_GITREVCOUNT

View File

@ -26,8 +26,20 @@ Source1: repositories.yaml
Source2: index.yaml
Source3: Makefile
Source4: metadata.yaml
# armada specific source items
Source5: nginx_ingress_controller_manifest.yaml
# fluxcd specific source items
Source6: kustomization.yaml
Source7: base_helmrepository.yaml
Source8: base_kustomization.yaml
Source9: base_namespace.yaml
Source10: nginx-ingress_helmrelease.yaml
Source11: nginx-ingress_kustomization.yaml
Source12: nginx-ingress_nginx-ingress-static-overrides.yaml
Source13: nginx-ingress_nginx-ingress-system-overrides.yaml
BuildArch: noarch
Patch01: 0001-add-toleration.patch
@ -40,6 +52,14 @@ BuildRequires: python-k8sapp-nginx-ingress-controller-wheels
%description
StarlingX Nginx Ingress Controller Application Armada Helm Charts
%package fluxcd
Summary: StarlingX Nginx Ingress Controller Application FluxCD Helm Charts
Group: base
License: Apache-2.0
%description fluxcd
StarlingX Nginx Ingress Controller Application FluxCD Helm Charts
%prep
%setup -n helm-charts
%patch01 -p1
@ -61,7 +81,8 @@ kill %1
# Create a chart tarball compliant with sysinv kube-app.py
%define app_staging %{_builddir}/staging
%define app_tarball %{app_name}-%{version}-%{tis_patch_ver}.tgz
%define app_tarball_armada %{app_name}-%{version}-%{tis_patch_ver}.tgz
%define app_tarball_fluxcd %{app_name}-fluxcd-%{version}-%{tis_patch_ver}.tgz
# Setup staging
mkdir -p %{app_staging}
@ -81,17 +102,43 @@ sed -i 's/@HELM_REPO@/%{helm_repo}/g' %{app_staging}/metadata.yaml
mkdir -p %{app_staging}/plugins
cp /plugins/%{app_name}/*.whl %{app_staging}/plugins
# package it up
# package armada
find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar -zcf %{_builddir}/%{app_tarball} -C %{app_staging}/ .
tar -zcf %{_builddir}/%{app_tarball_armada} -C %{app_staging}/ .
# package fluxcd
rm -f %{app_staging}/nginx_ingress_controller_manifest.yaml
fluxcd_dest=%{app_staging}/fluxcd-manifests
mkdir -p $fluxcd_dest
cp %{SOURCE6} %{app_staging}/fluxcd-manifests
cd %{_sourcedir}
directories="base nginx-ingress"
for dir in $directories;
do
mkdir -p $dir
prefix="${dir}_"
for file in ${dir}_*; do
mv $file $dir/"${file#$prefix}"
done
cp -r $dir $fluxcd_dest
done
cd -
find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar -zcf %{_builddir}/%{app_tarball_fluxcd} -C %{app_staging}/ .
# Cleanup staging
rm -fr %{app_staging}
%install
install -d -m 755 %{buildroot}/%{app_folder}
install -p -D -m 755 %{_builddir}/%{app_tarball} %{buildroot}/%{app_folder}
install -p -D -m 755 %{_builddir}/%{app_tarball_armada} %{buildroot}/%{app_folder}
install -p -D -m 755 %{_builddir}/%{app_tarball_fluxcd} %{buildroot}/%{app_folder}
%files
%defattr(-,root,root,-)
%{app_folder}/*
%{app_folder}/%{app_tarball_armada}
%files fluxcd
%defattr(-,root,root,-)
%{app_folder}/%{app_tarball_fluxcd}

View File

@ -0,0 +1,13 @@
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
name: stx-platform
spec:
url: http://192.168.206.1:8080/helm_charts/stx-platform
interval: 60m

View File

@ -0,0 +1,8 @@
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
resources:
- helmrepository.yaml

View File

@ -0,0 +1,10 @@
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
apiVersion: v1
kind: Namespace
metadata:
name: kube-system

View File

@ -0,0 +1,12 @@
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: kube-system
resources:
- base
- nginx-ingress

View File

@ -0,0 +1,36 @@
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
apiVersion: "helm.toolkit.fluxcd.io/v2beta1"
kind: HelmRelease
metadata:
name: nginx-ingress
labels:
chart_group: nginx-ingress
spec:
releaseName: ic-nginx-ingress
chart:
spec:
chart: ingress-nginx
version: 3.10.1
sourceRef:
kind: HelmRepository
name: stx-platform
interval: 5m
timeout: 30m
test:
enable: false
install:
disableHooks: false
upgrade:
disableHooks: false
valuesFrom:
- kind: Secret
name: nginx-ingress-static-overrides
valuesKey: nginx-ingress-static-overrides.yaml
- kind: Secret
name: nginx-ingress-system-overrides
valuesKey: nginx-ingress-system-overrides.yaml

View File

@ -0,0 +1,18 @@
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
namespace: kube-system
resources:
- helmrelease.yaml
secretGenerator:
- name: nginx-ingress-static-overrides
files:
- nginx-ingress-static-overrides.yaml
- name: nginx-ingress-system-overrides
files:
- nginx-ingress-system-overrides.yaml
generatorOptions:
disableNameSuffixHash: true

View File

@ -0,0 +1,51 @@
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
imagePullSecrets: [{"name": "default-registry-key"}]
controller:
kind: DaemonSet
image:
# cleans the default digest value since sysinv changes the digest when pushing the image to the local registry
digest: ""
daemonset:
useHostPort: false
nodeSelector:
node-role.kubernetes.io/master: ""
config:
# https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/
nginx-status-ipv4-whitelist: 0.0.0.0/0
# See https://bugs.launchpad.net/starlingx/+bug/1823803
# Note quotes are necessary.
worker-processes: '1'
scope:
enabled: false
service:
type: ""
hostNetwork: true
livenessProbe:
initialDelaySeconds: 30
readinessProbe:
initialDelaySeconds: 30
admissionWebhooks:
# default port 8443 conflicts with lighttpd using https
port: 5443
patch:
tolerations:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
defaultBackend:
image:
repository: k8s.gcr.io/defaultbackend
tag: "1.4"
nodeSelector:
node-role.kubernetes.io/master: ""
service:
type: ""
livenessProbe:
initialDelaySeconds: 30
readinessProbe:
initialDelaySeconds: 30

View File

@ -0,0 +1,6 @@
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#