Skip to content

Commit

Permalink
Merge pull request #26 from russellb/merge-upstream
Browse files Browse the repository at this point in the history
Merge master from metal3-io/cluster-api-provider-baremetal.
  • Loading branch information
openshift-merge-robot authored May 17, 2019
2 parents be7c378 + 7b591be commit 551b940
Show file tree
Hide file tree
Showing 142 changed files with 2,110 additions and 942 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# How to Contribute

MetalKube projects are [Apache 2.0 licensed](LICENSE) and accept contributions via
Metal3 projects are [Apache 2.0 licensed](LICENSE) and accept contributions via
GitHub pull requests.

## Certificate of Origin
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM registry.svc.ci.openshift.org/openshift/release:golang-1.10 AS builder
WORKDIR /go/src/github.com/metalkube/cluster-api-provider-baremetal
WORKDIR /go/src/github.com/metal3-io/cluster-api-provider-baremetal
COPY . .
RUN go build -o machine-controller-manager ./cmd/manager
RUN go build -o manager ./vendor/github.com/openshift/cluster-api/cmd/manager
Expand All @@ -11,5 +11,5 @@ FROM registry.svc.ci.openshift.org/openshift/origin-v4.0:base
# yum install -y $INSTALL_PKGS && \
# rpm -V $INSTALL_PKGS && \
# yum clean all
COPY --from=builder /go/src/github.com/metalkube/cluster-api-provider-baremetal/manager /
COPY --from=builder /go/src/github.com/metalkube/cluster-api-provider-baremetal/machine-controller-manager /
COPY --from=builder /go/src/github.com/metal3-io/cluster-api-provider-baremetal/manager /
COPY --from=builder /go/src/github.com/metal3-io/cluster-api-provider-baremetal/machine-controller-manager /
13 changes: 7 additions & 6 deletions Gopkg.lock

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

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ required = [


[[constraint]]
name="github.com/metalkube/baremetal-operator"
name="github.com/metal3-io/baremetal-operator"
branch="master"

# STANZAS BELOW ARE GENERATED AND MAY BE WRITTEN - DO NOT MODIFY BELOW THIS LINE.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ unit: manifests

# Build manager binary
manager: generate fmt vet
go build -o bin/manager github.com/metalkube/cluster-api-provider-baremetal/cmd/manager
go build -o bin/manager github.com/metal3-io/cluster-api-provider-baremetal/cmd/manager

# Run against the configured Kubernetes cluster in ~/.kube/config
run: generate fmt vet
Expand Down
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version: "1"
domain: cluster.k8s.io
repo: github.com/metalkube/cluster-api-provider-baremetal
repo: github.com/metal3-io/cluster-api-provider-baremetal
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,36 @@ This repository contains a Machine actuator implementation for the
Kubernetes [Cluster API](https://github.com/kubernetes-sigs/cluster-api/).

For more information about this actuator and related repositories, see
[metalkube.org](http://metalkube.org/).
[metal3.io](http://metal3.io/).

## Development Environment

* [Setting up for tests](docs/dev/setup.md)
* Using [Minikube](docs/dev/minikube.md)
* Using [OpenShift 4](docs/dev/openshift.md)

## ProviderSpec

In order to create a valid Machine resource, you must include a ProviderSpec
that looks like the following example. See the
[type definition](pkg/apis/baremetal/v1alpha1/baremetalmachineproviderspec_types.go)
for details on each field.

```
apiVersion: cluster.k8s.io/v1alpha1
kind: Machine
metadata:
labels:
controller-tools.k8s.io: "1.0"
name: sample0
spec:
providerSpec:
value:
apiVersion: "baremetal.cluster.k8s.io/v1alpha1"
kind: "BareMetalMachineProviderSpec"
image:
url: "http://172.22.0.1/images/rhcos-ootpa-latest.qcow2"
checksum: "http://172.22.0.1/images/rhcos-ootpa-latest.qcow2.md5sum"
userData:
Name: "worker-user-data"
```
16 changes: 8 additions & 8 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"os"
"time"

bmoapis "github.com/metalkube/baremetal-operator/pkg/apis"
"github.com/metalkube/cluster-api-provider-baremetal/pkg/apis"
"github.com/metalkube/cluster-api-provider-baremetal/pkg/cloud/baremetal/actuators/machine"
bmoapis "github.com/metal3-io/baremetal-operator/pkg/apis"
"github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis"
"github.com/metal3-io/cluster-api-provider-baremetal/pkg/cloud/baremetal/actuators/machine"
clusterapis "github.com/openshift/cluster-api/pkg/apis"
capimachine "github.com/openshift/cluster-api/pkg/controller/machine"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -100,19 +100,19 @@ func waitForAPIs(cfg *rest.Config) error {
return err
}

metalkubeGV := schema.GroupVersion{
Group: "metalkube.org",
metal3GV := schema.GroupVersion{
Group: "metal3.io",
Version: "v1alpha1",
}

for {
err = discovery.ServerSupportsVersion(c, metalkubeGV)
err = discovery.ServerSupportsVersion(c, metal3GV)
if err != nil {
log.Info(fmt.Sprintf("Waiting for API group %v to be available: %v", metalkubeGV, err))
log.Info(fmt.Sprintf("Waiting for API group %v to be available: %v", metal3GV, err))
time.Sleep(time.Second * 10)
continue
}
log.Info(fmt.Sprintf("Found API group %v", metalkubeGV))
log.Info(fmt.Sprintf("Found API group %v", metal3GV))
break
}

Expand Down
22 changes: 19 additions & 3 deletions config/crds/baremetal_v1alpha1_baremetalmachineproviderspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,33 @@ spec:
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
image:
description: Image is the image to be provisioned.
properties:
checksum:
description: Checksum is a md5sum value or a URL to retrieve one.
type: string
url:
description: URL is a location of an image to deploy.
type: string
required:
- url
- checksum
type: object
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
type: object
status:
userData:
description: UserData references the Secret that holds user data needed
by the bare metal operator. The Namespace is optional; it will default
to the Machine's namespace if not specified.
type: object
required:
- image
version: v1alpha1
status:
acceptedNames:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ spec:
type: string
metadata:
type: object
spec:
type: object
status:
type: object
version: v1alpha1
status:
acceptedNames:
Expand Down
3 changes: 1 addition & 2 deletions config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ spec:
template:
spec:
containers:
# Change the value of image field below to your controller image URL
- image: IMAGE_URL
- image: quay.io/metal3-io/cluster-api-provider-baremetal:master
name: manager
2 changes: 1 addition & 1 deletion config/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Adds namespace to all resources.
namespace: cluster-api-provider-baremetal-system
namespace: metal3

# Value of this field is prepended to the
# names of all resources, e.g. a deployment named
Expand Down
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
spec:
containers:
- command:
- /manager
- /machine-controller-manager
image: controller:latest
imagePullPolicy: Always
name: manager
Expand Down
2 changes: 1 addition & 1 deletion config/rbac/auth_proxy_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
labels:
control-plane: controller-manager
controller-tools.k8s.io: "1.0"
name: controller-manager-metrics-service
name: controller-manager-metrics-svc
namespace: system
spec:
ports:
Expand Down
10 changes: 10 additions & 0 deletions config/rbac/rbac_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ rules:
- update
- patch
- delete
- apiGroups:
- metal3.io
resources:
- baremetalhosts
verbs:
- get
- list
- watch
- update
- patch
- apiGroups:
- baremetal.k8s.io
resources:
Expand Down
72 changes: 72 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# API and Resource Definitions

## Machine

The `Machine` resource is defined by the
[cluster-api](https://github.com/kubernetes-sigs/cluster-api) project. A
`Machine` includes a `providerSpec` field which includes the data specific to
this `cluster-api` provider.

## BareMetalMachineProviderSpec

* **image** -- This includes two sub-fields, `url` and `checksum`, which
include the URL to the image and the URL to a checksum for that image. These
fields are required. The image will be used for provisioning of the
`BareMetalHost` chosen by the `Machine` actuator.

* **userData** -- This includes two sub-fields, `name` and `namespace`, which
reference a `Secret` that contains base64 encoded user-data to be written to
a config drive on the provisioned `BareMetalHost`. This field is optional.

## Sample Machine

```yaml
apiVersion: cluster.k8s.io/v1alpha1
kind: Machine
metadata:
annotations:
metal3.io/BareMetalHost: metal3/master-0
creationTimestamp: "2019-05-13T13:00:51Z"
finalizers:
- machine.cluster.k8s.io
generateName: baremetal-machine-
generation: 2
name: centos
namespace: metal3
resourceVersion: "1112"
selfLink: /apis/cluster.k8s.io/v1alpha1/namespaces/metal3/machines/centos
uid: 22acee54-757f-11e9-8091-280d3563c053
spec:
metadata:
creationTimestamp: null
providerSpec:
value:
apiVersion: baremetal.cluster.k8s.io/v1alpha1
image:
checksum: http://172.22.0.1/images/CentOS-7-x86_64-GenericCloud-1901.qcow2.md5sum
url: http://172.22.0.1/images/CentOS-7-x86_64-GenericCloud-1901.qcow2
kind: BareMetalMachineProviderSpec
userData:
name: centos-user-data
namespace: metal3
versions:
kubelet: ""
```
## Sample userData Secret
```yaml
apiVersion: v1
data:
userData: BASE64_ENCODED_USER_DATA
kind: Secret
metadata:
annotations:
creationTimestamp: 2019-05-13T13:00:51Z
name: centos-user-data
namespace: metal3
resourceVersion: "1108"
selfLink: /api/v1/namespaces/metal3/secrets/centos-user-data
uid: 22792b3e-757f-11e9-8091-280d3563c053
type: Opaque
```
4 changes: 2 additions & 2 deletions docs/dev/minikube.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The actuator also uses the `BareMetalHost` custom resource that’s defined by
the `baremetal-operator`.

```bash
kubectl apply -f vendor/github.com/metalkube/baremetal-operator/deploy/crds/metalkube_v1alpha1_baremetalhost_crd.yaml
kubectl apply -f vendor/github.com/metal3-io/baremetal-operator/deploy/crds/metal3_v1alpha1_baremetalhost_crd.yaml
```

## Create a BareMetalHost
Expand All @@ -30,7 +30,7 @@ a dummy `BareMetalHost` object. There’s no requirement to actually run the
`baremetal-operator` to test the reconciliation logic of the actuator.

Refer to the [baremetal-operator developer
documentation](https://github.com/metalkube/baremetal-operator/blob/master/docs/dev-setup.md)
documentation](https://github.com/metal3-io/baremetal-operator/blob/master/docs/dev-setup.md)
for instructions and tools for creating BareMetalHost objects.

## Run the Actuator
Expand Down
19 changes: 19 additions & 0 deletions docs/dev/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Setting up a development environment

The cluster-api requires two external tools for running the tests
during development.

## Install kustomize

```bash
eval $(go env)
export GOPATH
./tools/install_kustomize.sh
```

## Install kubebuilder

```bash
./tools/install_kubebuilder.sh
sudo mv kubebuilder /usr/local
```
2 changes: 1 addition & 1 deletion pkg/apis/addtoscheme_baremetal_v1alpha1.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package apis

import (
"github.com/metalkube/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1"
"github.com/metal3-io/cluster-api-provider-baremetal/pkg/apis/baremetal/v1alpha1"
)

func init() {
Expand Down
Loading

0 comments on commit 551b940

Please sign in to comment.