-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit seeds the project source code.
- Loading branch information
1 parent
945f86b
commit 6c8223f
Showing
3,586 changed files
with
1,030,867 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
bin | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# editor and IDE paraphernalia | ||
.idea | ||
*.swp | ||
*.swo | ||
*~ | ||
.vscode | ||
.envrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
bin | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Kubernetes Generated files - skip generated files, except for vendored files | ||
|
||
!vendor/**/zz_generated.* | ||
|
||
# editor and IDE paraphernalia | ||
.idea | ||
*.swp | ||
*.swo | ||
*~ | ||
.vscode | ||
.envrc | ||
|
||
.kube |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM openshift/origin-release:golang-1.15 as builder | ||
|
||
WORKDIR /hypershift | ||
|
||
COPY . . | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -o bin/hypershift-operator hypershift-operator/main.go | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -o bin/control-plane-operator control-plane-operator/main.go | ||
|
||
FROM registry.svc.ci.openshift.org/ocp/4.6:base | ||
COPY --from=builder /hypershift/bin/hypershift-operator /usr/bin/hypershift-operator | ||
COPY --from=builder /hypershift/bin/control-plane-operator /usr/bin/control-plane-operator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
# Image URL to use all building/pushing image targets | ||
IMG ?= controller:latest | ||
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion) | ||
CRD_OPTIONS ?= "crd:trivialVersions=true" | ||
|
||
CONTROLLER_GEN=GO111MODULE=on GOFLAGS=-mod=vendor go run sigs.k8s.io/controller-tools/cmd/controller-gen | ||
|
||
GO=GO111MODULE=on GOFLAGS=-mod=vendor go | ||
GO_BUILD_RECIPE=CGO_ENABLED=0 $(GO) build -o $(BIN) $(GO_GCFLAGS) $(MAIN_PACKAGE) | ||
|
||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) | ||
ifeq (,$(shell go env GOBIN)) | ||
GOBIN=$(shell go env GOPATH)/bin | ||
else | ||
GOBIN=$(shell go env GOBIN) | ||
endif | ||
|
||
all: hypershift-operator control-plane-operator | ||
|
||
# Run tests | ||
test: generate fmt vet manifests | ||
go test ./... -coverprofile cover.out | ||
|
||
# Build hypershift-operator binary | ||
hypershift-operator: generate fmt vet | ||
go build -o bin/hypershift-operator ./hypershift-operator | ||
|
||
# Build control-plane-operator binary | ||
control-plane-operator: generate fmt vet | ||
go build -o bin/control-plane-operator ./control-plane-operator | ||
|
||
# Run against the configured Kubernetes cluster in ~/.kube/config | ||
run: generate fmt vet manifests | ||
go run ./hypershift-operator/main.go | ||
|
||
# Install CRDs into a cluster | ||
install: manifests | ||
kustomize build config/crd | kubectl apply -f - | ||
|
||
# Uninstall CRDs from a cluster | ||
uninstall: manifests | ||
kustomize build config/crd | kubectl delete -f - | ||
|
||
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config | ||
deploy: manifests | ||
cd config/manager && kustomize edit set image controller=${IMG} | ||
kustomize build config/default | kubectl apply -f - | ||
|
||
# Generate manifests e.g. CRD, RBAC etc. | ||
.PHONY: manifests | ||
manifests: | ||
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=hypershift-operator-role webhook paths="./..." output:crd:artifacts:config=manifests | ||
|
||
# Run go fmt against code | ||
fmt: | ||
go fmt ./... | ||
|
||
# Run go vet against code | ||
vet: | ||
go vet ./... | ||
|
||
# Generate code | ||
generate: | ||
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." | ||
|
||
# Build the docker image | ||
docker-build: test | ||
docker build . -t ${IMG} | ||
|
||
# Push the docker image | ||
docker-push: | ||
docker push ${IMG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Hypershift POC | ||
|
||
All the following assumes `KUBECONFIG` points to the management cluster. | ||
|
||
Build binaries and push an image for the control plane operator: | ||
|
||
``` | ||
$ make | ||
$ docker build -t quay.io/my/hypershift:latest . | ||
$ docker push quay.io/my/hypershift . | ||
``` | ||
|
||
Install the operator's supporting resources into the management cluster: | ||
``` | ||
$ oc apply --filename manifests/ | ||
``` | ||
|
||
Define release image info to be referenced by clusters: | ||
|
||
``` | ||
hack/generate-release-images.rb | oc apply --filename - | ||
``` | ||
|
||
Run the operator: | ||
``` | ||
$ bin/hypershift-operator run --control-plane-operator-image quay.io/my/hypershift:latest | ||
``` | ||
|
||
Create a cluster, referencing a release image present in the `release-images` configmap | ||
previously created: | ||
|
||
```yaml | ||
apiVersion: hypershift.openshift.io/v1alpha1 | ||
kind: OpenShiftCluster | ||
metadata: | ||
namespace: hypershift | ||
name: guest-hello | ||
spec: | ||
releaseImage: quay.io/openshift-release-dev/ocp-release@sha256:d78292e9730dd387ff6198197c8b0598da340be7678e8e1e4810b557a926c2b9 | ||
baseDomain: guest-hello.devcluster.openshift.com | ||
pullSecret: '{"auths": { ... }}' | ||
serviceCIDR: 172.30.0.0/16 | ||
podCIDR: 10.128.0.0/14 | ||
sshKey: 'ssh-rsa ...' | ||
cloudProvider: AWS | ||
computeReplicas: 1 | ||
``` | ||
Get the cluster kubeconfig using: | ||
``` | ||
$ oc get secret --namespace guest-hello admin-kubeconfig --template={{.data.kubeconfig}} | base64 -D | ||
``` | ||
|
||
And delete the cluster using: | ||
|
||
``` | ||
$ oc delete --namespace hypershift openshiftclusters/guest-hello | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package v1alpha1 contains API Schema definitions for the hypershift.openshift.io v1alpha1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=hypershift.openshift.io | ||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: "hypershift.openshift.io", Version: "v1alpha1"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// OpenShiftClusterSpec defines the desired state of OpenShiftCluster | ||
type OpenShiftClusterSpec struct { | ||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
BaseDomain string `json:"baseDomain"` | ||
PullSecret string `json:"pullSecret"` | ||
ServiceCIDR string `json:"serviceCIDR"` | ||
PodCIDR string `json:"podCIDR"` | ||
SSHKey string `json:"sshKey"` | ||
CloudProvider string `json:"cloudProvider"` | ||
ComputeReplicas int `json:"computeReplicas"` | ||
ReleaseImage string `json:"releaseImage"` | ||
} | ||
|
||
// OpenShiftClusterStatus defines the observed state of OpenShiftCluster | ||
type OpenShiftClusterStatus struct { | ||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
Ready bool `json:"ready"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// OpenShiftCluster is the Schema for the openshiftclusters API | ||
type OpenShiftCluster struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec OpenShiftClusterSpec `json:"spec,omitempty"` | ||
Status OpenShiftClusterStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// OpenShiftClusterList contains a list of OpenShiftCluster | ||
type OpenShiftClusterList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []OpenShiftCluster `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&OpenShiftCluster{}, &OpenShiftClusterList{}) | ||
} |
Oops, something went wrong.