Commit 173f2340 authored by aticig's avatar aticig
Browse files

Adding powerdns k8s proxy charm and descriptors

parent fe7be6cd
#!/bin/bash
sudo snap install yq
echo "========================================================================"
echo "Adding Helm Repository"
echo "========================================================================"
osm repo-add --type helm-chart --description "Repository for Powerdns helm Chart" osm-helm https://gatici.github.io/helm-repo/
echo "========================================================================"
echo "Listing Helm Repository"
echo "========================================================================"
osm repo-list
#!/bin/bash
export PDNS_NS_NAME=powerdns_ns
export VNF_NAME=powerdns
export KDU_NAME=powerdns
read -p "Enter ZONE:" ZONE
if [[ -z "$ZONE" ]]; then
printf '%s\n' "No input entered"
exit 1
else
printf "You entered ZONE %s " "$ZONE"
fi
echo "========================================================================"
echo "Deleting Zone"
echo "========================================================================"
DEL_ZONE_OP_ID=`osm ns-action --action_name delete-zone --vnf_name $KDU_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE}" $PDNS_NS_NAME`
echo "========================================================================"
echo "Showing action status"
echo "========================================================================"
osm ns-op-show $DEL_ZONE_OP_ID
echo "========================================================================"
echo "Check the action status using osm ns-op-show $DEL_ZONE_OP_ID"
echo "========================================================================"
#!/bin/bash
read -p "Enter replicaCount number to scale as number greater than 1:" NUM
if [[ -z "$NUM" ]]; then
printf '%s\n' "No input entered"
exit 1
else
printf "You entered ZONE %s " "$NUM"
ls -l
fi
echo "========================================================================"
echo "Scaling out"
echo "========================================================================"
SCALE_OUT_OP_ID=`osm ns-action --action_name upgrade --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'replicaCount':$NUM,}" $PDNS_NS_NAME`
echo "========================================================================"
echo "Showing action status"
echo "========================================================================"
osm ns-op-show $PDNS_NS_NAME --literal | yq .operationState
echo "========================================================================"
echo "Showing replicaCount number"
echo "========================================================================"
osm vnf-show $VNF_ID --kdu $KDU_NAME | yq .config.replicaCount
#!/bin/bash
echo "========================================================================"
echo "Rolling back"
echo "========================================================================"
SCALE_IN_OP_ID=`osm ns-action --action_name rollback --vnf_name $VNF_NAME --kdu_name $KDU_NAME $PDNS_NS_NAME`
echo "========================================================================"
echo "Showing action status"
echo "========================================================================"
osm ns-op-show $SCALE_IN_OP_ID --literal | yq .operationState
echo "========================================================================"
echo "Showing replicaCount number"
echo "========================================================================"
osm vnf-show $VNF_ID --kdu $KDU_NAME | yq .config.replicaCount
\ No newline at end of file
#!/bin/bash
echo "========================================================================"
echo "Upload VNFD"
echo "========================================================================"
pushd ../../powerdns/
osm nfpkg-create powerdns_knf
echo "========================================================================"
echo "Upload NSD"
echo "========================================================================"
osm nspkg-create powerdns_ns
popd
#!/bin/bash
echo "========================================================================"
echo "Setting env variables"
echo "========================================================================"
export K8S_NET=osm-ext
export PDNS_NS_NAME=powerdns_ns
echo "========================================================================"
echo "Deploying NS"
echo "========================================================================"
osm ns-create --ns_name $PDNS_NS_NAME --nsd_name powerdns_ns --vim_account openstack --config "{vld: [ {name: mgmtnet, vim-network-name: $K8S_NET}]}"
osm ns-list
echo "========================================================================"
echo "NS_NAME: $PDNS_NS_NAME"
echo "NS_ID: $PDNS_NS_NAME deployed"
echo "========================================================================"
echo "========================================================================"
echo "Check NS status using osm ns-list, osm ns-show $PDNS_NS_NAME"
echo "========================================================================"
#!/bin/bash
export PDNS_NS_NAME=powerdns_ns
VNF_ID=`osm vnf-list --ns $PDNS_NS_NAME | grep powerdns | awk '{print $2}'`
echo "========================================================================"
echo "VNF ID $VNF_ID"
echo "========================================================================"
export DNS_IP=`osm vnf-show $VNF_ID --literal | yq -e '.kdur[0].services[] | select(.name | contains("udp")) | .external_ip' | tr -d ' '-`
echo "========================================================================"
echo "DNS IP $DNS_IP"
echo "========================================================================"
echo "========================================================================"
echo "Setting DNS Server in your machine"
echo "========================================================================"
sudo sed -i "1s/^/nameserver $DNS_IP\n/" /etc/resolv.conf
#!/bin/bash
export PDNS_NS_NAME=powerdns_ns
export VNF_NAME=powerdns
export KDU_NAME=powerdns
read -p "Enter ZONE:" ZONE
# Check if string is empty using -z. For more 'help test'
if [[ -z "$ZONE" ]]; then
printf '%s\n' "No input entered"
exit 1
else
printf "You entered ZONE %s " "$ZONE"
fi
echo "========================================================================"
echo "Adding zone"
echo "========================================================================"
ADD_ZONE_OP_ID=`osm ns-action --action_name add-zone --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{"zone_name": $ZONE}" $PDNS_NS_NAME`
echo "========================================================================"
echo "Showing action status"
echo "========================================================================"
# Check operation status
osm ns-op-show $ADD_ZONE_OP_ID
echo "========================================================================"
echo "Check action status using osm ns-op-show $ADD_ZONE_OP_ID"
echo "========================================================================"
#!/bin/bash
export PDNS_NS_NAME=powerdns_ns
export VNF_NAME=powerdns
export KDU_NAME=powerdns
read -p "Enter ZONE:" ZONE
if [[ -z "$ZONE" ]]; then
printf '%s\n' "No input entered"
exit 1
else
printf "You entered ZONE %s " "$ZONE"
fi
read -p "Enter DOMAIN:" DOMAIN
if [[ -z "$DOMAIN" ]]; then
printf '%s\n' "No input entered"
exit 1
else
printf "You entered DOMAIN %s " "$DOMAIN"
fi
read -p "Enter IP:" IP
if [[ -z "$IP" ]]; then
printf '%s\n' "No input entered"
exit 1
else
printf "You entered IP %s " "$IP"
fi
echo "========================================================================"
echo "Adding domain"
echo "========================================================================"
ADD_DOMAIN_OP_ID=`osm ns-action --action_name add-domain --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE, 'subdomain': $DOMAIN, 'ip': $IP}" $PDNS_NS_NAME`
echo "========================================================================"
echo "Showing action status"
echo "========================================================================"
osm ns-op-show $ADD_DOMAIN_OP_ID
echo "========================================================================"
echo "Check action status using osm ns-op-show $ADD_DOMAIN_OP_ID"
echo "========================================================================"
echo "========================================================================"
echo "Get the list of all operations using osm ns-op-list $PDNS_NS_ID"
echo "========================================================================"
#!/bin/bash
export PDNS_NS_NAME=powerdns_ns
export VNF_NAME=powerdns
export KDU_NAME=powerdns
read -p "Enter DNS RECORD:" RECORD
if [[ -z "$RECORD" ]]; then
printf '%s\n' "No input entered"
exit 1
else
printf "You entered RECORD %s " "$RECORD"
fi
echo "========================================================================"
echo "Testing record"
echo "========================================================================"
# Sample record: "test.example.org"
dig $RECORD
echo "========================================================================"
echo "Testing the record using dig @${DNS_IP} $RECORD"
echo "========================================================================"
#!/bin/bash
export PDNS_NS_NAME=powerdns_ns
export VNF_NAME=powerdns
export KDU_NAME=powerdns
read -p "Enter ZONE:" ZONE
if [[ -z "$ZONE" ]]; then
printf '%s\n' "No input entered"
exit 1
else
printf "You entered ZONE %s " "$ZONE"
fi
read -p "Enter DOMAIN:" DOMAIN
if [[ -z "$DOMAIN" ]]; then
printf '%s\n' "No input entered"
exit 1
else
printf "You entered DOMAIN %s " "$DOMAIN"
fi
echo "========================================================================"
echo "Deleting Domain"
echo "========================================================================"
# Delete Domain
DEL_DOM_OP_ID=`osm ns-action --action_name delete-domain --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE, 'subdomain': $DOMAIN}" $PDNS_NS_NAME`
echo "========================================================================"
echo "Showing action status"
echo "========================================================================"
osm ns-op-show $DEL_DOM_OP_ID
echo "========================================================================"
echo "Check the action status using osm ns-op-show $DEL_DOM_OP_ID"
echo "========================================================================"
#!/bin/bash
echo "========================================================================"
echo "Install charmcraft"
echo "========================================================================"
sudo snap install charmcraft --classic
cd ../../powerdns/powerdns_knf/charms/ops/
if [ ! -d powerdns-operator ] ; then
echo "It does not look like we are in osm-packages, exiting"
exit 1
fi
echo "========================================================================"
echo "Packing charm"
echo "========================================================================"
pushd powerdns-operator
charmcraft pack
echo "========================================================================"
echo "Copying charm under VNFD/charms folder"
echo "========================================================================"
cp powerdns-operator_ubuntu-20.04-amd64.charm ../../charms
popd
#!/bin/bash
echo "========================================================================"
echo "Downloading OSM packages"
echo "========================================================================"
git clone --recurse-submodules -j8 https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git
# PowerDNS NS
Descriptors that installs a PowerDNS chart from [helm-chart repo](https://gatici.github.io/helm-repo/).
There is one VNF (powerdns_knf) with only one KDU.
There is one NS that connects the VNF to a mgmt network
## Download Packages
```bash
git clone --recurse-submodules -j8 https://osm.etsi.org/gitlab/vnf-onboarding/osm-packages.git
```
## Create the VIM Account
```bash
# This is dummy vim account
export VIM_ACCOUNT=openstack
osm vim-create --name $VIM_ACCOUNT \
--account_type dummy \
--user dummy \
--password dummy \
--auth_url "http://dummy" \
--tenant dummy
```
## Add K8s Cluster
```bash
# kubeconfig.yaml exists in the HOME directory
export K8S_NET=osm-ext # osm-ext
export K8S_CLUSTER=hackfest
osm k8scluster-add --creds ~/kubeconfig.yaml \
--vim openstack \
--k8s-nets "{k8s_net: $K8S_NET}" \
--version 1.24 \
$K8S_CLUSTER
```
## Add Helm Repository
```bash
osm repo-add --type helm-chart --description "Repository for Powerdns helm Chart" osm-helm https://gatici.github.io/helm-repo/
```
## Build the charm
```bash
# Install charmcraft
sudo snap install charmcraft --classic
pushd osm-packages/Hackfest_Demos/OSM-MR13/powerdns/powerdns_knf/charms/ops/powerdns-operator
# Pack charm
charmcraft pack
# Copy charm under VNFD/charms folder
cp powerdns-operator_ubuntu-20.04-amd64.charm osm-packages/Hackfest_Demos/OSM-MR13/powerdns/powerdns_knf/charms/
popd
```
## Onboarding and instantiation
```bash
export VNF_NAME=powerdns
export KDU_NAME=powerdns
# Define the NS name
export PDNS_NS_NAME=powerdns_ns
```
```bash
pushd osm-packages/Hackfest_Demos/OSM-MR13/powerdns/
osm nfpkg-create powerdns_knf
osm nspkg-create powerdns_ns
popd
export PDNS_NS_ID=`osm ns-create --ns_name $PDNS_NS_NAME --nsd_name powerdns_ns --vim_account openstack --config "{vld: [ {name: mgmtnet, vim-network-name: $K8S_NET}]}"`
# Check NS status
osm ns-list
osm ns-show $PDNS_NS_ID
```
## Test Day2 Actions: add-zone, add-domain
```bash
# Add Zone Action
# Define zone such as "example.org."
ZONE=osm.magma.com.
ADD_ZONE_OP_ID=`osm ns-action --action_name add-zone --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{"zone_name": $ZONE}" $PDNS_NS_NAME`
# Check operation status
osm ns-op-show $ADD_ZONE_OP_ID
# Add Domain Action
# Define domain such as "test."
# Use the domain names and ip addresses which are required for Magma Orchestrator
DOMAIN=<domain>
# Define ip such as "192.168.2.32"
IP=<ip>
ADD_DOMAIN_OP_ID=`osm ns-action --action_name add-domain --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE, 'subdomain': $DOMAIN, 'ip': $IP}" $PDNS_NS_NAME`
# Check operation status
osm ns-op-show $ADD_DOMAIN_OP_ID
# Get the list of all operations
osm ns-op-list $PDNS_NS_ID
```
## Testing PowerDNS server
```bash
VNF_ID=`osm vnf-list --ns $PDNS_NS_NAME | grep powerdns | awk '{print $2}'`
export DNS_IP=`osm vnf-show $VNF_ID --literal | yq -e '.kdur[0].services[] | select(.name | contains("udp")) | .external_ip' | tr -d ' '-`
# Setting DNS Server in your machine
echo "nameserver ${DNS_IP}" | tee -a /etc/resolv.conf
RECORD=<domain><zone>
# Sample record: "test.example.org"
dig @${DNS_IP} $RECORD
```
## Test Day2 Actions: delete-domain, delete-zone
```bash
# Delete Domain
DEL_DOM_OP_ID=`osm ns-action --action_name delete-domain --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE, 'subdomain': $DOMAIN}" $PDNS_NS_NAME`
osm ns-op-show $DEL_DOM_OP_ID
dig @${DNS_IP} ${RECORD}
# Delete Zone
DEL_ZONE_OP_ID=`osm ns-action --action_name delete-zone --vnf_name $KDU_NAME --kdu_name $KDU_NAME --params "{'zone_name': $ZONE}" $PDNS_NS_NAME`
osm ns-op-show $DEL_ZONE_OP_ID
```
## Upgrade Operation: Scale Out
```bash
SCALE_OUT_OP_ID=`osm ns-action --action_name upgrade --vnf_name $VNF_NAME --kdu_name $KDU_NAME --params "{'replicaCount':'3',}" $PDNS_NS_NAME`
osm ns-op-show $PDNS_NS_NAME --literal | yq .operationState
osm vnf-show $VNF_ID --kdu $KDU_NAME | yq .config.replicaCount
```
## Rollback Operation: Scale In
```bash
SCALE_IN_OP_ID=`osm ns-action --action_name rollback --vnf_name $VNF_NAME --kdu_name $KDU_NAME $PDNS_NS_NAME`
osm ns-op-show $SCALE_IN_OP_ID --literal | yq .operationState
osm vnf-show $VNF_ID --kdu $KDU_NAME | yq .config.replicaCount
```
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 10.16.2
- name: mariadb
repository: https://charts.bitnami.com/bitnami
version: 10.5.1
digest: sha256:8e15bb90e2a9a3b72069761791da93dee17fecca2fdfa74562ce2541bab15282
generated: "2022-05-19T17:36:07.359537847Z"
apiVersion: v2
appVersion: v4.3.1
dependencies:
- condition: postgresql.enabled
name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 10.16.2
- condition: mariadb.enabled
name: mariadb
repository: https://charts.bitnami.com/bitnami
version: 10.5.1
deprecated: true
description: PowerDNS is a DNS server, written in C++ and licensed under the GPL. It runs on most Unix derivatives. PowerDNS features a large number of different backends ranging from simple BIND style zonefiles to relational databases and load balancing/failover algorithms. A DNS recursor is provided as a separate program.
home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/powerdns
icon: https://avatars.githubusercontent.com/u/1282630?s=200&v=4
name: powerdns
sources:
- http://www.github.com/PowerDNS/
version: 5.0.0
# powerdns
![Version: 5.0.0](https://img.shields.io/badge/Version-5.0.0-informational?style=flat-square) ![AppVersion: v4.3.1](https://img.shields.io/badge/AppVersion-v4.3.1-informational?style=flat-square)
PowerDNS is a DNS server, written in C++ and licensed under the GPL. It runs on most Unix derivatives. PowerDNS features a large number of different backends ranging from simple BIND style zonefiles to relational databases and load balancing/failover algorithms. A DNS recursor is provided as a separate program.
**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/k8s-at-home/charts/issues/new/choose)**
## Source Code
* <http://www.github.com/PowerDNS/>
## Requirements
## Dependencies
| Repository | Name | Version |
|------------|------|---------|
| https://charts.bitnami.com/bitnami | mariadb | 10.5.1 |
| https://charts.bitnami.com/bitnami | postgresql | 10.16.2 |
## TL;DR
```console
helm repo add k8s-at-home https://k8s-at-home.com/charts/
helm repo update
helm install powerdns k8s-at-home/powerdns
```
## Installing the Chart
To install the chart with the release name `powerdns`
```console
helm install powerdns k8s-at-home/powerdns
```
## Uninstalling the Chart
To uninstall the `powerdns` deployment
```console
helm uninstall powerdns
```
The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release.
## Configuration
Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values.
Other values may be used from the [values.yaml](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml) from the [common library](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common).
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
```console
helm install powerdns \
--set env.TZ="America/New York" \
k8s-at-home/powerdns
```
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.
```console
helm install powerdns k8s-at-home/powerdns -f values.yaml
```
## Custom configuration
N/A
## Values
**Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common)
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"Always"` | |
| image.repository | string | `"naps/powerdns"` | |
| image.tag | string | `"4.3.1"` | |
| imagePullSecrets | list | `[]` | |
| mariadb | object | `{"architecture":"standalone","auth":{"database":"pdns","password":"pdns-pass","rootPassword":"pdnsrootpass","username":"pdns"},"enabled":false,"primary":{"persistence":{"enabled":false}}}` | ... for more options see https://github.com/bitnami/charts/tree/master/bitnami/mariadb |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podSecurityContext | object | `{}` | |
| postgresql | object | `{"enabled":true,"persistence":{"enabled":false},"postgresqlDatabase":"pdns","postgresqlPassword":"pdnspass","postgresqlPostgresPassword":"pdnsadminpass","postgresqlUsername":"pdns"}` | ... for more options see https://github.com/bitnami/charts/tree/master/bitnami/postgresql |
| powerdns.additionalEnv | list | `[]` | |
| powerdns.config | object | `{}` | |
| powerdns.dnssec | bool | `true` | |
| powerdns.domain | string | `"mydomain.local"` | |
| powerdns.mysql.database | string | `"pdns"` | |
| powerdns.mysql.password | string | `"pdnspass"` | |
| powerdns.mysql.username | string | `"pdns"` | |
| powerdns.postgres.database | string | `"pdns"` | |
| powerdns.postgres.password | string | `"pdnspass"` | |
| powerdns.postgres.username | string | `"pdns"` | |
| probes.liveness.enabled | bool | `true` | |
| probes.liveness.failureThreshold | int | `5` | |
| probes.liveness.initialDelaySeconds | int | `30` | |
| probes.liveness.timeoutSeconds | int | `10` | |
| probes.readiness.enabled | bool | `true` | |
| probes.readiness.failureThreshold | int | `5` | |
| probes.readiness.initialDelaySeconds | int | `30` | |
| probes.readiness.timeoutSeconds | int | `10` | |
| probes.startup.enabled | bool | `false` | |
| probes.startup.failureThreshold | int | `30` | |
| probes.startup.periodSeconds | int | `10` | |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| securityContext | object | `{}` | |
| service.externalTrafficPolicy | string | `""` | |
| service.port | int | `53` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `nil` | If not set and create is true, a name is generated using the fullname template |
| strategyType | string | `"Recreate"` | |
| tolerations | list | `[]` | |
## Changelog
### Version 5.0.0
#### Added
N/A
#### Changed
N/A
#### Fixed
N/A
### Older versions
A historical overview of changes can be found on [ArtifactHUB](https://artifacthub.io/packages/helm/k8s-at-home/powerdns?modal=changelog)
## Support
- See the [Docs](https://docs.k8s-at-home.com/our-helm-charts/getting-started/)
- Open an [issue](https://github.com/k8s-at-home/charts/issues/new/choose)
- Ask a [question](https://github.com/k8s-at-home/organization/discussions)
- Join our [Discord](https://discord.gg/sTMX7Vh) community
----------------------------------------------
Autogenerated from chart metadata using [helm-docs v0.1.1](https://github.com/k8s-at-home/helm-docs/releases/v0.1.1)
{{- define "custom.custom.configuration.header" -}}
## Custom configuration
{{- end -}}
{{- define "custom.custom.configuration" -}}
{{ template "custom.custom.configuration.header" . }}
N/A
{{- end -}}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment