Skip to content

Instantly share code, notes, and snippets.

View Qolzam's full-sized avatar
💭
I may be slow to respond.

Amir Movahedi Qolzam

💭
I may be slow to respond.
View GitHub Profile
"use strict"
module.exports = (context, callback) => {
const message = {
"text": "This is a test!",
"attachments": [
{
"text": 'Hello Slack from OpenFaaS!'
}
]
version: 1.0
provider:
name: openfaas
gateway: http://127.0.0.1:8080
functions:
slack-mail:
lang: node
handler: ./slack-mail
image: slack-mail:latest
labels:
# Create directory for the project
mkdir $HOME/mail-of-slack
# Change current directory to the project directory
cd $HOME/mail-of-slack
# Pull OpenFaaS templates
faas-cli template pull
# Create a function from nodejs language template
cat <<EOF | kubectl apply -f -
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: openfaas-gateway-prod
namespace: openfaas-prod
spec:
selector:
istio: ingressgateway
servers:
kubectl -n istio-system describe certificate ingress-cert-openfaas-prod
kubectl logs -n istio-system -l app=cert-manager -c cert-manager
cat <<EOF | kubectl apply -f -
apiVersion: certmanager.k8s.io/v1alpha1
kind: Certificate
metadata:
name: ingress-cert-openfaas-prod
namespace: istio-system
spec:
secretName: ingress-cert-openfaas-prod
issuerRef:
name: letsencrypt-staging
INGRESS_DOMAIN_PROD="api.mydoamin.com"
dig +short $INGRESS_DOMAIN_PROD
kubectl -n istio-system describe certificate ingress-cert-openfaas-stg
kubectl logs -n istio-system -l app=cert-manager -c cert-manager
cat <<EOF | kubectl apply -f -
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: openfaas-gateway-stg
namespace: openfaas-stg
spec:
selector:
istio: ingressgateway
servers:
helm upgrade openfaas-prod --install openfaas/openfaas \
--namespace openfaas-prod \
--set basic_auth=true \
--set functionNamespace=openfaas-fn-prod \
--set exposeServices=false \
--set operator.create=true \
--set operator.createCRD=false