Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow bootstrap configuration to be configured and reentrant #16571

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions contrib/completions/bash/openshift
Original file line number Diff line number Diff line change
Expand Up @@ -33708,6 +33708,8 @@ _openshift_start_network()
local_nonpersistent_flags+=("--kubernetes=")
flags+=("--latest-images")
local_nonpersistent_flags+=("--latest-images")
flags+=("--listen=")
local_nonpersistent_flags+=("--listen=")
flags+=("--network-plugin=")
local_nonpersistent_flags+=("--network-plugin=")
flags+=("--recursive-resolv-conf=")
Expand All @@ -33731,8 +33733,8 @@ _openshift_start_node()
flags_with_completion=()
flags_completion=()

flags+=("--bootstrap")
local_nonpersistent_flags+=("--bootstrap")
flags+=("--bootstrap-config-name=")
local_nonpersistent_flags+=("--bootstrap-config-name=")
flags+=("--config=")
flags_with_completion+=("--config")
flags_completion+=("__handle_filename_extension_flag yaml|yml")
Expand Down
6 changes: 4 additions & 2 deletions contrib/completions/zsh/openshift
Original file line number Diff line number Diff line change
Expand Up @@ -33857,6 +33857,8 @@ _openshift_start_network()
local_nonpersistent_flags+=("--kubernetes=")
flags+=("--latest-images")
local_nonpersistent_flags+=("--latest-images")
flags+=("--listen=")
local_nonpersistent_flags+=("--listen=")
flags+=("--network-plugin=")
local_nonpersistent_flags+=("--network-plugin=")
flags+=("--recursive-resolv-conf=")
Expand All @@ -33880,8 +33882,8 @@ _openshift_start_node()
flags_with_completion=()
flags_completion=()

flags+=("--bootstrap")
local_nonpersistent_flags+=("--bootstrap")
flags+=("--bootstrap-config-name=")
local_nonpersistent_flags+=("--bootstrap-config-name=")
flags+=("--config=")
flags_with_completion+=("--config")
flags_completion+=("__handle_filename_extension_flag yaml|yml")
Expand Down
26 changes: 0 additions & 26 deletions contrib/kubernetes/controllers.yaml

This file was deleted.

51 changes: 51 additions & 0 deletions contrib/kubernetes/default-node-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
allowDisabledDocker: false
apiVersion: v1
authConfig:
authenticationCacheSize: 1000
authenticationCacheTTL: 5m
authorizationCacheSize: 1000
authorizationCacheTTL: 5m
dnsDomain: cluster.local
dnsIP: 0.0.0.0
dnsBindAddress: 0.0.0.0:53
dnsRecursiveResolvConf: ""
dockerConfig:
dockerShimRootDirectory: /var/lib/dockershim
dockerShimSocket: /var/run/kubernetes/dockershim.sock
execHandlerName: native
enableUnidling: true
imageConfig:
format: openshift/origin-${component}:${version}
latest: false
iptablesSyncPeriod: 30s
kind: NodeConfig
kubeletArguments:
cert-dir:
- ./certificates
feature-gates:
- RotateKubeletClientCertificate=true,RotateKubeletServerCertificate=true
masterClientConnectionOverrides:
acceptContentTypes: application/vnd.kubernetes.protobuf,application/json
burst: 40
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qps looks ok, but burst looks small

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually our default.

contentType: application/vnd.kubernetes.protobuf
qps: 20
masterKubeConfig: node.kubeconfig
networkConfig:
mtu: 1450
networkPluginName: redhat/openshift-ovs-multitenant
nodeIP: ""
proxyArguments:
healthz-bind-address:
- 0.0.0.0
healthz-port:
- "10256"
metrics-bind-address:
- 0.0.0.0:10257
servingInfo:
bindAddress: 0.0.0.0:10250
bindNetwork: tcp4
namedCertificates: null
volumeConfig:
localQuota:
perFSGroup: null
volumeDirectory: /var/lib/origin/volumes
2 changes: 1 addition & 1 deletion contrib/kubernetes/static/controllers-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
containers:
- name: controllers
image: openshift/origin:v3.6.0-rc.0
image: openshift/origin:v3.6.0
command: ["/usr/bin/openshift", "start", "master", "controllers"]
args:
- "--config=/etc/origin/master/master-config.yaml"
Expand Down
157 changes: 157 additions & 0 deletions contrib/kubernetes/static/network-daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
name: sdn
annotations:
kubernetes.io/description: |
This daemon set launches the OpenShift networking components (kube-proxy, DNS, and openshift-sdn).
It expects that OVS is running on the node.
spec:
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
component: network
type: infra
openshift.io/role: network
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
# Requires fairly broad permissions - ability to read all services and network functions as well
# as all pods.
serviceAccountName: sdn
hostNetwork: true
hostPID: true
containers:
- name: network
image: openshift/node:v3.7.0-alpha.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a parameterized version/tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an example, wanted to have the larger discussion about how static config flows from openshift/origin -> ansible first. Wanted to have something checked in that should be reproducible for a bit, then will be made formal and moved out of here.

command:
- /bin/bash
- -c
- |
#!/bin/sh
set -o errexit
# Take over network functions on the node
rm -Rf /etc/cni/net.d/*
rm -Rf /host/opt/cni/bin/*
cp -Rf /opt/cni/bin/* /host/opt/cni/bin/
# Use whichever node-config exists
cfg=/etc/openshift/node
if [[ ! -f "${cfg}/node-config.yaml" ]]; then
cfg=/etc/origin/node
fi
# Use the same config as the node, but with the service account token
openshift cli config "--config=${cfg}/node.kubeconfig" view --flatten > /tmp/kubeconfig
openshift cli config --config=/tmp/kubeconfig set-credentials sa "--token=$( cat /var/run/secrets/kubernetes.io/serviceaccount/token )"
openshift cli config --config=/tmp/kubeconfig set-context "$( openshift cli config current-context)" --user=sa
# Launch the network process
exec openshift start network "--config=${cfg}/node-config.yaml" --kubeconfig=/tmp/kubeconfig --loglevel=5

securityContext:
runAsUser: 0
# Permission could be reduced by selecting an appropriate SELinux policy
privileged: true
# TODO: debugging only
imagePullPolicy: Never
volumeMounts:
# Directory which contains the host configuration. We look at both locations
# to simplify setup.
- mountPath: /etc/origin/node/
name: host-config
readOnly: true
- mountPath: /etc/openshift/node/
name: host-config-alt
readOnly: true
# Run directories where we need to be able to access sockets
- mountPath: /var/run/dbus/
name: host-var-run-dbus
readOnly: true
- mountPath: /var/run/openvswitch/
name: host-var-run-ovs
readOnly: true
- mountPath: /var/run/kubernetes/
name: host-var-run-kubernetes
readOnly: true
# We mount our socket here
- mountPath: /var/run/openshift-sdn
name: host-var-run-openshift-sdn
# CNI related mounts which we take over
- mountPath: /host/opt/cni/bin
name: host-opt-cni-bin
- mountPath: /etc/cni/net.d
name: host-etc-cni-netd
- mountPath: /var/lib/cni/networks/openshift-sdn
name: host-var-lib-cni-networks-openshift-sdn

resources:
requests:
cpu: 100m
memory: 200Mi
env:
- name: OPENSHIFT_DNS_DOMAIN
value: cluster.local
ports:
- name: healthz
containerPort: 10256
livenessProbe:
initialDelaySeconds: 10
httpGet:
path: /healthz
port: 10256
scheme: HTTP
lifecycle:
# postStart:
# exec:
# command:
# - /usr/bin/dbus-send
# - --system
# - --dest=uk.org.thekelleys.dnsmasq
# - /uk/org/thekelleys/dnsmasq
# - uk.org.thekelleys.SetDomainServers
# - array:string:/in-addr.arpa/127.0.0.1,/$(OPENSHIFT_DNS_DOMAIN)/127.0.0.1
# preStop:
# exec:
# command:
# - /usr/bin/dbus-send
# - --system
# - --dest=uk.org.thekelleys.dnsmasq
# - /uk/org/thekelleys/dnsmasq
# - uk.org.thekelleys.SetDomainServers
# - "array:string:"

volumes:
# In bootstrap mode, the host config contains information not easily available
# from other locations.
- name: host-config
hostPath:
path: /etc/origin/node
- name: host-config-alt
hostPath:
path: /etc/openshift/node
- name: host-modules
hostPath:
path: /lib/modules

- name: host-var-run-ovs
hostPath:
path: /var/run/openvswitch
- name: host-var-run-kubernetes
hostPath:
path: /var/run/kubernetes
- name: host-var-run-dbus
hostPath:
path: /var/run/dbus
- name: host-var-run-openshift-sdn
hostPath:
path: /var/run/openshift-sdn

- name: host-opt-cni-bin
hostPath:
path: /opt/cni/bin
- name: host-etc-cni-netd
hostPath:
path: /etc/cni/net.d
- name: host-var-lib-cni-networks-openshift-sdn
hostPath:
path: /var/lib/cni/networks/openshift-sdn
61 changes: 61 additions & 0 deletions contrib/kubernetes/static/network-ovs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
name: ovs
annotations:
kubernetes.io/description: |
This daemon set launches the openvswitch daemon.
spec:
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
component: network
type: infra
openshift.io/role: network
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
# Requires fairly broad permissions - ability to read all services and network functions as well
# as all pods.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment isn't accurate for the OVS pod; it shouldn't need any kubernetes access at all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dns and kube-proxy are in there too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw something reading pods, will double check who it was.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I mean, that comment is correct where it appears in network-daemonset.yaml, but I was pointing out that the same comment also appears in network-ovs.yaml, where it's totally wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks.

serviceAccountName: sdn
hostNetwork: true
containers:
- name: openvswitch
image: openshift/openvswitch:v3.7.0-alpha.1
securityContext:
runAsUser: 0
privileged: true
volumeMounts:
- mountPath: /lib/modules
name: host-modules
readOnly: true
- mountPath: /run/openvswitch
name: host-run-ovs
- mountPath: /sys
name: host-sys
readOnly: true
- mountPath: /etc/openvswitch
name: host-config-openvswitch
resources:
requests:
cpu: 100m
memory: 200Mi
limits:
cpu: 200m
memory: 300Mi

volumes:
- name: host-modules
hostPath:
path: /lib/modules
- name: host-run-ovs
hostPath:
path: /run/openvswitch
- name: host-sys
hostPath:
path: /sys
- name: host-config-openvswitch
hostPath:
path: /etc/origin/openvswitch
29 changes: 29 additions & 0 deletions contrib/kubernetes/static/network-policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
kind: List
apiVersion: v1
items:
- kind: ServiceAccount
apiVersion: v1
metadata:
name: sdn
namespace: openshift-node
- apiVersion: authorization.openshift.io/v1
kind: ClusterRoleBinding
metadata:
name: sdn-cluster-reader
roleRef:
name: cluster-reader
subjects:
- kind: ServiceAccount
name: sdn
namespace: openshift-node
- apiVersion: authorization.openshift.io/v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in a kubernetes directory but using origin authz instead of RBAC? Unless you have some backwards compatibility use case, please use RBAC.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in a kubernetes directory but using origin authz instead of RBAC? Unless you have some backwards compatibility use case, please use RBAC.

What @enj said. RBAC is source of truth now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an example role, not productized yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an example role, not productized yet.

Yes, but it prevents compatibility with kube without good reason.

kind: ClusterRoleBinding
metadata:
name: sdn-reader
roleRef:
name: system:sdn-reader
subjects:
- kind: ServiceAccount
name: sdn
namespace: openshift-node
# TODO: PSP binding
Loading