Skip to content

Commit

Permalink
chore: Remove nested HostSpec object
Browse files Browse the repository at this point in the history
It was always temporary
  • Loading branch information
Callisto13 committed Dec 1, 2022
1 parent 5862526 commit 1c885c4
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 219 deletions.
43 changes: 21 additions & 22 deletions api/v1alpha1/microvm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ const (
type MicrovmSpec struct {
// Host sets the host device address for Microvm creation.
// +kubebuilder:validation:Required
Host HostSpec `json:"host"`
// MicrovmProxy is the proxy server details to use when calling the microvm service. This is an
// alternative to using the http proxy environment variables and applied purely to the grpc service.
MicrovmProxy *flclient.Proxy `json:"microvmProxy,omitempty"`
microvm.Host `json:",inline"`
// VMSpec contains the Microvm spec.
// +kubebuilder:validation:Required
microvm.VMSpec `json:",inline"`
Expand All @@ -59,6 +56,8 @@ type MicrovmSpec struct {
// SSHPublicKeys is list of SSH public keys which will be added to the Microvm.
// +optional
SSHPublicKeys []microvm.SSHPublicKey `json:"sshPublicKeys,omitempty"`
// TODO this needs to go and be pulled off the owning object
// probably needs to be part of Hosts once that becomes an array
// mTLS Configuration:
//
// It is recommended that each flintlock host is configured with its own cert
Expand Down Expand Up @@ -92,8 +91,26 @@ type MicrovmSpec struct {
// -----END CERTIFICATE-----
// +optional
TLSSecretRef string `json:"tlsSecretRef,omitempty"`
// TODO this needs to go and be pulled off the owning object
// probably needs to be part of Hosts once that becomes an array
// BasicAuthSecret is the name of the secret containing basic auth info for the host
// The secret should be created in the same namespace as the MicroVM.
//
// apiVersion: v1
// kind: Secret
// metadata:
// name: mybasicauthsecret
// namespace: same-as-microvm
// type: Opaque
// data:
// token: YWRtaW4=
BasicAuthSecret string `json:"basicAuthSecret,omitempty"`
// ProviderID is the unique identifier as specified by the cloud provider.
// Do not supply this field as a user.
ProviderID *string `json:"providerID,omitempty"`
// MicrovmProxy is the proxy server details to use when calling the microvm service. This is an
// alternative to using the http proxy environment variables and applied purely to the grpc service.
MicrovmProxy *flclient.Proxy `json:"microvmProxy,omitempty"`
}

// MicrovmStatus defines the observed state of Microvm
Expand Down Expand Up @@ -182,21 +199,3 @@ func (r *Microvm) GetConditions() clusterv1.Conditions {
func (r *Microvm) SetConditions(conditions clusterv1.Conditions) {
r.Status.Conditions = conditions
}

// This is temporary while I work towards something.
type HostSpec struct {
// +kubebuilder:validation:Required
microvm.Host `json:",inline"`
// BasicAuthSecret is the name of the secret containing basic auth info for the host
// The secret should be created in the same namespace as the MicroVM.
//
// apiVersion: v1
// kind: Secret
// metadata:
// name: mybasicauthsecret
// namespace: same-as-microvm
// type: Opaque
// data:
// token: YWRtaW4=
BasicAuthSecret string `json:"basicAuthSecret,omitempty"`
}
4 changes: 4 additions & 0 deletions api/v1alpha1/microvmreplicaset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
microvm "github.com/weaveworks-liquidmetal/controller-pkg/types/microvm"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
)
Expand All @@ -27,6 +28,9 @@ type MicrovmReplicaSetSpec struct {
// Microvm spec
// +kubebuilder:default=1
Replicas *int32 `json:"replicas,omitempty"`
// Host sets the host device address for Microvm creation.
// +kubebuilder:validation:Required
microvm.Host `json:",inline"`
// // Selector is a label query over microvms that should match the replica count.
// // Label keys and values that must match in order to be controlled by this replica set.
// // It must match the microvm template's labels.
Expand Down
27 changes: 6 additions & 21 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ spec:
spec:
description: MicrovmReplicaSetSpec defines the desired state of MicrovmReplicaSet
properties:
endpoint:
description: Endpoint is the API endpoint for the microvm service
(i.e. flintlock) including the port.
type: string
name:
description: Name is an optional name for the host.
type: string
replicas:
default: 1
description: Replicas is the number of Microvms to create on the given
Expand All @@ -55,28 +62,19 @@ spec:
spec:
description: Specification of the desired behavior of the Microvm.
properties:
host:
description: Host sets the host device address for Microvm
creation.
properties:
basicAuthSecret:
description: "BasicAuthSecret is the name of the secret
containing basic auth info for the host The secret should
be created in the same namespace as the MicroVM. \n
apiVersion: v1 kind: Secret metadata: name: mybasicauthsecret
namespace: same-as-microvm type: Opaque data: token:
YWRtaW4="
type: string
endpoint:
description: Endpoint is the API endpoint for the microvm
service (i.e. flintlock) including the port.
type: string
name:
description: Name is an optional name for the host.
type: string
required:
- endpoint
type: object
basicAuthSecret:
description: "TODO this needs to go and be pulled off the
owning object probably needs to be part of Hosts once that
becomes an array BasicAuthSecret is the name of the secret
containing basic auth info for the host The secret should
be created in the same namespace as the MicroVM. \n apiVersion:
v1 kind: Secret metadata: name: mybasicauthsecret namespace:
same-as-microvm type: Opaque data: token: YWRtaW4="
type: string
endpoint:
description: Endpoint is the API endpoint for the microvm
service (i.e. flintlock) including the port.
type: string
initrd:
description: Initrd is an optional initial ramdisk to use.
properties:
Expand Down Expand Up @@ -136,6 +134,9 @@ spec:
required:
- endpoint
type: object
name:
description: Name is an optional name for the host.
type: string
networkInterfaces:
description: NetworkInterfaces specifies the network interfaces
attached to the microvm.
Expand Down Expand Up @@ -172,7 +173,7 @@ spec:
type: array
providerID:
description: ProviderID is the unique identifier as specified
by the cloud provider.
by the cloud provider. Do not supply this field as a user.
type: string
rootVolume:
description: RootVolume specifies the volume to use for the
Expand Down Expand Up @@ -212,9 +213,11 @@ spec:
type: object
type: array
tlsSecretRef:
description: "mTLS Configuration: \n It is recommended that
each flintlock host is configured with its own cert signed
by a common CA, and set to use mTLS. The flintlock-operator
description: "TODO this needs to go and be pulled off the
owning object probably needs to be part of Hosts once that
becomes an array mTLS Configuration: \n It is recommended
that each flintlock host is configured with its own cert
signed by a common CA, and set to use mTLS. The flintlock-operator
should be provided with the CA, and a client cert and key
signed by that CA. TLSSecretRef is a reference to the name
of a secret which contains TLS cert information for connecting
Expand Down Expand Up @@ -268,14 +271,16 @@ spec:
type: object
type: array
required:
- host
- endpoint
- kernel
- memoryMb
- networkInterfaces
- rootVolume
- vcpu
type: object
type: object
required:
- endpoint
type: object
status:
description: MicrovmReplicaSetStatus defines the observed state of MicrovmReplicaSet
Expand Down
61 changes: 29 additions & 32 deletions config/crd/bases/infrastructure.flintlock.x-k8s.io_microvms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,18 @@ spec:
spec:
description: MicrovmSpec defines the desired state of Microvm
properties:
host:
description: Host sets the host device address for Microvm creation.
properties:
basicAuthSecret:
description: "BasicAuthSecret is the name of the secret containing
basic auth info for the host The secret should be created in
the same namespace as the MicroVM. \n apiVersion: v1 kind: Secret
metadata: name: mybasicauthsecret namespace: same-as-microvm
type: Opaque data: token: YWRtaW4="
type: string
endpoint:
description: Endpoint is the API endpoint for the microvm service
(i.e. flintlock) including the port.
type: string
name:
description: Name is an optional name for the host.
type: string
required:
- endpoint
type: object
basicAuthSecret:
description: "TODO this needs to go and be pulled off the owning object
probably needs to be part of Hosts once that becomes an array BasicAuthSecret
is the name of the secret containing basic auth info for the host
The secret should be created in the same namespace as the MicroVM.
\n apiVersion: v1 kind: Secret metadata: name: mybasicauthsecret
namespace: same-as-microvm type: Opaque data: token: YWRtaW4="
type: string
endpoint:
description: Endpoint is the API endpoint for the microvm service
(i.e. flintlock) including the port.
type: string
initrd:
description: Initrd is an optional initial ramdisk to use.
properties:
Expand Down Expand Up @@ -111,6 +103,9 @@ spec:
required:
- endpoint
type: object
name:
description: Name is an optional name for the host.
type: string
networkInterfaces:
description: NetworkInterfaces specifies the network interfaces attached
to the microvm.
Expand Down Expand Up @@ -146,7 +141,7 @@ spec:
type: array
providerID:
description: ProviderID is the unique identifier as specified by the
cloud provider.
cloud provider. Do not supply this field as a user.
type: string
rootVolume:
description: RootVolume specifies the volume to use for the root of
Expand Down Expand Up @@ -185,16 +180,18 @@ spec:
type: object
type: array
tlsSecretRef:
description: "mTLS Configuration: \n It is recommended that each flintlock
host is configured with its own cert signed by a common CA, and
set to use mTLS. The flintlock-operator should be provided with
the CA, and a client cert and key signed by that CA. TLSSecretRef
is a reference to the name of a secret which contains TLS cert information
for connecting to Flintlock hosts. The secret should be created
in the same namespace as the MicroVMCluster. The secret should be
of type Opaque with the addition of a ca.crt key. \n apiVersion:
v1 kind: Secret metadata: name: secret-tls namespace: default <-
same as Cluster type: Opaque data: tls.crt: | -----BEGIN CERTIFICATE-----
description: "TODO this needs to go and be pulled off the owning object
probably needs to be part of Hosts once that becomes an array mTLS
Configuration: \n It is recommended that each flintlock host is
configured with its own cert signed by a common CA, and set to use
mTLS. The flintlock-operator should be provided with the CA, and
a client cert and key signed by that CA. TLSSecretRef is a reference
to the name of a secret which contains TLS cert information for
connecting to Flintlock hosts. The secret should be created in the
same namespace as the MicroVMCluster. The secret should be of type
Opaque with the addition of a ca.crt key. \n apiVersion: v1 kind:
Secret metadata: name: secret-tls namespace: default <- same as
Cluster type: Opaque data: tls.crt: | -----BEGIN CERTIFICATE-----
MIIC2DCCAcCgAwIBAgIBATANBgkqh ... -----END CERTIFICATE----- tls.key:
| -----BEGIN EC PRIVATE KEY----- MIIEpgIBAAKCAQEA7yn3bRHQ5FHMQ ...
-----END EC PRIVATE KEY----- ca.crt: | -----BEGIN CERTIFICATE-----
Expand Down Expand Up @@ -236,7 +233,7 @@ spec:
type: object
type: array
required:
- host
- endpoint
- kernel
- memoryMb
- networkInterfaces
Expand Down
Loading

0 comments on commit 1c885c4

Please sign in to comment.