Skip to content
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
8 changes: 4 additions & 4 deletions bindata/v4.1.0/config/defaultconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ extendedArguments:
- "true"
flex-volume-plugin-dir:
- "/etc/kubernetes/kubelet-plugins/volume/exec" # created by machine-config-operator, owned by storage team/[email protected]
pv-recycler-pod-template-filepath-nfs:
- "/etc/kubernetes/manifests/recycler-pod.yaml" # created by machine-config-operator, owned by storage team/[email protected]
pv-recycler-pod-template-filepath-hostpath:
- "/etc/kubernetes/manifests/recycler-pod.yaml" # created by machine-config-operator, owned by storage team/[email protected]
pv-recycler-pod-template-filepath-nfs: # owned by storage team/[email protected]
- "/etc/kubernetes/static-pod-resources/configmaps/recycler-config/recycler-pod.yaml"
pv-recycler-pod-template-filepath-hostpath: # owned by storage team/[email protected]
- "/etc/kubernetes/static-pod-resources/configmaps/recycler-config/recycler-pod.yaml"
leader-elect:
- "true"
leader-elect-retry-period:
Expand Down
5 changes: 0 additions & 5 deletions bindata/v4.1.0/kube-controller-manager/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ spec:
ports:
- containerPort: 10257
volumeMounts:
- mountPath: /etc/kubernetes/manifests
name: manifests-dir # Used in the KubeControllerManagerConfig to pass in recycler pod templates
- mountPath: /etc/kubernetes/static-pod-resources
name: resource-dir
- mountPath: /etc/kubernetes/static-pod-certs
Expand Down Expand Up @@ -163,9 +161,6 @@ spec:
tolerations:
- operator: "Exists"
volumes:
- hostPath:
path: /etc/kubernetes/manifests
name: manifests-dir
- hostPath:
path: /etc/kubernetes/static-pod-resources/kube-controller-manager-pod-REVISION
name: resource-dir
Expand Down
31 changes: 31 additions & 0 deletions bindata/v4.1.0/kube-controller-manager/recycler-cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: v1
kind: ConfigMap
metadata:
namespace: openshift-kube-controller-manager
name: recycler-config
data:
recycler-pod.yaml: |
apiVersion: v1
kind: Pod
metadata:
name: recycler-pod
namespace: openshift-infra
spec:
activeDeadlineSeconds: 60
restartPolicy: Never
serviceAccountName: pv-recycler-controller
containers:
- name: recycler-container
image: "${TOOLS_IMAGE}"
command:
- "/bin/bash"
args:
- "-c"
- "test -e /scrub && rm -rf /scrub/..?* /scrub/.[!.]* /scrub/* && test -z \"$(ls -A /scrub)\" || exit 1"
volumeMounts:
- mountPath: /scrub
name: vol
securityContext:
runAsUser: 0
volumes:
- name: vol
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ spec:
value: docker.io/openshift/origin-cluster-kube-controller-manager-operator:v4.0
- name: CLUSTER_POLICY_CONTROLLER_IMAGE
value: quay.io/openshift/origin-cluster-policy-controller:v4.3
- name: TOOLS_IMAGE
value: quay.io/openshift/origin-tools:latest
- name: OPERATOR_IMAGE_VERSION
value: "0.0.1-snapshot"
- name: OPERAND_IMAGE_VERSION
Expand Down
4 changes: 4 additions & 0 deletions manifests/image-references
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ spec:
from:
kind: DockerImage
name: quay.io/openshift/origin-cluster-policy-controller:v4.3
- name: tools # owned by storage team/[email protected]
from:
kind: DockerImage
name: quay.io/openshift/origin-tools:latest
2 changes: 2 additions & 0 deletions pkg/operator/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func RunOperator(ctx context.Context, cc *controllercmd.ControllerContext) error
os.Getenv("IMAGE"),
os.Getenv("OPERATOR_IMAGE"),
os.Getenv("CLUSTER_POLICY_CONTROLLER_IMAGE"),
os.Getenv("TOOLS_IMAGE"),
kubeInformersForNamespaces,
operatorClient,
kubeClient,
Expand Down Expand Up @@ -218,6 +219,7 @@ var deploymentConfigMaps = []revision.RevisionResource{
{Name: "kube-controller-cert-syncer-kubeconfig"},
{Name: "serviceaccount-ca"},
{Name: "service-ca"},
{Name: "recycler-config"},
}

// deploymentSecrets is a list of secrets that are directly copied for the current values. A different actor/controller modifies these.
Expand Down
21 changes: 20 additions & 1 deletion pkg/operator/targetconfigcontroller/targetconfigcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type TargetConfigController struct {
targetImagePullSpec string
operatorImagePullSpec string
clusterPolicyControllerPullSpec string
toolsImagePullSpec string

operatorClient v1helpers.StaticPodOperatorClient

Expand All @@ -68,7 +69,7 @@ type TargetConfigController struct {

func NewTargetConfigController(
ctx context.Context,
targetImagePullSpec, operatorImagePullSpec, clusterPolicyControllerPullSpec string,
targetImagePullSpec, operatorImagePullSpec, clusterPolicyControllerPullSpec, toolsImagePullSpec string,
kubeInformersForNamespaces v1helpers.KubeInformersForNamespaces,
operatorClient v1helpers.StaticPodOperatorClient,
kubeClient kubernetes.Interface,
Expand All @@ -80,6 +81,7 @@ func NewTargetConfigController(
targetImagePullSpec: targetImagePullSpec,
operatorImagePullSpec: operatorImagePullSpec,
clusterPolicyControllerPullSpec: clusterPolicyControllerPullSpec,
toolsImagePullSpec: toolsImagePullSpec,

configMapLister: kubeInformersForNamespaces.ConfigMapLister(),
secretLister: kubeInformersForNamespaces.SecretLister(),
Expand Down Expand Up @@ -196,6 +198,10 @@ func createTargetConfigController(ctx context.Context, c TargetConfigController,
if err != nil {
errors = append(errors, fmt.Errorf("%q: %v", "configmap/cluster-policy-controller-config", err))
}
_, _, err = manageRecycler(ctx, c.kubeClient.CoreV1(), recorder, c.toolsImagePullSpec)
if err != nil {
errors = append(errors, fmt.Errorf("%q: %v", "configmap/recycler-config", err))
}
_, _, err = ManageCSRIntermediateCABundle(ctx, c.secretLister, c.kubeClient.CoreV1(), recorder)
if err != nil {
errors = append(errors, fmt.Errorf("%q: %v", "configmap/csr-intermediate-ca", err))
Expand Down Expand Up @@ -404,6 +410,19 @@ func manageControllerManagerKubeconfig(ctx context.Context, client corev1client.
return resourceapply.ApplyConfigMap(client, recorder, requiredCM)
}

// manageRecycler applies a ConfigMap containing the recycler config.
// Owned by storage team/[email protected].
func manageRecycler(ctx context.Context, configMapsGetter corev1client.ConfigMapsGetter, recorder events.Recorder, imagePullSpec string) (*corev1.ConfigMap, bool, error) {
cmString := string(v411_00_assets.MustAsset("v4.1.0/kube-controller-manager/recycler-cm.yaml"))
for pattern, value := range map[string]string{
"${TOOLS_IMAGE}": imagePullSpec,
} {
cmString = strings.ReplaceAll(cmString, pattern, value)
}
requiredCM := resourceread.ReadConfigMapV1OrDie([]byte(cmString))
return resourceapply.ApplyConfigMap(configMapsGetter, recorder, requiredCM)
}

func managePod(ctx context.Context, configMapsGetter corev1client.ConfigMapsGetter, secretsGetter corev1client.SecretsGetter, recorder events.Recorder, operatorSpec *operatorv1.StaticPodOperatorSpec, imagePullSpec, operatorImagePullSpec, clusterPolicyControllerPullSpec string, addServingServiceCAToTokenSecrets bool) (*corev1.ConfigMap, bool, error) {
required := resourceread.ReadPodV1OrDie(v411_00_assets.MustAsset("v4.1.0/kube-controller-manager/pod.yaml"))
// TODO: If the image pull spec is not specified, the "${IMAGE}" will be used as value and the pod will fail to start.
Expand Down
64 changes: 55 additions & 9 deletions pkg/operator/v411_00_assets/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.