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

[wmco] WMC controller #15

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: 8 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ COPY --from=download /download/kubernetes/node/bin/kube-proxy.exe .
WORKDIR /payload/cni-plugins/
COPY --from=download /download/cni-plugins/* .

# Copy wget-ignore-cert powershell script
RUN mkdir /payload/powershell/
WORKDIR /payload/powershell/
COPY --from=build /build/windows-machine-config-operator/pkg/internal/wget-ignore-cert.ps1 .

WORKDIR /

ENV OPERATOR=/usr/local/bin/windows-machine-config-operator \
Expand All @@ -81,6 +86,9 @@ COPY build/_output/bin/windows-machine-config-operator ${OPERATOR}
COPY build/bin /usr/local/bin
RUN /usr/local/bin/user_setup

# Copy the wget-ignore-powershell script needed to execute wget commands remotely
COPY pkg/internal/wget-ignore-cert.ps1 /payload/powershell/

ENTRYPOINT ["/usr/local/bin/entrypoint"]

USER ${USER_UID}
48 changes: 47 additions & 1 deletion build/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,63 @@ RUN mkdir /payload/cni-plugins/
WORKDIR /payload/cni-plugins/
COPY --from=download /download/cni-plugins/* .

# Copy wget-ignore-cert powershell script
RUN mkdir /payload/powershell/
WORKDIR /payload/powershell/
COPY --from=build /build/windows-machine-config-operator/pkg/internal/wget-ignore-cert.ps1 .

WORKDIR /

ENV OPERATOR=/usr/local/bin/windows-machine-config-operator \
USER_UID=1001 \
USER_NAME=windows-machine-config-operator

# Changes needed for our CI

# install make package
RUN microdnf -y install make tar.x86_64 gzip.x86_64 wget.x86_64
RUN microdnf -y update

# Download and install Go. We need
RUN curl -L -s https://dl.google.com/go/go1.13.8.linux-amd64.tar.gz > go1.13.8.linux-amd64.tar.gz \
&& sha256sum go1.13.8.linux-amd64.tar.gz \
&& echo "0567734d558aef19112f2b2873caa0c600f1b4a5827930eb5a7f35235219e9d8 go1.13.8.linux-amd64.tar.gz" | sha256sum -c \
&& tar -xzf go1.13.8.linux-amd64.tar.gz \
&& mv go /usr/local \
&& rm -rf ./go*

# Download and install oc
RUN curl -L -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.2.2/openshift-client-linux-4.2.2.tar.gz -o openshift-origin-client-tools.tar.gz \
&& echo "8f853477fa99cfc4087ad2ddf9b13b9d22e5fc4d5dc24c63ec5b0a91bb337fc9 openshift-origin-client-tools.tar.gz" | sha256sum -c \
&& tar -xzf openshift-origin-client-tools.tar.gz \
&& mv oc /usr/bin/oc \
&& mv kubectl /usr/bin/kubectl \
&& rm -rf ./openshift* \
&& oc version

# Copy the source code to be used by our ci infra
RUN mkdir -p /go/src/github.com/openshift/windows-machine-config-operator/
WORKDIR /go/src/github.com/openshift/windows-machine-config-operator/
COPY --from=build /build/windows-machine-config-operator .

# Allow building binaries
RUN chmod -R g=u /go

ENV PATH="${PATH}:/usr/local/go/bin"
ENV GOPATH="/go"

# install operator binary
COPY --from=build /build/windows-machine-config-operator/build/_output/bin/windows-machine-config-operator ${OPERATOR}
COPY --from=build /build/windows-machine-config-operator/build/bin /usr/local/bin
RUN /usr/local/bin/user_setup

ENTRYPOINT ["/usr/local/bin/entrypoint"]
# Allow uid/gid in OpenShift
RUN chmod g=u /etc/passwd /etc/group
RUN chmod g=u /etc

# Create the directories needed for CI to work
RUN mkdir -m 777 -p /etc/cloud/
RUN mkdir -m 777 -p /etc/private-key/

ENTRYPOINT [ "/bin/bash" ]
USER ${USER_UID}
3 changes: 3 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ func main() {
os.Exit(1)
}

// TODO: Add checks for the existence of well known paths likes
// /payload/bin/, /etc/cloud/credentials etc.

// Add the Metrics Service
addMetrics(ctx, cfg, namespace)

Expand Down
4 changes: 4 additions & 0 deletions deploy/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: windows-machine-config-operator
66 changes: 34 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,42 @@ module github.com/openshift/windows-machine-config-operator

go 1.13

replace github.com/docker/docker => github.com/moby/moby v0.7.3-0.20190826074503-38ab9da00309 // Required by Helm
ravisantoshgudimetla marked this conversation as resolved.
Show resolved Hide resolved

replace (
github.com/coreos/prometheus-operator => github.com/coreos/prometheus-operator v0.34.0
github.com/openshift/api => github.com/openshift/api v0.0.0-20200205145930-e9d93e317dd1 // OpenShift 4.3
github.com/openshift/client-go => github.com/openshift/client-go v0.0.0-20191125132246-f6563a70e19a // OpenShift 4.3
k8s.io/api => k8s.io/api v0.16.7
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.16.7
k8s.io/apimachinery => k8s.io/apimachinery v0.16.7
k8s.io/apiserver => k8s.io/apiserver v0.16.7
k8s.io/cli-runtime => k8s.io/cli-runtime v0.16.7
k8s.io/client-go => k8s.io/client-go v0.16.7
k8s.io/cloud-provider => k8s.io/cloud-provider v0.16.7
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.16.7
k8s.io/code-generator => k8s.io/code-generator v0.16.7
k8s.io/component-base => k8s.io/component-base v0.16.7
k8s.io/cri-api => k8s.io/cri-api v0.16.7
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.16.7
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.16.7
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.16.7
k8s.io/kube-proxy => k8s.io/kube-proxy v0.16.7
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.16.7
k8s.io/kubectl => k8s.io/kubectl v0.16.7
k8s.io/kubelet => k8s.io/kubelet v0.16.7
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.16.7
k8s.io/metrics => k8s.io/metrics v0.16.7
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.16.7
)

require (
github.com/openshift/windows-machine-config-bootstrapper/tools/windows-node-installer v0.0.0-20200311205055-ff0cd166abd4
github.com/operator-framework/operator-sdk v0.15.2
github.com/pkg/errors v0.8.1
github.com/spf13/pflag v1.0.5
k8s.io/api v0.0.0
k8s.io/apimachinery v0.0.0
k8s.io/api v0.17.2
k8s.io/apimachinery v0.17.3
k8s.io/client-go v12.0.0+incompatible
sigs.k8s.io/controller-runtime v0.4.0
sigs.k8s.io/controller-runtime v0.5.0
)

// Pinned to kubernetes-1.16.2
replace (
k8s.io/api => k8s.io/api v0.0.0-20191016110408-35e52d86657a
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20191016113550-5357c4baaf65
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20191004115801-a2eda9f80ab8
k8s.io/apiserver => k8s.io/apiserver v0.0.0-20191016112112-5190913f932d
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20191016114015-74ad18325ed5
k8s.io/client-go => k8s.io/client-go v0.0.0-20191016111102-bec269661e48
k8s.io/cloud-provider => k8s.io/cloud-provider v0.0.0-20191016115326-20453efc2458
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.0.0-20191016115129-c07a134afb42
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20191004115455-8e001e5d1894
k8s.io/component-base => k8s.io/component-base v0.0.0-20191016111319-039242c015a9
k8s.io/cri-api => k8s.io/cri-api v0.0.0-20190828162817-608eb1dad4ac
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.0.0-20191016115521-756ffa5af0bd
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.0.0-20191016112429-9587704a8ad4
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.0.0-20191016114939-2b2b218dc1df
k8s.io/kube-proxy => k8s.io/kube-proxy v0.0.0-20191016114407-2e83b6f20229
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.0.0-20191016114748-65049c67a58b
k8s.io/kubectl => k8s.io/kubectl v0.0.0-20191016120415-2ed914427d51
k8s.io/kubelet => k8s.io/kubelet v0.0.0-20191016114556-7841ed97f1b2
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.0.0-20191016115753-cf0698c3a16b
k8s.io/metrics => k8s.io/metrics v0.0.0-20191016113814-3b1a734dba6e
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.0.0-20191016112829-06bb3c9d77c9
)

replace github.com/docker/docker => github.com/moby/moby v0.7.3-0.20190826074503-38ab9da00309 // Required by Helm

replace github.com/openshift/api => github.com/openshift/api v0.0.0-20190924102528-32369d4db2ad // Required until https://github.com/operator-framework/operator-lifecycle-manager/pull/1241 is resolved
Loading