Skip to content
Open
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
15 changes: 15 additions & 0 deletions cmd/machine-config-operator/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ var (
infraImage string
releaseImage string
keepalivedImage string
frrK8sImage string
kubeVipImage string
mcoImage string
oauthProxyImage string
kubeRbacProxyImage string
Expand Down Expand Up @@ -68,6 +70,8 @@ func init() {
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.dependencyFiles.DNS, "dns-config-file", "/assets/manifests/cluster-dns-02-config.yml", "File containing dns.config.openshift.io manifest.")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.dependencyFiles.AdditionalTrustBundle, "additional-trust-bundle-config-file", "/assets/manifests/user-ca-bundle-config.yaml", "File containing the additional user provided CA bundle manifest.")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.keepalivedImage, "keepalived-image", "", "Image for Keepalived.")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.frrK8sImage, "frr-k8s-image", "", "Image for frr-k8s.")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.kubeVipImage, "kube-vip-image", "", "Image for kube-vip.")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.corednsImage, "coredns-image", "", "Image for CoreDNS.")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.haproxyImage, "haproxy-image", "", "Image for haproxy.")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.baremetalRuntimeCfgImage, "baremetal-runtimecfg-image", "", "Image for baremetal-runtimecfg.")
Expand All @@ -78,6 +82,7 @@ func init() {
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.dockerRegistryImage, "docker-registry-image", "", "Image for docker-registry.")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.imageReferences, "image-references", "", "File containing imagestreams (from cluster-version-operator)")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.dependencyFiles.CloudProviderCA, "cloud-provider-ca-file", "", "path to cloud provider CA certificate")
bootstrapCmd.PersistentFlags().StringVar(&bootstrapOpts.dependencyFiles.BGPVIPConfig, "bgp-vip-config-file", "/assets/manifests/bgp-vip-config.yaml", "File containing the bgp-vip-config ConfigMap manifest (optional).")

}

Expand Down Expand Up @@ -142,6 +147,12 @@ func runBootstrapCmd(_ *cobra.Command, _ []string) {
if err != nil {
klog.Warningf("Base OS extensions container not found: %s", err)
}
// Images rendered into MachineConfig content must resolve
// identically at bootstrap and in-cluster (tag listed in both
// install/image-references and the images ConfigMap), otherwise the
// bootstrap-rendered MC hash differs and masters degrade.
bootstrapOpts.frrK8sImage = findImageOrDie(imgstream, "metallb-frr")
bootstrapOpts.kubeVipImage = findImageOrDie(imgstream, "kube-vip")
}

imgs := ctrlcommon.Images{
Expand All @@ -155,6 +166,8 @@ func runBootstrapCmd(_ *cobra.Command, _ []string) {
BaseOSContainerImage: bootstrapOpts.baseOSContainerImage,
BaseOSExtensionsContainerImage: bootstrapOpts.baseOSExtensionsContainerImage,
DockerRegistryBootstrap: bootstrapOpts.dockerRegistryImage,
FRRK8sBootstrap: bootstrapOpts.frrK8sImage,
KubeVIPBootstrap: bootstrapOpts.kubeVipImage,
},
ControllerConfigImages: ctrlcommon.ControllerConfigImages{
InfraImage: bootstrapOpts.infraImage,
Expand All @@ -163,6 +176,8 @@ func runBootstrapCmd(_ *cobra.Command, _ []string) {
Haproxy: bootstrapOpts.haproxyImage,
BaremetalRuntimeCfg: bootstrapOpts.baremetalRuntimeCfgImage,
DockerRegistry: bootstrapOpts.dockerRegistryImage,
FRRK8s: bootstrapOpts.frrK8sImage,
KubeVip: bootstrapOpts.kubeVipImage,
},
}

Expand Down
4 changes: 3 additions & 1 deletion install/0000_80_machine-config_02_images.configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ data:
"baremetalRuntimeCfgImage": "placeholder.url.oc.will.replace.this.org/placeholdernamespace:baremetal-runtimecfg",
"oauthProxy": "placeholder.url.oc.will.replace.this.org/placeholdernamespace:oauth-proxy",
"kubeRbacProxy": "placeholder.url.oc.will.replace.this.org/placeholdernamespace:kube-rbac-proxy",
"dockerRegistryImage": "placeholder.url.oc.will.replace.this.org/placeholdernamespace:docker-registry"
"dockerRegistryImage": "placeholder.url.oc.will.replace.this.org/placeholdernamespace:docker-registry",
"frrK8sImage": "placeholder.url.oc.will.replace.this.org/placeholdernamespace:metallb-frr",
"kubeVipImage": "placeholder.url.oc.will.replace.this.org/placeholdernamespace:kube-vip"
}
8 changes: 8 additions & 0 deletions install/image-references
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,11 @@ spec:
from:
kind: DockerImage
name: placeholder.url.oc.will.replace.this.org/placeholdernamespace:docker-registry
- name: metallb-frr
from:
kind: DockerImage
name: placeholder.url.oc.will.replace.this.org/placeholdernamespace:metallb-frr
- name: kube-vip
from:
kind: DockerImage
name: placeholder.url.oc.will.replace.this.org/placeholdernamespace:kube-vip
158 changes: 158 additions & 0 deletions manifests/on-prem/0000-frr-k8s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
kind: Pod
apiVersion: v1
metadata:
name: frr-k8s
namespace: openshift-frr-k8s
labels:
app: frr-k8s
spec:
# hostNetwork: the BGP session must originate from the node IP and the
# advertised VIP routes live in the host routing table (keepalived parity).
hostNetwork: true
shareProcessNamespace: true
priorityClassName: system-node-critical
# 10s, not upstream's 0: SIGTERM'd bgpd sends a Cease; after SIGKILL a
# graceful-restart helper peer may retain stale VIP routes.
terminationGracePeriodSeconds: 10
tolerations:
- operator: Exists
initContainers:
- name: render-config-frr
image: {{ .Images.BaremetalRuntimeCfgBootstrap }}
command:
- /usr/bin/runtimecfg
- render
- /etc/kubernetes/kubeconfig
- --api-vips
- {{ onPremPlatformAPIServerInternalIP .ControllerConfig }}
- --ingress-vips
- {{ onPremPlatformIngressIP .ControllerConfig }}
- "--cluster-config"
- "/opt/openshift/manifests/cluster-config.yaml"
- /config/frr.conf.tmpl
- --out-dir
- /etc/frr
- --peer-file
- /config/frr-peers.json
env:
- name: IS_BOOTSTRAP
value: "yes"
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
resources:
requests:
cpu: 10m
memory: 50Mi
limits:
cpu: 100m
memory: 128Mi
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- name: resource-dir
mountPath: /config
readOnly: true
- name: frr-conf
mountPath: /etc/frr
- name: kubeconfig
mountPath: /etc/kubernetes
readOnly: true
- name: manifests
mountPath: "/opt/openshift/manifests"
mountPropagation: HostToContainer
Comment thread
coderabbitai[bot] marked this conversation as resolved.
readOnly: true
- name: cp-frr-files
image: {{ .Images.FRRK8sBootstrap }}
command:
- /bin/sh
- -c
- |
set -eu
cp -f /tmp/frr/daemons /etc/frr/daemons
cp -f /tmp/frr/vtysh.conf /etc/frr/vtysh.conf
Comment thread
coderabbitai[bot] marked this conversation as resolved.
securityContext:
runAsUser: 100
runAsGroup: 101
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
resources:
requests:
cpu: 10m
memory: 20Mi
limits:
cpu: 100m
memory: 128Mi
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- name: frr-startup
mountPath: /tmp/frr
readOnly: true
- name: frr-conf
mountPath: /etc/frr
Comment thread
coderabbitai[bot] marked this conversation as resolved.
containers:
- name: frr
image: {{ .Images.FRRK8sBootstrap }}
command:
- /bin/sh
- -c
- /sbin/tini -- /usr/lib/frr/docker-start
env:
- name: TINI_SUBREAPER
value: "true"
resources:
requests:
cpu: 100m
memory: 200Mi
limits:
cpu: 500m
memory: 512Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
# No drop ALL: FRR's privilege-separated startup relies on root's
# implicit caps beyond these four (tested: drop ALL + re-add breaks
# daemon startup). SYS_ADMIN for watchfrr supervision.
add:
- NET_ADMIN
- NET_RAW
- SYS_ADMIN
- NET_BIND_SERVICE
Comment thread
coderabbitai[bot] marked this conversation as resolved.
terminationMessagePolicy: FallbackToLogsOnError
volumeMounts:
- name: frr-sockets
mountPath: /var/run/frr
- name: frr-conf
mountPath: /etc/frr
- name: frr-lib
mountPath: /var/lib/frr
- name: frr-tmp
mountPath: /var/tmp/frr
Comment thread
coderabbitai[bot] marked this conversation as resolved.
volumes:
- name: resource-dir
hostPath:
path: /etc/kubernetes/static-pod-resources/frr-k8s
- name: frr-conf
emptyDir: {}
- name: frr-sockets
emptyDir: {}
- name: frr-lib
emptyDir: {}
- name: frr-tmp
emptyDir: {}
- name: frr-startup
hostPath:
path: /etc/kubernetes/static-pod-resources/frr-k8s/startup
- name: kubeconfig
hostPath:
path: /etc/kubernetes
- name: manifests
hostPath:
path: "/opt/openshift/manifests"
69 changes: 69 additions & 0 deletions manifests/on-prem/0010-kube-vip-api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
kind: Pod
apiVersion: v1
metadata:
name: kube-vip-api
namespace: openshift-kube-vip
labels:
app: kube-vip
component: api
spec:
hostNetwork: true
priorityClassName: system-node-critical
tolerations:
- operator: Exists
containers:
- name: kube-vip
image: {{ .Images.KubeVIPBootstrap }}
args:
- manager
env:
- name: address
value: "{{ onPremPlatformAPIServerInternalIP .ControllerConfig }}"
- name: k8s_config_file
value: "/etc/kubernetes/kubeconfig"
- name: kubernetes_addr
value: "https://127.0.0.1:6443"
- name: port
value: "6443"
- name: cp_enable
value: "true"
- name: vip_leaderelection
value: "true"
- name: vip_routingtable
value: "true"
- name: vip_cleanroutingtable
value: "true"
- name: vip_skipdad
# anycast ECMP: DAD would blackhole all advertisers but the first
value: "true"
- name: vip_routingtableid
value: "198"
- name: vip_routingtableprotocol
value: "248"
- name: backend_health_check_interval
value: "5"
resources:
requests:
cpu: 50m
memory: 64Mi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
limits:
cpu: 200m
memory: 256Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
add:
- NET_ADMIN
- NET_RAW
volumeMounts:
- name: kubeconfig
mountPath: /etc/kubernetes
readOnly: true
volumes:
- name: kubeconfig
hostPath:
path: /etc/kubernetes
69 changes: 69 additions & 0 deletions manifests/on-prem/0011-kube-vip-api-secondary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
kind: Pod
apiVersion: v1
metadata:
name: kube-vip-api-secondary
namespace: openshift-kube-vip
labels:
app: kube-vip
component: api-secondary
spec:
hostNetwork: true
priorityClassName: system-node-critical
tolerations:
- operator: Exists
containers:
- name: kube-vip
image: {{ .Images.KubeVIPBootstrap }}
args:
- manager
env:
- name: address
value: "{{ if gt (len (onPremPlatformAPIServerInternalIPs .ControllerConfig)) 1 }}{{ index (onPremPlatformAPIServerInternalIPs .ControllerConfig) 1 }}{{ end }}"
- name: k8s_config_file
value: "/etc/kubernetes/kubeconfig"
- name: kubernetes_addr
value: "https://127.0.0.1:6443"
- name: port
value: "6443"
- name: cp_enable
value: "true"
- name: vip_leaderelection
value: "true"
- name: vip_routingtable
value: "true"
- name: vip_cleanroutingtable
value: "true"
- name: vip_skipdad
# anycast ECMP: DAD would blackhole all advertisers but the first
value: "true"
- name: vip_routingtableid
value: "198"
- name: vip_routingtableprotocol
value: "248"
- name: backend_health_check_interval
value: "5"
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 200m
memory: 256Mi
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
add:
- NET_ADMIN
- NET_RAW
volumeMounts:
- name: kubeconfig
mountPath: /etc/kubernetes
readOnly: true
volumes:
- name: kubeconfig
hostPath:
path: /etc/kubernetes
1 change: 1 addition & 0 deletions manifests/on-prem/frr-peers.json.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{- .ControllerConfig.BGPVIPPeersJSON -}}
Loading