forked from openshift/release
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openshift#340 from celebdor/worker-mdns-publishing
mdns-publisher: remove master things
- Loading branch information
Showing
3 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
assets/files/etc/kubernetes/manifests/mdns-publisher-worker.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--- | ||
kind: Pod | ||
apiVersion: v1 | ||
metadata: | ||
name: mdns-publisher | ||
namespace: kni-infra | ||
creationTimestamp: | ||
deletionGracePeriodSeconds: 65 | ||
labels: | ||
app: kni-infra-mdns | ||
spec: | ||
volumes: | ||
- name: resource-dir | ||
hostPath: | ||
path: "/etc/kubernetes/static-pod-resources/mdns" | ||
- name: kubeconfig | ||
hostPath: | ||
path: "/etc/kubernetes/kubeconfig" | ||
- name: get-vip-subnet-cidr | ||
hostPath: | ||
path: "/usr/local/bin/get_vip_subnet_cidr" | ||
- name: conf-dir | ||
empty-dir: {} | ||
initContainers: | ||
- name: clusterrc-generation | ||
image: quay.io/openshift-metalkube/kubeconfig-extractor:latest | ||
command: | ||
- "/usr/bin/kubeconfig-extractor" | ||
args: | ||
- "/etc/kubernetes/kubeconfig" | ||
- "/etc/kubernetes/static-pod-resources/clusterrc" | ||
resources: {} | ||
volumeMounts: | ||
- name: resource-dir | ||
mountPath: "/etc/kubernetes/static-pod-resources" | ||
- name: kubeconfig | ||
mountPath: "/etc/kubernetes/kubeconfig" | ||
- name: render-config | ||
image: quay.io/openshift/origin-node:latest | ||
command: | ||
- "/bin/bash" | ||
- "-c" | ||
- | | ||
#/bin/bash | ||
set -ex | ||
source /etc/kubernetes/static-pod-resources/clusterrc | ||
CLUSTER_NAME="$NAME" | ||
API_VIP="$(dig +noall +answer "api.${DOMAIN}" | awk '{print $NF}')" | ||
IFACE_CIDRS="$(ip addr show | grep -v "scope host" | grep -Po 'inet \K[\d.]+/[\d.]+' | xargs)" | ||
SUBNET_CIDR="$(/usr/local/bin/get_vip_subnet_cidr "$API_VIP" "$IFACE_CIDRS")" | ||
PREFIX="${SUBNET_CIDR#*/}" | ||
DNS_VIP="$(dig +noall +answer "ns1.${DOMAIN}" | awk '{print $NF}')" | ||
ONE_CIDR="$(ip addr show to "$SUBNET_CIDR" | \ | ||
grep -Po 'inet \K[\d.]+/[\d.]+' | \ | ||
grep -v "${DNS_VIP}/$PREFIX" | \ | ||
sort | xargs | cut -f1 -d' ')" | ||
NON_VIRTUAL_IP="${ONE_CIDR%/*}" | ||
SHORT_HOSTNAME="$(hostname -s).local." | ||
export SHORT_HOSTNAME | ||
export NON_VIRTUAL_IP | ||
export CLUSTER_NAME | ||
/usr/libexec/platform-python -c "from __future__ import print_function | ||
import os | ||
with open('/etc/kubernetes/static-pod-resources/config.template', 'r') as f: | ||
content = f.read() | ||
with open('/etc/mdns/config.hcl', 'w') as dest: | ||
print(os.path.expandvars(content), file=dest)" | ||
resources: {} | ||
volumeMounts: | ||
- name: resource-dir | ||
mountPath: "/etc/kubernetes/static-pod-resources" | ||
- name: conf-dir | ||
mountPath: "/etc/mdns" | ||
- name: get-vip-subnet-cidr | ||
mountPath: "/usr/local/bin/get_vip_subnet_cidr" | ||
imagePullPolicy: IfNotPresent | ||
containers: | ||
- name: mdns-publisher | ||
image: quay.io/openshift-metalkube/mdns-publisher:latest | ||
args: | ||
- "--debug" | ||
resources: | ||
requests: | ||
cpu: 150m | ||
memory: 1Gi | ||
volumeMounts: | ||
- name: conf-dir | ||
mountPath: "/etc/mdns" | ||
terminationMessagePolicy: FallbackToLogsOnError | ||
imagePullPolicy: IfNotPresent | ||
hostNetwork: true | ||
tolerations: | ||
- operator: Exists | ||
priorityClassName: system-node-critical | ||
status: {} |
11 changes: 11 additions & 0 deletions
11
assets/files/etc/kubernetes/static-pod-resources/mdns/worker-config.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
bind_address = "$NON_VIRTUAL_IP" | ||
collision_avoidance = "hostname" | ||
|
||
service { | ||
name = "$CLUSTER_NAME Workstation" | ||
host_name = "$SHORT_HOSTNAME" | ||
type = "_workstation._tcp" | ||
domain = "local." | ||
port = 42424 | ||
ttl = 3200 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters