forked from confidential-containers/cloud-api-adaptor
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is basically Cfir's work with some modifications to support the repository layout and small fixes. Rigth now, GKE is not supported because confidential-containers#1909, so this initial implementation requires a k8s cluster (either local or at Google Compute Engine). Signed-off-by: Cfir Cohen <[email protected]> Signed-off-by: Beraldo Leal <[email protected]>
- Loading branch information
1 parent
96a6e33
commit 24cb8a9
Showing
16 changed files
with
438 additions
and
13 deletions.
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
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
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,10 @@ | ||
//go:build gcp | ||
|
||
// (C) Copyright Confidential Containers Contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package main | ||
|
||
import ( | ||
_ "github.com/confidential-containers/cloud-api-adaptor/src/cloud-providers/gcp" | ||
) |
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
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
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
55 changes: 55 additions & 0 deletions
55
src/cloud-api-adaptor/install/overlays/gcp/kustomization.yaml
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,55 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- ../../yamls | ||
|
||
images: | ||
- name: cloud-api-adaptor | ||
newName: 192.168.122.1:5000/cloud-api-adaptor # change image if needed | ||
newTag: latest | ||
|
||
generatorOptions: | ||
disableNameSuffixHash: true | ||
|
||
configMapGenerator: | ||
- name: peer-pods-cm | ||
namespace: confidential-containers-system | ||
literals: | ||
- CLOUD_PROVIDER="gcp" | ||
#- PAUSE_IMAGE="" # Uncomment and set if you want to use a specific pause image | ||
#- VXLAN_PORT="" # Uncomment and set if you want to use a specific vxlan port. Defaults to 4789 | ||
- PODVM_IMAGE_NAME="" # set from step "Build Pod VM Image" in gcp/README.md | ||
- GCP_PROJECT_ID="" # set | ||
- GCP_ZONE="" # set e.g. "us-west1-a" | ||
- GCP_MACHINE_TYPE="e2-medium" # replace if needed. caa defaults to e2-medium | ||
- GCP_NETWORK="global/networks/default" # replace if needed. | ||
##TLS_SETTINGS | ||
#- CACERT_FILE="/etc/certificates/ca.crt" # for TLS | ||
#- CERT_FILE="/etc/certificates/client.crt" # for TLS | ||
#- CERT_KEY="/etc/certificates/client.key" # for TLS | ||
#- TLS_SKIP_VERIFY="" # for testing only | ||
##TLS_SETTINGS | ||
|
||
secretGenerator: | ||
- name: auth-json-secret | ||
namespace: confidential-containers-system | ||
files: | ||
#- auth.json # set - path to auth.json pull credentials file | ||
- name: peer-pods-secret | ||
namespace: confidential-containers-system | ||
files: | ||
- GCP_CREDENTIALS # make sure this file has the application credentials. You can reuse the Packer creds created in "Build Pod VM Image" | ||
##TLS_SETTINGS | ||
#- name: certs-for-tls | ||
# namespace: confidential-containers-system | ||
# files: | ||
# - <path_to_ca.crt> # set - path to ca.crt | ||
# - <path_to_client.crt> # set - path to client.crt | ||
# - <path_to_client.key> # set - path to client.key | ||
##TLS_SETTINGS | ||
|
||
patchesStrategicMerge: | ||
##TLS_SETTINGS | ||
#- tls_certs_volume_mount.yaml # set (for tls) | ||
##TLS_SETTINGS |
21 changes: 21 additions & 0 deletions
21
src/cloud-api-adaptor/install/overlays/gcp/tls_certs_volume_mount.yaml
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 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: cloud-api-adaptor-daemonset | ||
namespace: confidential-containers-system | ||
labels: | ||
app: cloud-api-adaptor | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: cloud-api-adaptor-con | ||
volumeMounts: | ||
- mountPath: /etc/certificates | ||
name: certs | ||
volumes: | ||
- name: certs | ||
secret: | ||
secretName: certs-for-tls | ||
|
||
# to apply this uncomment the patchesStrategicMerge of this file in kustomization.yaml |
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,40 @@ | ||
// (C) Copyright Confidential Containers Contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package gcp | ||
|
||
import ( | ||
"flag" | ||
|
||
provider "github.com/confidential-containers/cloud-api-adaptor/src/cloud-providers" | ||
) | ||
|
||
var gcpcfg Config | ||
|
||
type Manager struct{} | ||
|
||
func init() { | ||
provider.AddCloudProvider("gcp", &Manager{}) | ||
} | ||
|
||
func (_ *Manager) ParseCmd(flags *flag.FlagSet) { | ||
|
||
flags.StringVar(&gcpcfg.GcpCredentials, "gcp-credentials", "", "Google Application Credentials, defaults to `GCP_CREDENTIALS`") | ||
flags.StringVar(&gcpcfg.ProjectId, "gcp-project-id", "", "GCP Project ID") | ||
flags.StringVar(&gcpcfg.Zone, "gcp-zone", "", "Zone") | ||
flags.StringVar(&gcpcfg.ImageName, "gcp-image-name", "", "Pod VM image name") | ||
flags.StringVar(&gcpcfg.MachineType, "gcp-machine-type", "e2-medium", "Pod VM instance type") | ||
flags.StringVar(&gcpcfg.Network, "gcp-network", "", "Network ID to be used for the Pod VMs") | ||
} | ||
|
||
func (_ *Manager) LoadEnv() { | ||
provider.DefaultToEnv(&gcpcfg.GcpCredentials, "GCP_CREDENTIALS", "") | ||
} | ||
|
||
func (_ *Manager) NewProvider() (provider.Provider, error) { | ||
return NewProvider(&gcpcfg) | ||
} | ||
|
||
func (_ *Manager) GetConfig() (config *Config) { | ||
return &gcpcfg | ||
} |
Oops, something went wrong.