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

Merge master from metal3-io/cluster-api-provider-baremetal. #26

Merged
merged 25 commits into from
May 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0ea1caf
document dev environment setup
dhellmann Apr 18, 2019
87855e9
Merge pull request #62 from dhellmann/document-dev-setup
dhellmann Apr 22, 2019
f862305
rename metalkube to metal3
dhellmann Apr 23, 2019
33f2e95
Merge pull request #63 from dhellmann/metal3-rename
russellb Apr 23, 2019
0e43ed9
handle discovered hosts in chooseHost
dhellmann Apr 26, 2019
7848287
Merge pull request #64 from dhellmann/handle-discovered-hosts
russellb Apr 26, 2019
7236b2b
add unit test to deal with unprovisioned host with error
dhellmann Apr 26, 2019
a77c6c1
Merge pull request #65 from dhellmann/test-discovered-hosts
dhellmann Apr 26, 2019
448b650
Adds ProviderSpec with settings for image and userdata.
mhrivnak Apr 15, 2019
f4e7641
Merge pull request #59 from mhrivnak/provider-spec
russellb May 7, 2019
8d426fc
Use the metal3 namespace by default.
russellb May 7, 2019
cc188d5
Merge pull request #68 from russellb/metal3-namespace
russellb May 7, 2019
59693a4
Use metal3 namepsace for cluster-api components.
russellb May 7, 2019
7a83fc2
Merge pull request #69 from russellb/metal3-namespace-capi
russellb May 9, 2019
e1322cf
Shorten resource name.
russellb May 9, 2019
bf0e3c3
manager_image_patch.yaml: Set image name.
russellb May 9, 2019
509c5cb
manager.yaml: Update command to match our image.
russellb May 10, 2019
da85d71
Add RBAC for accessing BareMetalHost objects.
russellb May 10, 2019
5f95d64
Fix ProviderName to be "baremetal".
russellb May 11, 2019
e2ce158
Merge pull request #70 from russellb/provider-name
mhrivnak May 12, 2019
98138a3
Add API docs.
russellb May 13, 2019
b1513b8
Update to latest master from cluster-api.
russellb May 13, 2019
24eae98
Merge pull request #71 from russellb/api-docs
russellb May 13, 2019
992e6b2
Merge pull request #72 from russellb/cluster-api-update
russellb May 13, 2019
7b591be
Merge metal3-io/master into openshift/master.
russellb May 17, 2019
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
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