You can install OpenFaaS on kubernetes using two ways
1. Using `faas-netes` repository
2. Using Helm 
| package main | |
| import ( | |
| "fmt" | |
| corev1 "k8s.io/api/core/v1" | |
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
| "sigs.k8s.io/yaml" | |
| ) | 
| package main | |
| import ( | |
| "fmt" | |
| corev1 "k8s.io/api/core/v1" | |
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
| "sigs.k8s.io/yaml" | |
| ) | 
| package main | |
| import ( | |
| "fmt" | |
| "gopkg.in/yaml.v3" | |
| corev1 "k8s.io/api/core/v1" | |
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
| ) | 
| // This script will alert you whenever some slot opens up on the given date within the given pincodes | |
| // Change the pincodes to your needs as per your city | |
| // Change the dateArr to add your convinent set of dates | |
| // For further update do checkout http://twitter.com/debarko/ | |
| // How To setup Video -> https://www.youtube.com/watch?v=3_N5FFegtI4 | |
| // Steps to use | |
| // 1. Update Config | 
| astronaut-counter (astronaut-counter-59b4f4b87-pskjv) 2019/07/16 06:46:49 Forking fprocess. | |
| astronaut-counter (astronaut-counter-59b4f4b87-pskjv) 2019/07/16 06:46:49 Query | |
| astronaut-counter (astronaut-counter-59b4f4b87-pskjv) 2019/07/16 06:46:49 Path / | |
| astronaut-counter (astronaut-counter-59b4f4b87-pskjv) 3 | |
| astronaut-counter (astronaut-counter-59b4f4b87-pskjv) 2019/07/16 06:46:51 stderr: DEBUG:root:Making request to open notify API | 
| version: 1.0 | |
| provider: | |
| name: openfaas | |
| gateway: http://127.0.0.1:8080 | |
| functions: | |
| astronaut-counter: | |
| lang: python3 | |
| handler: ./astronaut-counter | |
| image: <username>/astronaut-counter:latest | |
| environment: | 
| import requests | |
| import random | |
| import logging | |
| import time | |
| logging.basicConfig(level=logging.DEBUG) | |
| def handle(req): | |
| logging.debug("Making request to open notify API") | |
| start = time.time() | 
| def test(item): | |
| results = [] | |
| for hash_function in hash_functions: | |
| index = hash_function(item) % m | |
| if bit_array[index]: | |
| results.append(True) | |
| else: | |
| results.append(False) | |
| return reduce(lambda a, b : a & b, results) | 
| def add(item): | |
| for hash_function in hash_functions: | |
| index = hash_function(item) % m | |
| bit_array[index] = True |