Skip to content
Open
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
4 changes: 4 additions & 0 deletions .ko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
defaultLdflags:
- -s -w
- -X k8s.io/kops.Version={{.Env.VERSION}}
- -X k8s.io/kops.GitVersion={{.Env.GITSHA}}
29 changes: 14 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,28 @@ unexport AZURE_CLIENT_ID AZURE_CLIENT_SECRET AZURE_STORAGE_ACCOUNT AZURE_SUBSCRI


VERSION=$(shell tools/get_version.sh | grep VERSION | awk '{print $$2}')
export VERSION

IMAGE_TAG=$(shell tools/get_version.sh | grep IMAGE_TAG | awk '{print $$2}')

KOPS_RELEASE_VERSION:=$(shell grep 'KOPS_RELEASE_VERSION\s*=' kops-version.go | awk '{print $$3}' | sed -e 's_"__g')
KOPS_CI_VERSION:=$(shell grep 'KOPS_CI_VERSION\s*=' kops-version.go | awk '{print $$3}' | sed -e 's_"__g')

# kops local location
KOPS=${DIST}/$(shell go env GOOS)/$(shell go env GOARCH)/kops

GITSHA := $(shell cd ${KOPS_ROOT}; git describe --always)
export GITSHA

# We lock the versions of our controllers also
# We need to keep in sync with:
# pkg/model/components/etcdmanager/model.go
KOPS_UTILS_CP_TAG=1.34.0-beta.1
KOPS_UTILS_CP_PUSH_TAG=$(shell tools/get_workspace_status.sh | grep STABLE_KOPS_UTILS_CP_TAG | awk '{print $$2}')
KOPS_UTILS_CP_TAG=$(IMAGE_TAG)
# upup/models/cloudup/resources/addons/dns-controller/
DNS_CONTROLLER_TAG=1.34.0-beta.1
DNS_CONTROLLER_PUSH_TAG=$(shell tools/get_workspace_status.sh | grep STABLE_DNS_CONTROLLER_TAG | awk '{print $$2}')
DNS_CONTROLLER_TAG=$(IMAGE_TAG)
# upup/models/cloudup/resources/addons/kops-controller.addons.k8s.io/
KOPS_CONTROLLER_TAG=1.34.0-beta.1
KOPS_CONTROLLER_PUSH_TAG=$(shell tools/get_workspace_status.sh | grep STABLE_KOPS_CONTROLLER_TAG | awk '{print $$2}')
KOPS_CONTROLLER_TAG=$(IMAGE_TAG)
# pkg/model/components/kubeapiserver/model.go
KUBE_APISERVER_HEALTHCHECK_TAG=1.34.0-beta.1
KUBE_APISERVER_HEALTHCHECK_PUSH_TAG=$(shell tools/get_workspace_status.sh | grep STABLE_KUBE_APISERVER_HEALTHCHECK_TAG | awk '{print $$2}')
KUBE_APISERVER_HEALTHCHECK_TAG=$(IMAGE_TAG)

CGO_ENABLED=0
export CGO_ENABLED
Expand Down Expand Up @@ -261,9 +260,7 @@ gcs-upload-and-tag: gsutil gcs-upload
gsutil -h "Cache-Control:private, max-age=0, no-transform" cp ${UPLOAD}/latest.txt ${GCS_LOCATION}${LATEST_FILE}

# gcs-publish-ci is the entry point for CI testing
# In CI testing, always upload the CI version.
.PHONY: gcs-publish-ci
gcs-publish-ci: VERSION := ${KOPS_CI_VERSION}+${GITSHA}
gcs-publish-ci: gsutil version-dist-ci
@echo "== Uploading kops =="
gsutil -h "Cache-Control:private, max-age=0, no-transform" -m cp -n -r ${UPLOAD}/kops/* ${GCS_LOCATION}
Expand Down Expand Up @@ -308,14 +305,14 @@ dns-controller-push: ko-dns-controller-push

.PHONY: ko-dns-controller-push
ko-dns-controller-push:
KO_DOCKER_REPO="${DOCKER_REGISTRY}/${DOCKER_IMAGE_PREFIX}dns-controller" GOFLAGS="-tags=peer_name_alternative,peer_name_hash" ${KO} build --tags ${DNS_CONTROLLER_PUSH_TAG} --platform=linux/amd64,linux/arm64 --bare ./dns-controller/cmd/dns-controller/
KO_DOCKER_REPO="${DOCKER_REGISTRY}/${DOCKER_IMAGE_PREFIX}dns-controller" GOFLAGS="-tags=peer_name_alternative,peer_name_hash" ${KO} build --tags ${DNS_CONTROLLER_TAG} --platform=linux/amd64,linux/arm64 --bare ./dns-controller/cmd/dns-controller/

.PHONY: kops-utils-cp-push
kops-utils-cp-push: ko-kops-utils-cp-push

.PHONY: ko-kops-utils-cp-push
ko-kops-utils-cp-push:
KO_DOCKER_REPO="${DOCKER_REGISTRY}/${DOCKER_IMAGE_PREFIX}kops-utils-cp" ${KO} build --tags ${KOPS_UTILS_CP_PUSH_TAG} --platform=linux/amd64,linux/arm64 --bare ./cmd/kops-utils-cp/
KO_DOCKER_REPO="${DOCKER_REGISTRY}/${DOCKER_IMAGE_PREFIX}kops-utils-cp" ${KO} build --tags ${KOPS_UTILS_CP_TAG} --platform=linux/amd64,linux/arm64 --bare ./cmd/kops-utils-cp/

# --------------------------------------------------
# development targets
Expand Down Expand Up @@ -410,6 +407,8 @@ quick-ci: verify-crds verify-goimports govet verify-boilerplate verify-versions
# --------------------------------------------------
# release tasks

KOPS_RELEASE_VERSION:=$(shell grep 'KOPS_RELEASE_VERSION\s*=' kops-version.go | awk '{print $$3}' | sed -e 's_"__g')

.PHONY: release-tag
release-tag:
git tag v${KOPS_RELEASE_VERSION}
Expand Down Expand Up @@ -762,7 +761,7 @@ kops-controller-push: ko-kops-controller-push

.PHONY: ko-kops-controller-push
ko-kops-controller-push:
KO_DOCKER_REPO="${DOCKER_REGISTRY}/${DOCKER_IMAGE_PREFIX}kops-controller" ${KO} build --tags ${KOPS_CONTROLLER_PUSH_TAG} --platform=linux/amd64,linux/arm64 --bare ./cmd/kops-controller/
KO_DOCKER_REPO="${DOCKER_REGISTRY}/${DOCKER_IMAGE_PREFIX}kops-controller" ${KO} build --tags ${KOPS_CONTROLLER_TAG} --platform=linux/amd64,linux/arm64 --bare ./cmd/kops-controller/

#------------------------------------------------------
# kube-apiserver-healthcheck
Expand All @@ -772,7 +771,7 @@ kube-apiserver-healthcheck-push: ko-kube-apiserver-healthcheck-push

.PHONY: ko-kube-apiserver-healthcheck-push
ko-kube-apiserver-healthcheck-push:
KO_DOCKER_REPO="${DOCKER_REGISTRY}/${DOCKER_IMAGE_PREFIX}kube-apiserver-healthcheck" ${KO} build --tags ${KUBE_APISERVER_HEALTHCHECK_PUSH_TAG} --platform=linux/amd64,linux/arm64 --bare ./cmd/kube-apiserver-healthcheck/
KO_DOCKER_REPO="${DOCKER_REGISTRY}/${DOCKER_IMAGE_PREFIX}kube-apiserver-healthcheck" ${KO} build --tags ${KUBE_APISERVER_HEALTHCHECK_TAG} --platform=linux/amd64,linux/arm64 --bare ./cmd/kube-apiserver-healthcheck/

#------------------------------------------------------
# CloudBuild artifacts
Expand Down
39 changes: 28 additions & 11 deletions clusterapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ We plug in our own bootstrap provider with the goal of enabling cluster-api node
*Note*: the name & zone matter, we need to match the values we'll create later in the CAPI resources.

```
kops create cluster clusterapi.k8s.local --zones us-east4-a
kops update cluster clusterapi.k8s.local --yes --admin
kops validate cluster --wait=10m
go run ./cmd/kops create cluster clusterapi.k8s.local --zones us-east4-a
go run ./cmd/kops update cluster clusterapi.k8s.local --yes --admin
go run ./cmd/kops validate cluster --wait=10m
```

#cd cluster-api-provider-gcp
#REGISTRY=${USER} make docker-build docker-push
#REGISTRY=${USER} make install-management-cluster # Doesn't yet exist in capg

# Install cert-manager

```
kubectl apply --server-side -f https://github.com/cert-manager/cert-manager/releases/download/v1.18.2/cert-manager.yaml

# TODO: Install cert-manager
kubectl wait --for=condition=Available --timeout=5m -n cert-manager deployment/cert-manager
kubectl wait --for=condition=Available --timeout=5m -n cert-manager deployment/cert-manager-cainjector
kubectl wait --for=condition=Available --timeout=5m -n cert-manager deployment/cert-manager-webhook
```

# Install CAPI and CAPG
```
Expand All @@ -29,7 +31,19 @@ kustomize build ${REPO_ROOT}/clusterapi/manifests/cluster-api-provider-gcp | kub

# Install our CRDs
```
kustomize build config | kubectl apply --server-side -f -
kustomize build ${REPO_ROOT}/k8s | kubectl apply --server-side -f -
kustomize build ${REPO_ROOT}/clusterapi/config | kubectl apply --server-side -f -
```

## Create our Cluster object
```
go run ./cmd/kops get cluster clusterapi.k8s.local -oyaml | kubectl apply --server-side -n kube-system -f -
```

## Create our instancegroup object

```
go run ./cmd/kops get ig nodes-us-east4-a --name clusterapi.k8s.local -oyaml | kubectl apply --server-side -n kube-system -f -
```

# Remove any stuff left over from previous runs
Expand All @@ -39,8 +53,11 @@ kubectl delete gcpmachinetemplate --all
```

```
# Very carefully create a MachineDeployment matching our configuration
cat examples/manifest.yaml | IMAGE_ID=projects/ubuntu-os-cloud/global/images/family/ubuntu-2204-lts GCP_NODE_MACHINE_TYPE=e2-medium KUBERNETES_VERSION=v1.28.6 WORKER_MACHINE_COUNT=1 GCP_ZONE=us-east4-a GCP_REGION=us-east4 GCP_NETWORK_NAME=clusterapi-k8s-local GCP_SUBNET=us-east4-clusterapi-k8s-local GCP_PROJECT=$(gcloud config get project) CLUSTER_NAME=clusterapi-k8s-local envsubst | kubectl apply --server-side -n kube-system -f -
# Create a MachineDeployment matching our configuration
go run ./cmd/kops toolbox clusterapi generate machinedeployment \
--cluster clusterapi.k8s.local \
--name clusterapi-k8s-local-md-0 \
--namespace kube-system | kubectl apply --server-side -n kube-system -f -
```

# IMAGE_ID=projects/debian-cloud/global/images/family/debian-12 doesn't work with user-data (????)
Expand Down

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

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

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

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

28 changes: 28 additions & 0 deletions clusterapi/controlplane/kops/api/v1beta1/kopscontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,41 @@ type KopsControlPlaneMachineTemplate struct {

// KopsControlPlaneStatus defines the observed state of KopsControlPlane.
type KopsControlPlaneStatus struct {
// initialization provides observations of the KopsControlPlane initialization process.
// NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Machine provisioning.
// +optional
Initialization KopsControlPlaneInitializationStatus `json:"initialization,omitempty,omitzero"`

// KopsControllerEndpoint represents the endpoints used to communicate with the control plane.
SystemEndpoints []SystemEndpoint `json:"systemEndpoints,omitempty"`
}

// KopsControlPlaneInitializationStatus provides observations of the KopsControlPlane initialization process.
// +kubebuilder:validation:MinProperties=1
type KopsControlPlaneInitializationStatus struct {
// controlPlaneInitialized is true when the KopsControlPlane provider reports that the Kubernetes control plane is initialized;
// A control plane is considered initialized when it can accept requests, no matter if this happens before
// the control plane is fully provisioned or not.
// NOTE: this field is part of the Cluster API contract, and it is used to orchestrate initial Machine provisioning.
// +optional
ControlPlaneInitialized *bool `json:"controlPlaneInitialized,omitempty"`
}

// SystemEndpoint represents a reachable Kubernetes API endpoint.
type SystemEndpoint struct {
// The hostname on which the API server is serving.
Host string `json:"host"`
// The hostname on which the API server is serving.
Type string `json:"type"`
Scope string `json:"scope"`
}

// +kubebuilder:object:root=true
// +kubebuilder:resource:path=kopscontrolplanes,shortName=kcp,scope=Namespaced,categories=cluster-api
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector
// +kubebuilder:metadata:labels=cluster.x-k8s.io/v1beta2=v1beta1
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels['cluster\\.x-k8s\\.io/cluster-name']",description="Cluster"
// +kubebuilder:printcolumn:name="Initialized",type=boolean,JSONPath=".status.initialized",description="This denotes whether or not the control plane has the uploaded kops-config configmap"
// +kubebuilder:printcolumn:name="API Server Available",type=boolean,JSONPath=".status.ready",description="KopsControlPlane API Server is ready to receive requests"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type KopsControlPlaneTemplateSpec struct {
// +kubebuilder:object:root=true
// +kubebuilder:resource:path=kopscontrolplanetemplates,scope=Namespaced,categories=cluster-api
// +kubebuilder:storageversion
// +kubebuilder:metadata:labels=cluster.x-k8s.io/v1beta2=v1beta1
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of KopsControlPlaneTemplate"

// KopsControlPlaneTemplate is the Schema for the kopscontrolplanetemplates API.
Expand Down

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

Loading
Loading