weather-operator

command module
v0.0.0-...-3d603ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 11 Imported by: 0

README

Weather Operator - Built with Operator SDK

What are we talking about?

$ kubectl apply -f config/samples/london.yaml
$ kubectl logs pod/weather-report-london
Weather report: london

                Overcast
       .--.     +15(14) °C
    .-(    ).   → 15 km/h
   (___.__)__)  10 km
                0.0 mm
                                                       ┌─────────────┐
┌──────────────────────────────┬───────────────────────┤  Mon 06 Jun ├───────────────────────┬──────────────────────────────┐
│            Morning           │             Noon      └──────┬──────┘     Evening           │             Night            │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│      .-.      Light drizzle  │      .-.      Light drizzle  │  _`/"".-.     Light rain sho…│  _`/"".-.     Patchy rain po…│
│     (   ).    +13(12) °C     │     (   ).    +15(14) °C     │   ,\_(   ).   17 °C          │   ,\_(   ).   +14(15) °C     │
│    (___(__)   → 13-17 km/h   │    (___(__)   → 10-13 km/h   │    /(___(__)  → 6-7 km/h     │    /(___(__)  ↙ 3-5 km/h     │
│     ‘ ‘ ‘ ‘   2 km           │     ‘ ‘ ‘ ‘   2 km           │      ‘ ‘ ‘ ‘  10 km          │      ‘ ‘ ‘ ‘  10 km          │
│    ‘ ‘ ‘ ‘    0.2 mm | 80%   │    ‘ ‘ ‘ ‘    0.2 mm | 71%   │     ‘ ‘ ‘ ‘   0.5 mm | 88%   │     ‘ ‘ ‘ ‘   0.1 mm | 70%   │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
Location: London [51.509648,-0.099076]

Follow @igor_chubin for wttr.in updates

Deploy Operator

Deploy Operator

$ make deploy

Create a WeatherService

create yaml file config/samples/london.yaml

apiVersion: weatherservice.iqbal.com/v1alpha1
kind: WeatherService
metadata:
  name: london
spec:
  city: london # city name
  days: 2 # how many days weather report you want

apply yaml file

$ kubectl -n weather-operator-system apply -f config/samples/london.yaml

get logs from the pod

$ kubectl -n weather-operator-system logs pod/weather-report-london
Weather report: london

                Overcast
       .--.     +15(14) °C
    .-(    ).   → 15 km/h
   (___.__)__)  10 km
                0.0 mm
                                                       ┌─────────────┐
┌──────────────────────────────┬───────────────────────┤  Mon 06 Jun ├───────────────────────┬──────────────────────────────┐
│            Morning           │             Noon      └──────┬──────┘     Evening           │             Night            │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│      .-.      Light drizzle  │      .-.      Light drizzle  │  _`/"".-.     Light rain sho…│  _`/"".-.     Patchy rain po…│
│     (   ).    +13(12) °C     │     (   ).    +15(14) °C     │   ,\_(   ).   17 °C          │   ,\_(   ).   +14(15) °C     │
│    (___(__)   → 13-17 km/h   │    (___(__)   → 10-13 km/h   │    /(___(__)  → 6-7 km/h     │    /(___(__)  ↙ 3-5 km/h     │
│     ‘ ‘ ‘ ‘   2 km           │     ‘ ‘ ‘ ‘   2 km           │      ‘ ‘ ‘ ‘  10 km          │      ‘ ‘ ‘ ‘  10 km          │
│    ‘ ‘ ‘ ‘    0.2 mm | 80%   │    ‘ ‘ ‘ ‘    0.2 mm | 71%   │     ‘ ‘ ‘ ‘   0.5 mm | 88%   │     ‘ ‘ ‘ ‘   0.1 mm | 70%   │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
Location: London [51.509648,-0.099076]

Follow @igor_chubin for wttr.in updates

Automatically create WeatherService and get logs

Use below shell script to automatically create everything

./get-weather-report ${CITY} ${DAYS}

Example:

$ ./get-weather-report dehradun 1
[INFO] updating ./config/samples/dehradun.yaml
[INFO] Using namespace: weather-operator-system
weatherservice.weatherservice.iqbal.com/dehradun created
[INFO] Waiting for weather-report-dehradun pod to be ready...
[INFO] weather-report-dehradun pod is ready
Weather report: dehradun

      \   /     Clear
       .-.      +33(31) °C
    ― (   ) ―   ↘ 5 km/h
       `-’      10 km
      /   \     0.0 mm
                                                       ┌─────────────┐
┌──────────────────────────────┬───────────────────────┤  Mon 06 Jun ├───────────────────────┬──────────────────────────────┐
│            Morning           │             Noon      └──────┬──────┘     Evening           │             Night            │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│     \   /     Sunny          │     \   /     Sunny          │     \   /     Sunny          │     \   /     Clear          │
│      .-.      +35(33) °C     │      .-.      +43(45) °C     │      .-.      +38(37) °C     │      .-.      +30(28) °C     │
│   ― (   ) ―   ↑ 7-8 km/h     │   ― (   ) ―   ↗ 14-16 km/h   │   ― (   ) ―   ↗ 10-11 km/h   │   ― (   ) ―   ↙ 9-19 km/h    │
│      `-’      10 km          │      `-’      10 km          │      `-’      10 km          │      `-’      10 km          │
│     /   \     0.0 mm | 0%    │     /   \     0.0 mm | 0%    │     /   \     0.0 mm | 0%    │     /   \     0.0 mm | 0%    │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
Location: Dehradun, Dehra Dūn, Uttarakhand, 248001, India [30.3255646,78.0436813]

Follow @igor_chubin for wttr.in updates

Cleanup

$ make undeploy

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the v1alpha1 API group +kubebuilder:object:generate=true +groupName=weatherservice.iqbal.com
Package v1alpha1 contains API Schema definitions for the v1alpha1 API group +kubebuilder:object:generate=true +groupName=weatherservice.iqbal.com

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL